MainActivity.java
===================
package com.sam.web.share;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater menuInflater=getMenuInflater();
menuInflater.inflate(R.menu.menu_item,menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId()==R.id.shareId){
}
else if(item.getItemId()==R.id.feedbackId){
Intent intent=new Intent(getApplicationContext(),FeedbackActivity.class);
startActivity(intent);
}
return super.onOptionsItemSelected(item);
}
}
=======================================================================
activity_main.xml
================
<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.sam.web.share.MainActivity">
</LinearLayout>
======================================================
activity_feedback.xml
===================
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
android:background="#22ffff"
android:orientation="vertical"
android:weightSum="4"
tools:context="com.sam.web.share.FeedbackActivity">
<LinearLayout
android:layout_weight="0.5"
android:layout_width="match_parent"
android:layout_height="0dp">
<EditText
android:textStyle="bold"
android:textSize="17sp"
android:id="@+id/nameEditTextId"
android:layout_marginLeft="10dp"
android:layout_marginRight="20dp"
android:hint="Enter your name"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_weight="1.5"
android:layout_width="match_parent"
android:layout_height="0dp">
<EditText
android:textStyle="bold"
android:textSize="17sp"
android:id="@+id/messageEditTextId"
android:layout_marginLeft="10dp"
android:layout_marginRight="20dp"
android:hint="Enter your Feedback"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp">
<Button
style="@style/Base.TextAppearance.AppCompat.Widget.Button"
android:textSize="17sp"
android:textStyle="bold"
android:text="send"
android:id="@+id/sendButtonId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
style="@style/Base.TextAppearance.AppCompat.Widget.Button"
android:textSize="17sp"
android:textStyle="bold"
android:text="clear"
android:id="@+id/clearButtonId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
</LinearLayout>
=================================================================================
menu_item.xml
=================
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/feedbackId"
android:title="Feedback"
app:showAsAction="never" />
<item
android:id="@+id/shareId"
android:title="Share"
app:showAsAction="never" />
</menu>