I'm doing a android map where i have a map with some points using mapsforge and every point on the map is saved in a spatialite database. After that, every click on the map opens a custom PopUp window, that receive the current activity as context, with all the information about the point available to be edited and updated on the database. Now, i've added a button to the popup window with name "Take Photo" that when is clicked do the following:
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(mapViewer.getPackageManager()) != null) {
takePictureIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
mapViewer.startActivityForResult(takePictureIntent, 1);
}
And after i take the photo and save them is supposed return to my previous map activity with the popup window opened like before i click in the button Take Photo inside popup window but i receive the follow error:
E/WindowManager(15089): android.view.WindowLeaked: Activity com.ui.MapViewer has leaked window android.widget.PopupWindow$PopupViewContainer@4281bc98 that was originally added here
Why this is happens? I can't understand! After that i try to create my custom activity implementing the camera api with only a button to take a photo and after that start this activity from my popup window and after take the photo call the finish() of the activity and in this way i don't receive any error. However this is not a solution for me because i need zoom and flash in my camera app.
My implementation of popup window are in the follow pastebin:
Anyone can help me solving this serious problem?
Best Regards
EDIT: I've detected that onDestroy of the activity in the stack is called when i click save after take the picture. But why is destroyed called? I'm not calling it.