Setting the theme / style when using the startActivity () function

Simple question:

I am using PICK_CONTACT in my Android 3.0 application. The problem is that the contact application has a light theme, while my application uses a dark one.

So the question is:

Is there a way to set a style / theme when using startActivity() ?

If I create my own library, and I want the user to be able to use style settings, will I need to get something in intent ? Is there a better way to solve this problem?

+7
source share
2 answers

Is there a way to set a style / theme when using the startActivity () function?

Not. You have no right to interact with the user interfaces of other applications, no more than having the right to mess with yours.

In the case of PICK_CONTACT , if you want to have READ_CONTACTS permission, there is nothing that will prevent you from writing your own work with a list of contacts, thematically, as you wish.

If I create my own library and I want the user to be able to use style settings, will I need to get something in intent?

Since the setStyle() method is missing, dynamically changing the style of the action seems difficult.

If your library will be sent as an Android library project, you can provide thematic resources and recommendations for developers who, when adding your actions to their manifest, can choose which theme to use during compilation.

+4
source

Not.

In general, there is no standard method for specifying the theme / style with which the activity should begin: your idea (something would interfere with the intention) would actually be a great way to do this, but once again it is not standard.

Wandering through the standard source of contact applications ( https://android.googlesource.com/platform/packages/apps/Contacts ) there is no way to specify a topic in any of the Activity classes that PICK_CONTACT called.

It would be best to create a custom Contact picker and use a content provider. You will need to request permissions and it will be a little dirtier, but this is the only way to get what you want.

+3
source

All Articles