How to download activity from BroadcastReceiver onReceive

I want to load activity from the BroadcastReceiver onReceive method. I have 2 types of activity, one of them is the main one and the second one I created. I want to load the second action from onReceive , but it loads the main action, and I don't know why ..

This is the onReceive() intent:

 Intent i = new Intent(context, BTNotifierWarning.class); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); 

this is the BTNotifierWarning class:

 package com.btnotifier; import android.app.Activity; import android.os.Bundle; public class BTNotifierWarning extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.warning); // TODO Auto-generated method stub } } 

and this is the xml warning layout:

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" tools:context=".BTNotifierWarning" > 

Why is this happening?

Thanks!

0
source share

Source: https://habr.com/ru/post/1493894/


All Articles