how to use onActivityResult(..) if the activity is called from a menu

前端 未结 2 1977
梦谈多话
梦谈多话 2021-01-05 03:02

This is my problem:

class main extends menuActivity{
  //
  ..
  //
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
     if (r         


        
相关标签:
2条回答
  • 2021-01-05 03:53

    It doesn't matter where you create the intent. If you've used Activity's startActivityForResult() method, then you'll receive results in onActivityResult() function.

    0 讨论(0)
  • 2021-01-05 04:04

    Finish the activity you are starting for result like this

      Bundle b = new Bundle();
      b.putString(key, value);
      Intent i = getIntent(); //gets the intent that called this intent
      i.putExtras(b);
      setResult(Activity.RESULT_OK, i);
      finish();
    
    0 讨论(0)
提交回复
热议问题