Alper Göktepe
Alper Göktepe

Reputation: 45

Sending multiple integers with intent

i am trying to send two values to another page, but everytime only one of them is working.Here is my code: Sending:

Intent i = new Intent(getApplicationContext(),fight_1.class);
        i.putExtra("deger2",ana_ekran_arti1_int);
        startActivity(i);

 Intent i = new Intent(getApplicationContext(),fight_1.class);
    i.putExtra("deger",  ana_ekran_can_int);
    startActivity(i);

Taking:

int i = getIntent().getIntExtra("deger",-1);
        int ii = getIntent().getIntExtra("deger2",-1);
        arti1= ii;
        fight_1_arti1.setText(arti1+"");
        fight_1_can_int=i;
        fight_1_can.setText(fight_1_can_int+"");

Upvotes: 0

Views: 41

Answers (1)

Mohamed El-shiekh
Mohamed El-shiekh

Reputation: 72

You are only sending one value you have to use the same intent without creating a new object.

I hope this helps

Intent i = new Intent(getApplicationContext(),fight_1.class);
i.putExtra("deger2", ana_ekran_arti1_int);
i.putExtra("deger",  ana_ekran_can_int);
startActivity(i);

Upvotes: 3

Related Questions