bug小结

1,Couldn't read row 1, col 1 from CursorWindow

java.lang.IllegalStateException: Couldn't read row 1, col 1 from CursorWindow.Make sure the Cursor is initialized correctly before accessing data from it.

原因:查询字段与数据库的字段不一致(严格区分大小写)导致不能读取到。,

2,启动Activity用startActivityForResult 不能回调onActivityResult()

http://www.eoeandroid.com/thread-43479-1-1.html

我点击按钮启动一个界面 再回调
启动代码如下:


  1. Intent intent = new Intent();
  2. intent.setClass(this,InsertActivity.class);
  3. this.startActivityForResult(intent, 0);

复制代码
InsertActivity 返回代码如下


  1. Intent intent = getIntent();
  2. Bundle bd = new Bundle();
  3. bd.putSerializable("VO", vo);
  4. intent.putExtras(bd);
  5. this.setResult(2, intent);
  6. this.finish();
复制代码
回调方法:

  1. protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  2. switch (resultCode) {

  3. case 2:
  4. System.out.println("进来了");
  5. break;

  6. default:
  7. Toast.makeText(NewTaskListSurveyInputSecondInfoActivity.this,
  8. "默认了", Toast.LENGTH_LONG).show();
  9. break;
  10. }
  11. }

复制代码

代码是这样写的
我AndroidManifest.xml这个activity定义是弹出来的
<activity android:name="com.demo.InsertActivity" android:theme="@android:style/Theme.Dialog"android:launchMode="singleInstance"></activity>

红色部分是我加的属性 我把android:launchMode="singleInstance"属性去掉就能回调,加上就不行

我加上android:launchMode="singleInstance" 我是想不管点击这个按钮多少次 都只会弹出一个InsertActivity
如果不用属性android:launchMode="singleInstance"还有什么好的方法呢??除开 那种开关试的按钮存在
或者解决加上android:launchMode="singleInstance" 让他回调onActivityResult()??

注:android:launchMode="singleTask" 不行 他会启动之前就调用onActivityResult

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值