当我这样做时:
private class CustomInfoWindow extends MarkerInfoWindow {
POI mSelectedPoi;
CustomInfoWindow(MapView mapView) {
super(R.layout.bonuspack_bubble, mapView);
Button btn = (Button) (mView.findViewById(R.id.bubble_moreinfo));
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(final View view) {
Singleton si = Singleton.getInstance();
ObjectDefExtends obj = si.getCurrentObject();
if (obj != null && Singleton.getInstance().getListaVisible().size() > 0) {
ObjectDefExtends currentObject = si.getCurrentObject();
double latitude = currentObject.lat;
double longitude = currentObject.lon;
String label = currentObject.name;
String uriBegin = "geo:" + latitude + "," + longitude;
String query = latitude + "," + longitude + "(" + label + ")";
String encodedQuery = Uri.encode(query);
String uriString = uriBegin + "?q=" + encodedQuery + "&z=16";
final Uri uri = Uri.parse(uriString);
Handler handler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(Message msg) {
switch (msg.what) {
case 1:
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, uri);
view.getContext().startActivity(intent);
finish();
default:
break;
}
return false;
}
});
handler.sendEmptyMessageDelayed(1, 1000);
onResume();
}
}
});
}
@Override
public void onOpen(Object item) {
super.onOpen(item);
mView.findViewById(R.id.bubble_moreinfo).setVisibility(View.VISIBLE);
Marker marker = (Marker) item;
mSelectedPoi = (POI) marker.getRelatedObject();
}
}
我看到一个黑色的窗口,在日志中我看到了:
03-17 12:29:53.852 7671-7671/maps E/ActivityThread: Performing stop of activity that is not resumed: {com.smok.maps/maps.logowanie.LoginActivity}
java.lang.RuntimeException: Performing stop of activity that is not resumed: {com.smok.maps/com.smok.maps.logowanie.LoginActivity}
at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3462)
at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3549)
at android.app.ActivityThread.access$1200(ActivityThread.java:174)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1334)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5593)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)