Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

146
Visualizações
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 Respostas
Responde à pergunta

0

try this:

int value = getIntent().getExtras().getInt("extra_arm_triceps");
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda