<?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">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</[Link]>
package [Link].menu_app;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
getMenuInflater().inflate([Link].menu_example,menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item){
switch ([Link]())
{
case [Link].new_group:
[Link](getApplicationContext(),"item1 Selected",
Toast.LENGTH_LONG).show();
return true;
case [Link]:
[Link](getApplicationContext(),"item2 Selected",
Toast.LENGTH_LONG).show();
return true;
case [Link]:
[Link](getApplicationContext(),"item3 Selected",
Toast.LENGTH_LONG).show();
return true;
default:
return [Link](item);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="[Link]
<item android:id="@+id/new_group"
android:title="New_Group"/>
<item android:id="@+id/setting"
android:title="Setting"/>
<item android:id="@+id/Search"
android:title="Search"/>
</menu>