What my app does? The app is selecting a photo from photos Gallery.
What is my problem? Once I select the photo from gallery it closes up without error.
What I have done? I've increased the memory of the device and it didnt function. I took it out from proyect and the activity worked fine, it came back to the activity.
What is the main problem? It doesn't function on the proyect and I cant tell why.
Wold you like to see what is happening? Here is a video. First when it closes up, and second when I do it from another project and works fine.
http://www.youtube.com/watch?v=SntnyKiJQ1Q&feature=youtu.be
EDIT
My problem was that once I choose the picture from the gallery there was no activity on the stack.
Why?
The problem was on manifest's android:noHistory="true" tag, as there was no history the gallery couldn't find any activity and it closed the app.
The code:
The Intent I use to open the gallery and select a photo:
public void openGallery(int req_code){
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select file to upload "), req_code);
}
The onActivityResult where I get the data which is never called because it closes up:
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
Uri selectedImageUri = data.getData();
if (requestCode == SELECT_FILE1)
{
selectedPath1 = getPath(selectedImageUri);
System.out.println("selectedPath1 : " + selectedPath1);
}
if (requestCode == SELECT_FILE2)
{
selectedPath2 = getPath(selectedImageUri);
System.out.println("selectedPath2 : " + selectedPath2);
}
tv.setText("Selected File paths : " + selectedPath1 + "," + selectedPath2);
}
}
The logcat:
01-05 15:18:14.569: I/ActivityManager(59): Starting activity: Intent { act=android.intent.action.UPLOADIMAGEDEMO cmp=com.example/.UploadImageDemo }
01-05 15:18:15.779: D/dalvikvm(2496): GC_EXTERNAL_ALLOC freed 2697 objects / 189152 bytes in 92ms
01-05 15:18:16.599: I/ActivityManager(59): Displayed activity com.example/.UploadImageDemo: 1953 ms (total 1953 ms)
01-05 15:18:21.899: D/dalvikvm(279): GC_EXPLICIT freed 871 objects / 134112 bytes in 217ms
01-05 15:18:26.620: I/ActivityManager(59): Starting activity: Intent { act=android.intent.action.CHOOSER cmp=android/com.android.internal.app.ChooserActivity (has extras) }
01-05 15:18:28.250: I/ActivityManager(59): Starting activity: Intent { act=android.intent.action.GET_CONTENT typ=image/* flg=0x3000000 cmp=com.android.gallery/com.android.camera.ImageGallery }
01-05 15:18:28.670: D/dalvikvm(279): GC_EXTERNAL_ALLOC freed 388 objects / 53352 bytes in 60ms
01-05 15:18:28.850: D/dalvikvm(279): GC_EXTERNAL_ALLOC freed 326 objects / 90664 bytes in 53ms
01-05 15:18:29.200: I/ActivityManager(59): Displayed activity com.android.gallery/com.android.camera.ImageGallery: 873 ms (total 2345 ms)
01-05 15:18:29.420: D/dalvikvm(279): GC_EXTERNAL_ALLOC freed 725 objects / 106960 bytes in 140ms
01-05 15:18:30.430: W/InputManagerService(59): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@45020da8 (uid=10002 pid=279)
01-05 15:18:32.010: D/dalvikvm(112): GC_FOR_MALLOC freed 9994 objects / 476368 bytes in 149ms
I hope the community can help me!!