How to start an Intent if context is not Activity Context but Application Context

Here is sample code how to call another activity using context,
set flag as per your requirement:

public void onReceive(Context context, Intent intent) { 
    
    Intent intent = new Intent();   
    intent.setClass(context, xxx.class); 
    intent.setAction(xxx.class.getName()); 
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); 
    context.startActivity(intent);  
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)