Add run() to change tv_path.Text

This commit is contained in:
2018-12-13 10:15:14 +08:00
parent 3dbfba2344
commit de0f7e4494
3 changed files with 20 additions and 0 deletions

View File

@ -17,6 +17,16 @@ public class MainActivity extends AppCompatActivity {
tvPath = findViewById(R.id.tv_path1); tvPath = findViewById(R.id.tv_path1);
} }
private void run(Intent intent) {
tvPath.setText(intent.getCharSequenceExtra("path"));
if (tvPath.getText().equals("")) {
tvPath.setText("1");
}
else {
tvPath.setText(tvPath.getText() + " -> 1");
}
}
public void goBack (View v) { public void goBack (View v) {
finish(); finish();
} }

View File

@ -17,6 +17,11 @@ public class SecondActivity extends AppCompatActivity {
tvPath = findViewById(R.id.tv_path2); tvPath = findViewById(R.id.tv_path2);
} }
private void run(Intent intent) {
tvPath.setText(intent.getCharSequenceExtra("path"));
tvPath.setText(tvPath.getText() + " -> 2");
}
public void goBack (View v) { public void goBack (View v) {
finish(); finish();
} }

View File

@ -17,6 +17,11 @@ public class ThirdActivity extends AppCompatActivity {
tvPath = findViewById(R.id.tv_path3); tvPath = findViewById(R.id.tv_path3);
} }
private void run(Intent intent) {
tvPath.setText(intent.getCharSequenceExtra("path"));
tvPath.setText(tvPath.getText() + " -> 3");
}
public void goBack (View v) { public void goBack (View v) {
finish(); finish();
} }