Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

android notification addaction example

public class ActionReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {

    //Toast.makeText(context,"recieved",Toast.LENGTH_SHORT).show();

    String action=intent.getStringExtra("action");
    if(action.equals("action1")){
        performAction1();
    }
    else if(action.equals("action2")){
        performAction2();

    }
    //This is used to close the notification tray
    Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
    context.sendBroadcast(it);
}

public void performAction1(){

}

public void performAction2(){

}
}
Comment

PREVIOUS NEXT
Code Example
Java :: android studio viewpager 
Java :: java jbutton hover 
Java :: opencv copy image java 
Java :: how to read space separated characters in java 
Java :: Java Another form of assertion statement 
Java :: Java Default Access Modifier creates error in package two by importing package one 
Java :: how to find root viewGroop 
Java :: int to byte calculator 
Java :: dividing numbers using method 
Java :: The Unit Circle Codehs 
Java :: retrofit gradle 
Java :: java find view by id 
Java :: franchiseRulesTemp 
Java :: Java Stack class push() method 
Java :: system.out.println int in java concatenate 
Java :: void add method using collections 
Java :: Jax-RS POST annotation 
Java :: camera for barcode android studio 
Java :: 3x+1 in java 
Java :: java check if a line is enclosed in quotation marks 
Java :: show all debug points intellij 
Java :: how to get listview data, TextView 
Java :: throws multiple exception 
Java :: ring check if the operating system is Android or not 
Java :: adding entity to calenderfx 
Java :: Java Access Members of a Class 
Java :: leerzeichen ersetzen java 
Java :: how to make jframe full screen 
Java :: java get first node in a list 
Java :: paysimple 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =