问题
I'm invoking android native calculator from my app, how do i get result data from it.. means i started native calender like this, after finishing calculation i press back onActivityResult is not executing.. Help me
Intent i = new Intent();
i.setClassName("com.android.calculator2",
"com.android.calculator2.Calculator");
startActivityForResult(i, 1);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == 1){
Log.i("CALCULATOR", "Result Data is"+ data);
}
}
回答1:
Start it:
Intent i = new Intent();
i.setClassName("com.android.calculator2",
"com.android.calculator2.Calculator");
Then the Calculator Acitivity should usesetResult(RESULT_SUCESS, simple_intent_with_result_as_extra)
When the Calculator Activity Exits, the onActivityResult will be called on your original Activity with that Intent you passed earlier.
来源:https://stackoverflow.com/questions/10553893/how-to-get-result-data-from-android-native-calculator