Try setComponent() instead of setPackage().

On Sat, Jul 10, 2010 at 6:28 PM, CMWiii <[email protected]> wrote:
>
> In a test app I pass an intent to resolveActivity to find out what is
> the
> best fit for the intent.
>
> For example:
>
>   Intent myIntent = new Intent();
>
>   myIntent.setPackage(PackageName);
>   myIntent.addCategory(Intent.CATEGORY_LAUNCHER);
>   myIntent.setAction(Intent.ACTION_MAIN);
>
>   PackageManager manager = getPackageManager();
>
>   ResolveInfo ri = manager.resolveActivity(exceptionIntent,0);
>
>   if (ri != null) {
>         Intent newIntent = new Intent();
>
>         newIntent.setClassName(PackageName,
> ri.activityInfo.applicationInfo.className);
>         newIntent.setFlags(ri.activityInfo.flags);
>
>         startActivity(newIntent);
>      }
>
> The result of all this is an error:
> "android.content.ActivityNotFoundException: Unable to find explicit
> activity
>                                               class ......."
>
> Any suggestions or thoughts on why I am getting back an activity that
> then can't be
> found by startActivity?
>
> --
> 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
>



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.6
Available!

-- 
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