android - application fails when more than one activity calls startActivityForResult -


I have 2 activities that call a third activity using startActivityForResult but after the third activity is over, Failure fails before it When I initially used to call only 1 activity, it used to work fine and if I use debugger, it means that it usually does not make sense.

Activity A ::

  button1.setOnClickListener (New View. OnClickListener) {Public Zero onClick (see v) {intent = new intent as my code This is as follows: Intent.setClass (ActivityA.this, AddActivity.class); startActivityForResult (intent, ADD_CATEGORY);}}); Protected Zero on the Active Result (int request code, Inc. result, code, intent data) {super.onActivityResult (requestCode, resultCode, data); If (requestCode == ADD_CATEGORY & amp; amp; resultCode == RESULT_OK) {if (data.getCharSequenceExtra ("added") = null!) {String category = data.getCharSequenceExtra ("added") toString (). CategoryList.add (category); }}}   

Activity B:

  button.setOnClickListener (New View. OnClickListener) {Public Zero onClick (see v) {intent = new Intent (); intent.setClass (Activity B. Additivity.class); startActivityForResult (intent, ADD_ITEM);}}); Protected Zero on the Active Result (int request code, Inc. result, code, intent data) {super.onActivityResult (requestCode, resultCode, data); If (requestCode == ADD_ITEM & amp; amp; amp; resultcode == RESULT_OK) {string item = data. GetCharSequenceExtra ("added"). ToString (); If (currentList == faucet) {currentList = new arreelist & lt; String & gt; (); } CurrentList.add (item); Collections.sort (currentList); }}   

Activity C:

  Public Class AddActivity Extension Activity {Public Zero OnCreate (bundled savedInstanceState) {super.onCreate (savedInstanceState); SetContentView (R.layout.add); Find the last edit test edittext = (edit text) VVIBID (RID.); Edittext.setOnKeyListener (New OnKeyListener) {Public Boolean onKey (v View, Integer keycode, KeyEvent event) // // If there is a key-down event on the "Log In" button, then if ((event.getAction () = = KeyEvent.ACTION_DOWN) & amp; Charsequence text = edittext.getText (), (keycode == KeyEvent.KEYCODE_ENTER)) {Bullet activity intent = new intent () to return items added to // intent.putExtra ("Added", Text); Set Result (RESULT_OK, Intent); End (); Actual; True;} Return False;}}); }}   

Am I missing something or could it be an Android bug?

if (data! = Null & amp; amp; data is HACextra ("added")) Use your onActivityResult function to cross a data variable on the to verify if the user hits the back button. Then it will return to the previous activity but will be zero in data in onActivityResult .

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -