Android Pass Parameter to Activity

sapan
Passing parameter to Activity is fairly simple.

Code for the Activity which is calling


//from the calling activity
//use bundle to send the data
 Bundle b1 = new Bundle();
                b1.putString("url","http://www.androidlearner.com");
                intent = new Intent(activity, WebActivity.class);
                intent.putExtras(b1);




Code for the receiving activiy


//some default value
String url = "http://www.androidlearner.com";
//get the bundle
        Bundle b = getIntent().getExtras();
//check if null or not
        if(b!=null)
        {
//if not null get the value
            url=b.getString("url");
        }







Post a Comment

1Comments
  1. Initially, slots were regarded with contempt by desk game gamers since you can wager less money. While the elites enjoyed complimentary drinks and meals on the tables, slot lovers had nothing extra to relish. Currently, amongst all on-line casino games and platforms, the adoration and universality 카지노 사이트 of slots are unparalleled. For instance, the bonus could take the type of free spins, pick-a-prize interactions, or thriller bonuses.

    ReplyDelete
Post a Comment

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !