Android UI Components: AutoComplete & Toggle
Android UI Components: AutoComplete & Toggle
<TextView
android:id="@+id/textView2"
android:layout_width="292dp"
android:layout_height="29dp"
android:layout_alignParentTop="true"
android:layout_marginTop="124dp"
android:text="example_autocompletetextview"
tools:layout_editor_absoluteX="7dp"
tools:layout_editor_absoluteY="73dp" />
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView2"
android:layout_alignLeft="@+id/textView2"
android:layout_marginLeft="107dp"
android:layout_marginTop="32dp"
android:ems="10"
tools:layout_editor_absoluteX="82dp"
tools:layout_editor_absoluteY="126dp" />
</RelativeLayout>
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
autocomplete = (AutoCompleteTextView)
findViewById([Link].autoCompleteTextView1);
[Link](2);
[Link](adapter);
}
}
2. Write a program to create a toggle button to display ON/OFF Bluetooth on
the display screen.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
android:background="@color/white"
tools:context=".MainActivity">
<ToggleButton
android:id="@+id/toggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:onClick="onToggleClick"
/>
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="100dp"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_above="@+id/toggleButton"
android:textStyle="bold"
android:textColor="@color/black"/>
</RelativeLayout>
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
ToggleButton togglebutton;
TextView textview;
@Override
protected void onCreate(
Bundle savedInstanceState)
{
[Link](savedInstanceState);
setContentView([Link].activity_main);
togglebutton
= (ToggleButton)findViewById(
[Link]);
textview
= (TextView)findViewById(
[Link]);
}
}
});
}
}
4. Write a program to show five checkboxes and toast selected checkboxes
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/johnCena"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:checked="true"
android:text="Indian"
android:textColor="#154"
android:textSize="20sp"
android:textStyle="bold" />
<RadioButton
android:id="@+id/romanReigns"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:checked="false"
android:text="Chinese"
android:textColor="#154"
android:textSize="20sp"
android:textStyle="bold" />
<RadioButton
android:id="@+id/goldBerg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:checked="false"
android:text="Continental"
android:textColor="#154"
android:textSize="20sp"
android:textStyle="bold" />
<RadioButton
android:id="@+id/sheamus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:checked="false"
android:text="Spanish"
android:textColor="#154"
android:textSize="20sp"
android:textStyle="bold" />
<RadioButton
android:id="@+id/randyOrton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:checked="false"
android:text="Italian"
android:textColor="#154"
android:textSize="20sp"
android:textStyle="bold" />
</RadioGroup>
<Button
android:id="@+id/submitButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="20dp"
android:background="#0f0"
android:padding="10dp"
android:text="Submit"
android:textColor="#fff"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
johnCena = (RadioButton) findViewById([Link]);
randyOrton = (RadioButton) findViewById([Link]);
goldBerg = (RadioButton) findViewById([Link]);
romanReigns = (RadioButton) findViewById([Link]);
sheamus = (RadioButton) findViewById([Link]);
submit = (Button) findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
if ([Link]()) {
selectedSuperStar = [Link]().toString();
} else if ([Link]()) {
selectedSuperStar = [Link]().toString();
} else if ([Link]()) {
selectedSuperStar = [Link]().toString();
} else if ([Link]()) {
selectedSuperStar = [Link]().toString();
} else if ([Link]()) {
selectedSuperStar = [Link]().toString();
}
[Link](getApplicationContext(),"You
selected"+selectedSuperStar, Toast.LENGTH_LONG).show(); // print the value of
selected super star
}
});
}
}
6. Develop a program to implement Progress Bar
</RelativeLayout>
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
showProgressBtn = findViewById([Link]);
loadingPB = findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
if (isProgressVisible) {
[Link]([Link]);
isProgressVisible = false;
} else {
isProgressVisible = true;
[Link]([Link]);
}
}
});
}
}
Develop a program to implement List View and Grid View.
List View:
8. Write a program to display an image using Image View and a button named
as “Change Image”. Once you click on button another image should get
displayed
<AbsoluteLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="91dp"
android:layout_height="108dp"
android:layout_x="154dp"
android:layout_y="249dp"
tools:srcCompat="@tools:sample/avatars" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="152dp"
android:layout_y="465dp"
android:text="Change" />
</AbsoluteLayout>
</[Link]>
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
<AbsoluteLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="144dp"
android:layout_marginTop="68dp"
android:layout_x="160dp"
android:layout_y="143dp"
android:text="Pizza"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="144dp"
android:layout_marginTop="28dp"
android:layout_x="160dp"
android:layout_y="230dp"
android:text="Coffee"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/checkBox" />
<CheckBox
android:id="@+id/checkBox3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="144dp"
android:layout_marginTop="28dp"
android:layout_x="160dp"
android:layout_y="312dp"
android:text="Burger"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/checkBox2" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="144dp"
android:layout_marginTop="184dp"
android:layout_x="158dp"
android:layout_y="419dp"
android:text="Order"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/checkBox3" />
</AbsoluteLayout>
</[Link]>
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class MainActivity extends AppCompatActivity {
CheckBox pizza,coffe,burger;
Button buttonOrder;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
addListenerOnButtonClick();
}
public void addListenerOnButtonClick(){
//Getting instance of CheckBoxes and Button from the activty_main.xml
file
pizza=(CheckBox)findViewById([Link]);
coffe=(CheckBox)findViewById([Link].checkBox2);
burger=(CheckBox)findViewById([Link].checkBox3);
buttonOrder=(Button)findViewById([Link]);
});
} }
[Link] a program to implement date and Time Picker
<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<AbsoluteLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<DatePicker
android:id="@+id/simpleDatePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#150"
android:datePickerMode="spinner" />
<Button
android:id="@+id/submitButton"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_below="@+id/simpleDatePicker"
android:layout_x="116dp"
android:layout_y="311dp"
android:text="submit"/>
<TimePicker
android:id="@+id/timePicker"
android:layout_width="316dp"
android:layout_height="305dp"
android:layout_marginTop="360dp"
android:layout_x="38dp"
android:layout_y="396dp" />
</AbsoluteLayout>
</[Link]>
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
DatePicker simpleDatePicker;
Button submit;
TimePicker t1;
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
// initiate the date picker and a button
simpleDatePicker = (DatePicker) findViewById([Link]);
submit = (Button) findViewById([Link]);
// perform click event on submit button
t1=(TimePicker)findViewById([Link]);
t1.setIs24HourView(true);
[Link](new [Link]() {
@Override
public void onClick(View v) {
String day = "Day = " + [Link]();
String month = "Month = " + ([Link]() +
1);
String year = "Year = " + [Link]();
[Link](getApplicationContext(), day + "\n" + month +
"\n" + year, Toast.LENGTH_LONG).show();
}
});
}
[Link] a program to create a Hello World Activity using all lifecycles method
to display messages using log.d.
Now press the back button on the Emulator and exit the App:
Go to Logcat again and scroll down to bottom. You will see 3 more methods were called:
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class MainActivity extends AppCompatActivity {
public String tag="application is:";
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
[Link](this,"on create",Toast.LENGTH_SHORT).show();
Log.d(tag,"Activity is created");
}
@Override
protected void onStart() {
[Link]();
[Link](this,"on start",Toast.LENGTH_SHORT).show();
Log.d(tag,"Started");
}
@Override
protected void onResume() {
[Link]();
Log.d(tag,"Resumed");
}
@Override
protected void onPause() {
[Link]();
Log.d(tag,"Paused");
}
@Override
protected void onStop() {
[Link]();
Log.d(tag,"Stoped");
}
@Override
protected void onDestroy() {
[Link]();
Log.d(tag,"Destroyed");
}
@Override
protected void onRestart() {
[Link]();
Log.d(tag,"Restarted");
}
}
13. Write a program to create a text field and a button ‘Navigate’. When you enter
[Link] and press navigate button it should open google home page.
Xml:
<?xml version="1.0" encoding="utf-8"?>
<[Link]
xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<AbsoluteLayout
android:layout_width="409dp"
android:layout_height="729dp"
android:orientation="horizontal"
tools:layout_editor_absoluteX="1dp"
tools:layout_editor_absoluteY="1dp">
<EditText
android:id="@+id/editTextText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="91dp"
android:layout_y="110dp"
android:ems="10"
android:inputType="text"
android:hint="Enter url" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="152dp"
android:layout_y="201dp"
android:text="Navigate" />
</AbsoluteLayout>
</[Link]>
Java
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
b1 = findViewById([Link]);
e1 = findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
String url = [Link]().toString();
if (![Link]()) {
// Check if the URL is not empty
if ();
startActivity(implicitIntent);
}
}
});
}
}
12. Develop a program to implement new activity using explicit intent and implicit
intent.
Activity_main.Xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/explicitButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Launch Second Activity (Explicit)" />
<Button
android:id="@+id/implicitButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/explicitButton"
android:layout_marginTop="16dp"
android:text="Open URL (Implicit)" />
</RelativeLayout>
[Link]:
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
Manifest:
Add the below tag on the <Application> tag in the manifest file:
<activity android:name=".SecondActivity" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Second Activity"
android:textSize="24sp"
android:layout_centerInParent="true"/>
</RelativeLayout>
package [Link];
import [Link];
import [Link];
Activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="[Link]
xmlns:app="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/startDialerButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Start Dialer" />
</RelativeLayout>
[Link]
package [Link]
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
b1=findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_DIAL);
startActivity(intent);
}
});
}
}
15. Write a program to demonstrate any system broadcast message.
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
}
@Override
protected void onStart() {
[Link]();
IntentFilter filter = new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED);
registerReceiver(airplaneModeChangeReceiver, filter);
}
@Override
protected void onStop() {
[Link]();
unregisterReceiver(airplaneModeChangeReceiver);
}
}
@Override
public void onReceive(Context context, Intent intent) {
if (isAirplaneModeOn([Link]())) {
[Link](context, "AirPlane mode is on", Toast.LENGTH_SHORT).show();
} else {
[Link](context, "AirPlane mode is off", Toast.LENGTH_SHORT).show();
}
}
Activity_main.xml
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Take a Photo" >
</Button>
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/button1"
android:layout_alignParentTop="true"
android:src="@drawable/ic_launcher_background" />
</RelativeLayout>
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
[Link](savedInstanceState);
setContentView([Link].activity_main);
[Link](new [Link]() {
@Override
public void onClick(View v) {
Intent cameraIntent = new Intent([Link].ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
}
});
}
}
[Link] a sample application with login module (Check user name and password) on
successful login, Change Text view “Login Successful” and on fail, alert user using toast
“Login Fail”.
Activity_main.xml
<EditText
android:id="@+id/usernameEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="50dp"
android:layout_marginEnd="20dp"
android:hint="Username"
android:inputType="text" />
<EditText
android:id="@+id/passwordEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/usernameEditText"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
android:hint="Password"
android:inputType="textPassword" />
<Button
android:id="@+id/loginButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/passwordEditText"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
android:text="Login" />
<TextView
android:id="@+id/loginResultTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/loginButton"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text=""
android:textSize="18sp" />
</RelativeLayout>
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
usernameEditText = findViewById([Link]);
passwordEditText = findViewById([Link]);
loginButton = findViewById([Link]);
loginResultTextView = findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
login();
}
});
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="[Link]
xmlns:tools="[Link]
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<EditText
android:id="@+id/phoneNumberEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Phone Number"
android:inputType="phone" />
<EditText
android:id="@+id/messageEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/phoneNumberEditText"
android:hint="Message" />
<Button
android:id="@+id/sendButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/messageEditText"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:text="Send" />
</RelativeLayout>
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
phoneNumberEditText = findViewById([Link]);
messageEditText = findViewById([Link]);
sendButton = findViewById([Link]);
[Link](new [Link]() {
@Override
public void onClick(View v) {
sendSMS();
}
});
if ([Link]() || [Link]()) {
[Link](this, "Phone number and message cannot be empty", Toast.LENGTH_SHORT).show();
return;
}
try {
SmsManager smsManager = [Link]();
[Link](phoneNumber, null, message, null, null);
[Link](this, "SMS sent", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
[Link](this, "Failed to send SMS", Toast.LENGTH_SHORT).show();
[Link]();
}
}
}
[Link]
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="[Link]
xmlns:tools="[Link]
<uses-feature
android:name="[Link]"
android:required="false" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/[Link]"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="[Link]" />
<intent-filter>
<action android:name="[Link].SMS_RECEIVED" />
</intent-filter>
</receiver>
</application>
</manifest>
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = [Link]();
if (bundle != null) {
Object[] pdus = (Object[]) [Link]("pdus");
if (pdus != null) {
for (Object pdu : pdus) {
SmsMessage smsMessage = [Link]((byte[]) pdu);
String senderPhoneNumber = [Link]();
String messageBody = [Link]();
Activity_main.xml
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="22dp"
android:layout_marginTop="16dp"
android:ems="10" />
<EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/editText1"
android:layout_below="@+id/editText1"
android:layout_marginTop="18dp"
android:ems="10" >
<requestFocus />
</EditText>
<EditText
android:id="@+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/editText2"
android:layout_below="@+id/editText2"
android:layout_marginTop="28dp"
android:ems="10"
android:inputType="textMultiLine" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/editText1"
android:layout_alignBottom="@+id/editText1"
android:layout_alignParentLeft="true"
android:text="To:" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/editText2"
android:layout_alignBottom="@+id/editText2"
android:layout_alignParentLeft="true"
android:text="Subject:" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/editText3"
android:layout_alignBottom="@+id/editText3"
android:layout_alignParentLeft="true"
android:text="Message:" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/editText3"
android:layout_below="@+id/editText3"
android:layout_marginLeft="76dp"
android:layout_marginTop="20dp"
android:text="Send" />
</RelativeLayout>
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
editTextTo=(EditText)findViewById([Link].editText1);
editTextSubject=(EditText)findViewById([Link].editText2);
editTextMessage=(EditText)findViewById([Link].editText3);
send=(Button)findViewById([Link].button1);
[Link](new OnClickListener(){
@Override
public void onClick(View arg0) {
String to=[Link]().toString();
String subject=[Link]().toString();
String message=[Link]().toString();
});
}