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