java - Intent betwen 2 applications -


i ask if can pass other application data using intent. if it's possible, how can clicking button , passing other application?

b1.setonclicklistener(new view.onclicklistener() {      @override     public void onclick(view arg0) {         intent intention = new intent(?????);          startactivity(intention);         } }); 

to pass data 1 activity need add intent. e.g,

intent intention = new intent(this, destclass.class); int value = 10; intention.putextra("key", value); startactivity(intention); 

and in destclass's oncreate(), intent with,

bundle extras = getintent().getextras(); if (extras!= null) {    extras.getint("key"); } 

to send application. create intent shown in android docs.

intent sendintent = new intent(); sendintent.setaction(intent.action_send); sendintent.putextra(intent.extra_text, "this text send."); sendintent.settype("text/plain"); startactivity(sendintent); 

note in case android system allows apps register receive intents , if there multiple apps have registered these intents system lets user choose app handle intent.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -