Yes, launching an activity by Action string alone requires that its intent filter include default category.

10.02.2011 21:56, Dan пишет:
I added the Default Category to the intent and intent filter in the
manifest, it now "works" but the original issue is confusing to me.

On Feb 9, 2:44 pm, Dan<[email protected]>  wrote:
Hello,

I am unable to start an Activity. My goal is to specify my
application's packages so that Intent Resolution only occurs with my
Intents, then for the correct Intent to be resolved. However I am
getting unexpected results which seem to be contradictory.
PackageManager successfully queries the Activities and finds the one
correct activity but when startActivity is used
ActivityNotFoundException is thrown. Here is the code snippet:

Intent homeIntent = new Intent(HOME_ACTION);
homeIntent.setPackage(getPackageName()); // Set package to only search
within application.
List<ResolveInfo>  actList =
getPackageManager().queryIntentActivities(homeIntent, 0);
System.out.println(actList.size()); // reports 1, debugging the List
shows the correct activity was found
startActivity(homeIntent); // throws ActivityNotFoundException

Only HomeActivity has a filter set for HOME_ACTION and no other
parameters for the filter. If its important this code is being called
from an Android Library Project.

-Dan


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to