onActivityResult is never called in TabActivity

后端 未结 4 2088
谎友^
谎友^ 2021-01-21 17:39

I know there are tons of the same questions, but still OnActivityResult is not being called.

This is my code

Activity A:

        Intent i = new          


        
相关标签:
4条回答
  • 2021-01-21 18:03

    Try adding an intent to the result, this code works for me:

    Intent in = new Intent(); 
    setResult(101, in);
    finish();
    
    0 讨论(0)
  • 2021-01-21 18:10

    On the child activity, I used it on the child activity

    getParent().startActivityForResult(intent, positive_request_code);
    
    0 讨论(0)
  • 2021-01-21 18:18

    Ok i got it, The main issue was that i called the activtiy from within the tab host. I called it from the Activity that contains the tabs (the one that extends TabActivity) and it works.

    So in brief, even though i'm using each tab as an activity,
    the one that should call the startActivityForResult is the main activity that extends TabActivity.

    Thank you all for your help

    0 讨论(0)
  • 2021-01-21 18:22

    Try below code

    Intent returnIntent = new Intent();
    returnIntent.putExtra("ProfilePicPath", path);
    setResult(RESULT_OK, returnIntent);
    finish();
    
    0 讨论(0)
提交回复
热议问题