diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index bb5485d..7cba004 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,6 +9,13 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> + + + + diff --git a/app/src/main/java/com/example/zabezpieczonynotatnik/DisplayMessageActivity.java b/app/src/main/java/com/example/zabezpieczonynotatnik/DisplayMessageActivity.java new file mode 100644 index 0000000..7a4841d --- /dev/null +++ b/app/src/main/java/com/example/zabezpieczonynotatnik/DisplayMessageActivity.java @@ -0,0 +1,23 @@ +package com.example.zabezpieczonynotatnik; + +import androidx.appcompat.app.AppCompatActivity; +import android.content.Intent; +import android.os.Bundle; +import android.widget.TextView; + +public class DisplayMessageActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_display_message); + + // Get the Intent that started this activity and extract the string + Intent intent = getIntent(); + String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); + + // Capture the layout's TextView and set the string as its text + TextView textView = findViewById(R.id.textView); + textView.setText(message); + } +} diff --git a/app/src/main/java/com/example/zabezpieczonynotatnik/MainActivity.java b/app/src/main/java/com/example/zabezpieczonynotatnik/MainActivity.java index bdd03f6..cc25144 100644 --- a/app/src/main/java/com/example/zabezpieczonynotatnik/MainActivity.java +++ b/app/src/main/java/com/example/zabezpieczonynotatnik/MainActivity.java @@ -1,12 +1,13 @@ package com.example.zabezpieczonynotatnik; import androidx.appcompat.app.AppCompatActivity; - +import android.content.Intent; import android.os.Bundle; import android.view.View; +import android.widget.EditText; public class MainActivity extends AppCompatActivity { - + public static final String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -15,6 +16,10 @@ public class MainActivity extends AppCompatActivity { /** Called when the user taps the Send button */ public void sendMessage(View view) { - // Do something in response to button + Intent intent = new Intent(this, DisplayMessageActivity.class); + EditText editText = (EditText) findViewById(R.id.editText); + String message = editText.getText().toString(); + intent.putExtra(EXTRA_MESSAGE, message); + startActivity(intent); } } diff --git a/app/src/main/res/layout/activity_display_message.xml b/app/src/main/res/layout/activity_display_message.xml new file mode 100644 index 0000000..7c3ea2b --- /dev/null +++ b/app/src/main/res/layout/activity_display_message.xml @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file