natehoch96
natehoch96

Reputation: 69

Launching the Settings/Market from a widget

How would I go about launching the Settings menu/the Market from a widget. Ive tried using a code and using the Settings/Market package name, but neither of them will open. Heres the code I'm using:

String packageName = "com.package";
String className = "com.package.MainActivity";
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName(packageName, className));
startActivity(intent);

Also, the phone I'm testing on runs HTC Sense, if that matters.

Upvotes: 1

Views: 241

Answers (1)

Squonk
Squonk

Reputation: 48871

I have no idea how to start the Market app (I'm not even sure if it's possible) but to launch the Settings Activity, try...

Intent i = new Intent(Settings.ACTION_SETTINGS);
startActivity(i);

You'll need the following import...

import android.provider.Settings;

Upvotes: 1

Related Questions