Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to send extra Data and have it one after another by clicking a button
    primarykey
    data
    text
    <p>for example when I click <code>but1</code> the <code>textview1</code> on the other activity must change,when I click <code>but2</code> the <code>textview2</code> must change etc.In my code when I click 3 buttons(one after another) after clicking the first one all three <code>textviews</code> are being filled with the information that should be in first <code>textview.</code> this is my first Activity:</p> <pre><code> buttonvis1 = (Button) findViewById(R.id.button1); buttonvis2 = (Button) findViewById(R.id.button2); buttonvis2.setVisibility(Button.GONE); buttonvis1.setOnClickListener(new OnClickListener(){ public void onClick(View v){ Intent intent = new Intent(MainActivity.this,Ostanovki.class); intent.putExtra("in1",input_in.getText().toString()); intent.putExtra("out1", input_out.getText().toString()); buttonvis2.setVisibility(Button.VISIBLE); //startActivity(intent); } }); buttonvis3 = (Button) findViewById(R.id.button3); buttonvis3.setVisibility(Button.GONE); buttonvis2.setOnClickListener(new OnClickListener(){ public void onClick(View v){ Intent intent = new Intent(MainActivity.this,Ostanovki.class); intent.putExtra("in2",input_in.getText().toString()); intent.putExtra("out2", input_out.getText().toString()); buttonvis3.setVisibility(Button.VISIBLE); startActivity(intent); } }); buttonvis3.setOnClickListener(new OnClickListener(){ public void onClick(View v){ Intent intent = new Intent(MainActivity.this,Ostanovki.class); intent.putExtra("in3",input_in.getText().toString()); intent.putExtra("out3", input_out.getText().toString()); //startActivity(intent); } }); </code></pre> <p>and this is the second:</p> <pre><code> protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ostanovki); txtOst1 = (TextView) findViewById(R.id.txtost1); txtOst2 = (TextView) findViewById(R.id.txtost2); txtOst3 = (TextView) findViewById(R.id.txtost3); input1 = getIntent().getExtras().getString("in1"); output1 = getIntent().getExtras().getString("out1"); txtOst1.setText("В маршрутку зашло " +input1 +"а вышло " +output1); input2 = getIntent().getExtras().getString("in2"); output2 = getIntent().getExtras().getString("out2"); txtOst2.setText("В маршрутку зашло " +input2 +"а вышло " +output2); input3 = getIntent().getExtras().getString("in3"); output3 = getIntent().getExtras().getString("out3"); txtOst3.setText("В маршрутку зашло " +input3 +"а вышло " +output3); </code></pre> <p>I am a beginer,so don't be angry if I've written fool things.Thanks;)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload