Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.activslogs;
- import androidx.appcompat.app.AppCompatActivity;
- import android.content.Intent;
- import android.os.Bundle;
- import android.widget.Button;
- import android.widget.EditText;
- public class ThirdActivity extends AppCompatActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_third);
- Intent mIntent = getIntent();
- setTitle(mIntent.getStringExtra("in_param")); //если не получится, то вернет null
- ((Button) findViewById(R.id.button10)).setOnClickListener(v->{
- Intent intent = new Intent();
- intent.putExtra("param",
- ((EditText)findViewById(R.id.edInput)).getText().toString());
- setResult(RESULT_OK, intent);
- finish(); //закрывает активность
- });
- }
- @Override
- public void onBackPressed() {
- Intent intent = new Intent();
- intent.putExtra("param",
- ((EditText)findViewById(R.id.edInput)).getText().toString());
- setResult(RESULT_OK, intent);
- super.onBackPressed();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement