Q3
Question 3
Create an application with first activity with an editText and send button. On click of send button, make use of explicit intent to send text to second activity and display there in text view.

Code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linearlayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/editText"
android:layout_width="150dp"
android:layout_height="100dp"
android:layout_weight="10"
android:ems="10"
android:inputType="textPersonName"
android:paddingLeft="50dp"
android:paddingTop="50dp"
android:text="Enter any String" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="sendtext"
android:text="send"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintEnd_toStartOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</LinearLayout>
Download Q3_Explicit_Intent.apk to Run and Test Locally
Output






Last updated