I am a beginner, I am a few days with this problem
I didn't find a solution. I have a menu that appears in an activity and when I click, I want it to open a new activity.
My question is, what to put in the activity with menu, and what to put in the new activity?
This is my code
Menu_chat.xml (my menu)
android:id="@+id/salva_vida"
android:icon="@drawable/salva_vida"
android:title="@string/save_life"
app:showAsAction="always" />
ChatActivity.java (this is the activity with menu)
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id) {
case android.R.id.home:
onBackPressed();
return true;
case R.id.salva_vida:
??????? (What put here?)------------------
break;
tab2.java (this is the new activity- I want to open this)
public class tab2 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tab2);
}
}