I have an activity. In this activity I want to start another activity using startActivityForResult(). I understand that my basic activity is started within a process with a main GUI thread.
But as far as I understand, startActivityForResult() is asynchronious which means that my new activity will be executed in a different thread.
I can’t find information regarding the threads inside. If there is only one GUI thread, how does these functions work asynchroniously ?
I have an activity. In this activity I want to start another activity using
Share
startActivityForResult()is asynchronous. That does not mean that your new activity will be executed in a different thread. If the new activity is part of your own application, it runs on the main application thread, like all your other activities.startActivityForResult(), likestartActivity(), does not do anything immediately. Rather, it puts a message on a message queue, then returns. When you return control back to Android (e.g., youronClick()method ends), Android goes back to processing messages off of that queue. When it gets to your start-activity message, it starts up the new activity.