I am building an application and in one of my activities, I am displaying some information from a database and one image, this image is scaled down and when the user press the image, I am launching the built-in gallery to view it in a larger size.
My problem here is the following when I am done looking at the image in the gallery, I want the user when he press the back button to go back to my app and exactly to the activity that launches the gallery, my application show me a crash message and direct me to the main activity of my app
here is the code that launches the built-in gallery
imageView.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new
File(image_file.getAbsolutePath())),"image/*");
startActivityForResult(intent, 1);
}
});
I tried using startActivity(intent); but that still not working.
I also tried to override onPuase() and onResume() but after I did, the entire activity that hold the imageView does not launch and the app crashes.
when I looked up something similar to this problem, people say that I may have bad manifest but I am doing nothing for that Activity in my manifest.
How can I fix the problem so the user can see the image in the built-in or any other gallery app then presses the back button to go back to my app?
thanks