Q4

Question 4

Create an application with first activity with an editText and send button. On click of send button, make use of implicit intent that uses a SEND ACTION and let user select app chooser and navigate to that application.

App Insights:

Made layout for default main activity and added onCreate method, used EditText field and TextView to display the result using Implicit Intent for Share

Browse Source Code

Code

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
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:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <Button
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/editText"
        android:layout_marginTop="40dp"
        android:onClick="share"
        android:text="Send"
        android:textColorHighlight="@color/black"/>

    <EditText
        android:id="@+id/editText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:layout_marginTop="250dp"
        android:inputType="textPersonName"
        android:text="Some Text to send"
        android:textAlignment="center"/>
</RelativeLayout>

Output

Studio Screenshot (Main Activity) (1/6)
App Screenshot (Main Activity) (2/6)
Studio Screenshot Entering String Input (3/6)
App Screenshot Entering String Input (4/6)
Studio Screenshot on Tapping Send Button (5/6)
App Screenshot on Tapping Send Button (6/6)

Last updated