Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Launching an Activity from Preferences.

 
Rakesh Jhamb
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a PreferenceActivity Class that has the following code.


Using this code, I am able to start MyActivity.

I want to know how to do this declaratively from the XML file inside PreferenceScreen tag. How to do it without writing code, there must be some way.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to do it without writing code, there must be some way.

Why? The usual flow is to return to the previous activity after the preferences are done with. Starting some other activity is hardly a common use case.
 
Rakesh Jhamb
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, here is the use case.

I have a preferences screen that has an option, which I click will list all the contacts.So this has to be done in an Activity I guess.

Also, in Google API Demos, there is an example that starts an activity from Preferences and that also declaratively using XML. The problem is, it is starting a browser that opens up www.android.com.

I want a declarative example how to declare intent tag that will be able to launch a normal Activity class.

Waiting for your response.

Thanks
 
Tibi Giurgiu
Greenhorn
Posts: 4
Android Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


this is the example from that docs that you are referring to.


to start your activity you can do something like this


and you set an intent filter for that action
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic