android - ADT: Avoid duplicating code in package with dependency on another deployed package? -
when have e.g. custom service , custom activity in same adt project, can use in service, start activity:
intent = new intent(context, mycustomactivity.class); startactivity(i); however when have service , activity in separate projects, cannot since not have direct reference mycustomactivity.class. problematic: not wish include jar able fix broken reference, since assume increase package size , create redundant data on device (i.e. activity code duplicated between service , activity packages). instead, use (perhaps there other options?):
intent = new intent("com.mypackage.mystringactionname"); startactivity(i); //is broadcast? or
intent = new intent("com.mypackage.mystringactionname"); sendbroadcast(i); ...but don't sending broadcasts when want direct intent single activity tell start.
so, other ways there go avoiding duplication (in adt)? or else better way send direct intents?
you can try this:
intent = new intent(); i.setcomponent(new componentname(packagename, classname)); startactivity(i); the classname must contains packagename , main activity name
Comments
Post a Comment