I want to call this activity from a class extending BroadcastReceiver but its not working
Intent i = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD);
co
Add the FLAG_ACTIVITY_NEW_TASK flag to your intent, eg:
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Try this
@Override
public void onReceive(Context context, Intent arg1) {
Intent intent = new Intent(context, yourclass.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
yourclass.class is your activity class that you want to start. Also, do not forget to add flags as new task.