How to start an Android Activity from an OSGI Bundle start method -


i trying display toast message in osgi bundle uses android api. toast needs application context thought of creating activity first inside bundle. here's activity class toast message:

public class mainactivity extends activity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);      toast.maketext(this.getapplicationcontext(), "this osgi bundle", toast.length_short).show();      }   } 

now start above activity start() method in bundle activator class. below class:

public class activator implements bundleactivator {      private static bundlecontext context;      static bundlecontext getcontext() {         return context;     }       public void start(bundlecontext bundlecontext) throws exception {         activator.context = bundlecontext;     //i start activity here display toast message        }       public void stop(bundlecontext bundlecontext) throws exception {         activator.context = null;        }  } 

how can achieve that? way aware of start activity when in activity here, not case. can help? thank you.

i think topic provide response you, if not perfect. may check felixdroid using different approach seen on other projects. however, long better solution. going see if can find or write contextwrapper fill bill.

full android support osgi bundles


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -