Electronhub.com - searching electronic component made easy

Android Pass Parameter to Activity

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");
        }







Comments

  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