Google Map retains the reference to the context of the enclosing activity?

by Katsiaryna » Fri, 22 Jan 2010 00:08:00 GMT


Sponsored Links
 Still no luck. Seems I should report it as a bug...



> Katsiaryna



Other Threads

1. AlarmManager and the PendingIntent that failed

In order to learn how to use the AlarmManager I created an activity
that consists of a single button. When the button is pressed the
activity creates an Intent of itself and loads it into the
AlarmManager 3 seconds in the future before finishing.

So activity opens, user pushes button, activity closes, 3 seconds
later activity opens, repeat.

Problem is instead of opening the activity 3 seconds later I get an
error: "The application [myappname] has stopped unexpectedly. Please
try
again." however I was able to open a Toast from the Receiver just
fine.


Here's the code for the button:
thanksButton.setOnClickListener(new View.OnClickListener() {
               public void onClick(View view) {
               setResult(RESULT_OK);

               Intent intent = new Intent(myappname.this,
myappnameBroadcastReceiver.class);
               PendingIntent appIntent = PendingIntent.getBroadcast
(myappname.this, 0, intent, 0);
               Calendar calendar = Calendar.getInstance();
               calendar.setTimeInMillis(System.currentTimeMillis());
               calendar.add(Calendar.SECOND, 3);
               AlarmManager am = (AlarmManager)getSystemService
(ALARM_SERVICE);
               am.set(AlarmManager.RTC, calendar.getTimeInMillis(),
appIntent);

               finish();
               }

       });

--------------------------------------------
Here's the broadcast receiver:
package com.myappname;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class myappnameBroadcastReceiver extends BroadcastReceiver {
       @Override
       public void onReceive(Context context, Intent intent) {
                       context.startActivity(new Intent(context,
myappname.class));
       }
}

---------------------------------------------
and here's the lines from the manifest.xml

               <receiver
                       android:name=".myappnameBroadcastReceiver"
                       android:process=":remote">
               </receiver>

2. Looking for some reading on the Android Framework

http://commonsware.com/Android/

<http://commonsware.com/Android/>Best I've found. Join the forum, the author
responds quite often. Good material, well written, and continually being
updated. He's working on 2.1 additions right now.





>

3. Macro Recording

4. Android Emulator Problems on Win2K

5. Regarding Multimedia

6. Android 2.0 SDK is here!

7. Installing app