Frage

ist es eine Möglichkeit, um den Benutzer zu reprompt eine Standard-Aktivität für eine Absicht zu wählen? Zum Beispiel wählt Benutzer seine Heimat apk Ausfall- und ich will, dass er seine Wahl zu überdenken noch einmal.

Ich weiß, wie das zu tun, auf 2.1 und früher, aber ist es eine Möglichkeit, dass auf 2.2 jetzt zu tun?

Berühmter Startseite Switcher, die ähnliche Sache getan hat, funktioniert nicht auf 2.2 mehr dank Team Google

War es hilfreich?

Lösung

For example, user selects his default home apk and I want him to reconsider his choice once again.

That is no longer possible, unless your app is the preferred one. Then, I think you can use clearPackagePreferredActivities() to remove yourself as the preferred choice.

In other words, you are welcome to affect your own app, but you are not welcome to affect other apps.

Andere Tipps

This is how I represent the Activity selection dialog: It start the android default ResolverActivity for "HOME" Applications.

Intent selector = new Intent("android.intent.action.MAIN");
selector.addCategory("android.intent.category.HOME");
selector.setComponent(new ComponentName("android", "com.android.internal.app.ResolverActivity"));

startActivity(selector);

The above code is working for my 2.2 enabled tablets. When executed, it displays the "Complete Actions with:" dialog with all possible Home applications in the list.


A way to detect which is currently set by default you could ask for all preferred activities. The lists "filters" and "comps" contain the data when calling .getPreferredActivities(...).

filters - contains the intent filter data, which you could query what type of data it is.

comps - contians the component which would be called if the intent filter matches

This way you could check if your application is the current "home" application set as preferred by the user.

List<IntentFilter> filters = new ArrayList<IntentFilter>();
List<ComponentName> comps= new ArrayList<ComponentName>();
getPackageManager().getPreferredActivities(filters, comps, null);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top