lundi 25 mai 2015

how sent integer parameter in intent

i whant to send int parameter in intent like this

String textname = (String) dataItem.get("name");

        Intent m = new Intent(list.this,main.class);
        m.putExtra("name",textname);
        m.putExtra("page",1);

        startActivity(m);

and in main class i get that parameter

Intent intent = getIntent();
    name = intent.getStringExtra("name");
     page1 = Integer.parseInt(intent.getStringExtra("page"));

but when i run my cod it foce close!!!

Aucun commentaire:

Enregistrer un commentaire