Could I please get some further confirmation on how to handle intents with 
using this library and subclassing everything in the manifest?

The classes in the library create intents, just as...

new Intent(this, MyActivity.class)

...however, that won't resolve as the manifest defines the activity as 
my.package.MyActivity, but the intent created would be 
my.package.library.MyActivity.

Instead, I've replace every instance of...

Intent i = new Intent(this, MyActivity.class)

...with...

Intent i = null;
try {
i = new Intent(context, Class.forName(this.getPackageName() + "." + 
MyActivity.class.getSimpleName());
} catch (ClassNotFoundException e) {
Log.e(TAG, e.getMessage());
}

This is required to make sure that the Intents match the full class path 
declared in the manifest, rather than the class path of the library. In 
testing, this appears to be true, but I wanted to check with those who 
know! :)

Thank you very much!

Bryan



On Thursday, June 14, 2012 12:55:14 PM UTC-4, Mark Murphy (a Commons Guy) 
wrote:
>
> On Thu, Jun 14, 2012 at 12:49 PM, Dianne Hackborn <> wrote: 
> > On Thu, Jun 14, 2012 at 6:06 AM, Mark Murphy <> 
> > wrote: 
> >> 
> >> It'd be nice if there were a way for app widgets to be identified by a 
> >> custom action string in an <intent-filter>, so refactoring could be 
> >> easier and less risky, but that's not an available option AFAIK. 
> > 
> > Then you have lots of potential problems with people spoofing widgets 
> and 
> > such. 
>
> Ah, yeah, hadn't thought of that. Thanks! 
>
> -- 
> Mark Murphy (a Commons Guy) 
> http://commonsware.com | http://github.com/commonsguy 
> http://commonsware.com/blog | http://twitter.com/commonsguy 
>
> Android Training in DC: http://marakana.com/training/android/ 
>

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

Reply via email to