Aufgabe 7 finished
This commit is contained in:
parent
cc555ced7f
commit
cc6a2ddb46
@ -18,30 +18,30 @@ public class MainActivity2 extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main2);
|
||||
|
||||
Bundle extras= getIntent().getExtras();
|
||||
if(extras!= null) {
|
||||
Bundle extras = getIntent().getExtras();
|
||||
if (extras != null) {
|
||||
String text = extras.getString("text");
|
||||
TextView textView = (TextView) findViewById(R.id.tv_textView);
|
||||
textView.setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
public void makeToast(View view){
|
||||
public void makeToast(View view) {
|
||||
Toast.makeText(this, "Toast 2", Toast.LENGTH_SHORT).show();
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish(){
|
||||
public void finish() {
|
||||
Intent dataIntent = new Intent();
|
||||
EditText editText = (EditText) findViewById(R.id.text_editText);
|
||||
dataIntent.putExtra("text",editText.getText().toString());
|
||||
setResult(RESULT_OK,dataIntent);
|
||||
dataIntent.putExtra("text", editText.getText().toString());
|
||||
setResult(RESULT_OK, dataIntent);
|
||||
super.finish();
|
||||
}
|
||||
|
||||
public void sendResult(View view){
|
||||
public void sendResult(View view) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user