How To Pass Intent Extras To Onactivityresult When Activity Reboot?
I am writing an android application. Need to pass int value.I have a listview that it has contextmenu.I must start Intent.Action_Call. When I start my intent. My application is goi
Solution 1:
It sounds like you're expecting to be able to call this:
Intent i = new Intent(...);
i.putExtra("some_key", someValue);
startActivityForResult(i, requestCode);
and then later, when you receive the result:
protected void onActivityResult(... Intent data) {
data.getExtra("some_key"); // should be `someValue` from above
}
Unfortunately, this is not how it works. The Intent data argument to onActivityResult() is not the same Intent that you used to start that activity. The activity that you started has complete control over whether the data intent is non-null, and what's inside of it.
Usually for public APIs, there is documentation about what you can expect to have inside the data intent.
Solution 2:
First of all, put this on onContextItemSelected
SharedPreferences settings = getSharedPreferences("PREFS_NAME", MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
editor.clear();
editor.putInt("kelime", selectedPosition);
editor.commit();
After Settle down above cod,Set onActivityResult
SharedPreferences settings = getSharedPreferences("PREFS_NAME", MODE_PRIVATE);
int selec = settings.getInt("kelime",selectedPosition);
Finally, set the adapter same void :
kullanıcısayıdegerlistesi.remove(selec);
kullanıcısayıdegerlistesi.add(selec ,String.valueOf(sonuc));
Post a Comment for "How To Pass Intent Extras To Onactivityresult When Activity Reboot?"