Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
If-Else for getIntent - Android

I have 2 activies. In first code, you see 2 rows and their click listeners. When first row clicked, I want to send "0" index to 2nd activity. As same, when I clicked second row, I want to send "1". So like that. How can I do that?

Sender Side:

TableRow tricepsRow1;
    tricepsRow1=(TableRow) findViewById(R.id.arm_exercise_1);
    tricepsRow1.setClickable(true);
    tricepsRow1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
             indexValueStandart=0;
            Intent tricepsRowIntent = new Intent(getApplicationContext(),exercise_arm_triceps.class);
            tricepsRowIntent.putExtra("extra_arm_triceps",indexValueStandart);
            startActivity(tricepsRowIntent);
        }
    });

    TableRow tricepsRow2;
    tricepsRow2=(TableRow) findViewById(R.id.arm_exercise_2);
    tricepsRow2.setClickable(true);
    tricepsRow2.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
             indexValueStandart=1;
            Intent tricepsRowIntent = new Intent(getApplicationContext(),exercise_arm_triceps.class);
            tricepsRowIntent.putExtra("extra_arm_triceps2",indexValueStandart);
            startActivity(tricepsRowIntent);
        }
    });

Receiver Side:

int getVIndexValue= getIntent().getIntExtra("extra_arm_triceps",0);
deneme.setText(String.valueOf(getVIndexValue));
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

try this:

int value = getIntent().getExtras().getInt("extra_arm_triceps");
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!