startactivityforResult不工作

时间:2012-05-25 09:30:49

标签: android

     Intent bookIntent = new Intent(this,ParseJson.class);
         // bookIntent.setClass(TitanGallery.this,ParseJson.class);
          startActivityForResult(bookIntent,BOOK_SELECT);


        protected void onActivityResult(int requestCode, int resultCode, Intent data) 
         {
          // TODO Auto-generated method stub
          super.onActivityResult(requestCode, resultCode, data);
          Toast.makeText(getApplicationContext(), "test", Toast.LENGTH_SHORT).show();
         }

调用活动

Bundle b  = new Bundle();
      b.putStringArrayList("str_array", values);
      Intent go_parent  = new Intent();
      go_parent.putExtras(b);
      setResult(RESULT_OK,go_parent);
      finish();

我有一个调用startactivityforResult的活动,该活动为数组提供了一个包。子活动没有被调用。我为此已经提到了很多代码,但我没有得到我的错误。如果你学会了人们可以调查此事吗?

1 个答案:

答案 0 :(得分:0)

试试这个......

protected void onActivityResult(int requestCode, int resultCode, Intent data)  {
  // TODO Auto-generated method stub
  if(requestCode == BOOK_SELECT && resultCode == RESULT_OK) {
  Toast.makeText(getApplicationContext(), "test", Toast.LENGTH_SHORT).show();
  }
}