fabiobh
fabiobh

Reputation: 779

Find class to use with ComponentName class in Android

I have a single widget that call another application, here is the most important part of the code:

final Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
final ComponentName cn = new ComponentName("com.android.settings", 
"com.android.settings.wifi.WifiSettings");
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctxt.startActivity( intent);

The important part is

final ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.wifi.WifiSettings");

This call the wifi settings in android, but I found this code in a web site, I want to know how I can call the data roaming and other settings in the system, where I can see this?

Upvotes: 1

Views: 3205

Answers (1)

Mr_and_Mrs_D
Mr_and_Mrs_D

Reputation: 34026

com.android.settings is the name of the package. If you go here you can find all the settings available in this package. The roaming settings are in package com.android.phone - see here.

EDIT : it appears that using package names is not portable. Your best bet is to use :

startActivity(new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS));

The list of intents is in the Settings class

You may also need to add FLAG_ACTIVITY_NEW_TASK to your intent

Upvotes: 2

Related Questions