Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

android activity set action bar options

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main_menu, menu);
    return super.onCreateOptionsMenu(menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()){
        case R.id.menu1:
            Toast.makeText(this, "Clicked Menu 1", Toast.LENGTH_SHORT).show();
            break;
        case R.id.menu2:
            Toast.makeText(this, "Clicked Menu 2", Toast.LENGTH_SHORT).show();
            break;
        default:
            break;
    }
    return super.onOptionsItemSelected(item);
}
Comment

PREVIOUS NEXT
Code Example
Java :: Method Overloading by changing the data type of parameters Java 
Java :: log.d() andriod 
Java :: how todo a timeout test java 
Java :: Main method not found in class Ponga, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application 
Java :: https://graph.instagram.com/14.0/10218560180051171 
Java :: start hadoop and yarn with java 
Java :: execute a multi line shell comand in java 
Java :: set java time complexity 
Java :: session management in java spring boot for login logut 
Java :: print all prime no java 
Java :: Android Studio First time run check 
Java :: java default access modifier 
Java :: java.lang.NullPointerException: Cannot store to double array because is null 
Java :: Java @AnnotationName() 
Java :: thread dump 
Java :: for loop optimized java 
Java :: Java TestNG Data Provider 
Java :: blast multiple protein files 
Java :: using addition to multiply in java 
Java :: java statements 
Java :: find maximum number of rides in amusement park python 
Java :: ternario java 
Java :: how to stop scanner object skipping 
Java :: Create four (4) Java classes named Color, Model, Car, and CarDemo. 
Java :: java join if string is empty delimiter not used 
Java :: Changing or Replacing Elements in java map 
Java :: Java Stack class search() method 
Java :: Path to home directory java 
Java :: geometric primitive 
Java :: multi threading callable 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =