Here is one simple way:

// Library:

package FooBar;

class WidgetCommon extends AppWidgetProvider {
.....
All functionality is implemented here
....
    protected void enableFullAppMode(boolean enable) {
// if necessary - enable full (unlocked) features
    }
}

// Application A

package AppA;

class WidgetA extends WidgetCommon {
}

// Application B

package AppB;

class WidgetB extends WidgetCommon {
}

The manifests for App A and App B would then declare package name as usual,
as "AppA" and "AppB" and reference their respective widgets as ".WidgetA"
and ".WidgetB"

-- K

2012/6/14 Bryan <[email protected]>

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

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