Get Back Result From Android Native Calculator
Solution 1:
After some testing, I'm starting to think that you can't really get something back from the calculator. Calling something with startActivityForResult
doesn't mean it's going to return something other than null
and since there's no way of getting out of the calculator other than pressing the back key, I think this is one of those cases.
The native calculator doesn't seem to be calling setResult(RESULT_SUCESS,intent_with_data)
which is the step needed to be able to retrieve this result. Easiest thing I can think of, since you're wanting to do some calculation is to implement your own calculator class and call that one instead of the native one.
Calculators are easy to make and you have a zillion examples on the net. Just make sure you have an OK
button that calls setResult(RESULT_SUCESS, intent_with_data)
after you put extras to the intent with the result.
Warning
Be aware that you're hardcoding a class name instead of calling an intent by specifying an action and URI. This may call the original calculator on the emulator and standard versions of Android, but manufacturers change those kinds of things and since no one is supposed to be calling them like you intend to with your intent, you may end up crashing the app.
Post a Comment for "Get Back Result From Android Native Calculator"