Hello,
I have an application that uses an extended BroadcastReceiver class inside
the Activity. I have the extended BroadcastReceiver class as a member
variable of the Activity class. But it looks like the receiver references
keep changing between its construction and 'onReceive' method call. I would
like to understand this better. Here are some details.
public class MyEventReceiver extends BroadcastReceiver {
public MyEventReceiver(BNDialogInterface dlg) {
System.out.println("Receiver Object in constructor: "+this);
}
public void onReceive(Context context, Intent intent) {
System.out.println("Receiver Object in onReceive: "+this);
}
}
My Activity class:
public class Notepadv2 extends Activity {
private MyEventReceiver receiver;
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
receiver = new MyEventReceiver(this);
Intent myIntent = new Intent("Test");
sendBroadcast(myIntent);
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.demo.notepad2">
<application android:icon="@drawable/icon">
<receiver android:name=".MyEventReceiver" android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="Test" />
</intent-filter>
</receiver>
<activity android:name=".Notepadv2"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".NoteEdit"></activity>
</application>
</manifest>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---