I'm experimenting with creating a custom Android Home Screen. I've used the sample Home Screen application and have adapted it. Something I would like to do, is open the contact picker from a button in the Home Screen and use the contact that the user chose in a next action. I've stumbled on the same problem that is mentioned in this question.
How can I work around this so that the home screen stays "singleInstance" and I can also call startActivityForResult()?
Is the contacts picker an activity that I can subclass (I've searched but can't find any) so that I can use the solution that David Wasser proposes in the aforementioned question?
I've found an elegant solution after all:
My main activity launches an intermediate, invisible activity that has
android:theme="@android:style/Theme.NoDisplay"
This intermediate activity calls the contact picker in its
onCreate
Then, in
onActivityResult
, it creates a new intent for the main application, with the data that the contact picker returned.and in my Home class, in
onCreate
I callgetIntent()
and inspect the data in the intent that launched the main activity.