Not sure if this is your problem, but I do notice you commented out the super.onActivityResult function in your onActivityResult function. I don't know all of what the parent method for that function does, but it's pretty good practice to always call the super method first when you override a method. It could be doing some setup for you.
I could be way off and that's not what's causing your problem, but it's a good idea to do it anyway, except for in methods where you know you shouldn't, like the method for an option item being selected. On Mar 11, 3:20 pm, Geos <[email protected]> wrote: > Hello All > > I've use startActivityForResult as it described in many examples but > it return 0 result code after start new Activity. > > In main Activity I use such code for sub activity invocation > > Intent iShowVideo = new Intent(EventHandling.this, > ShowVideo.class); > startActivityForResult(iShowVideo, > this.REQUEST_CODE_SHOW_VIDEO); > > And such code for getting results. > > @Override > protected void onActivityResult(int requestCode, int resultCode, > Intent data) { > // TODO Auto-generated method stub > //super.onActivityResult(requestCode, resultCode, data); > if(requestCode == REQUEST_CODE_SHOW_VIDEO){ > if(resultCode == RESULT_CANCELED){ > Toast toast = Toast.makeText(this, > "onActivityResultCancel: " + > String.valueOf(resultCode), Toast.LENGTH_LONG); > toast.show(); > }else{ > Toast toast = Toast.makeText(this, > "onActivityResult: " + > String.valueOf(resultCode), Toast.LENGTH_LONG); > toast.show(); > } > } > } > > Here is a part code from ShowVideo activity > @Override > protected void onCreate(Bundle savedInstanceState) { > // TODO Auto-generated method stub > super.onCreate(savedInstanceState); > > setContentView(R.layout.showvideo); > //showDialog(DIALOG_YES_NO_MESSAGE); > > Button button = (Button)findViewById(R.id.btnOK); > button.setOnClickListener(mOkListener); > button = (Button)findViewById(R.id.btnCancel); > button.setOnClickListener(mCancelListener); > > //setResult(RESULT_OK, (new Intent()).setAction("Test!")); > } > > private OnClickListener mOkListener = new OnClickListener() > { > public void onClick(View v) > { > // To send a result, simply call setResult() before your > // activity is finished. > setResult(RESULT_OK, (new Intent()).setAction("Corky!")); > finish(); > } > }; > > This code should work according many examples. And it should return > RESULT_OK after btnOK clicked but after I click this button it only > closes ShowVideo Activity. > > Please help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

