File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes Launching an Activity from Preferences. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Launching an Activity from Preferences." Watch "Launching an Activity from Preferences." New topic
Author

Launching an Activity from Preferences.

Rakesh Jhamb
Ranch Hand

Joined: Jun 18, 2003
Posts: 154
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.


SCJP2, SCWCD
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41182
    
  45
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.


Ping & DNS - my free Android networking tools app
Rakesh Jhamb
Ranch Hand

Joined: Jun 18, 2003
Posts: 154
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

Joined: Jul 01, 2011
Posts: 4



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
 
wood burning stoves
 
subject: Launching an Activity from Preferences.
 
Similar Threads
Availability of Intent
Exiting from application
How to pic and cancel the in call programmetically on Android Version 5 (2.2) os .. replacement of-
how to make calls from SIP server?
making calculater