I am implementing an android app, which will synchronize images from selected folder to server (as Google Photo). I want that user will select folder by clicking on button. I can achieve this by creating my own view. But, if implicit intent can any implicit intent action by which I can show user only images folder from device?
Try,
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, 100);
change EXTERNAL_CONTENT_URI constant accordingly.
Related
How can we start the gallery app in Android without telling it which file to display?
This is because I want to show images in an album/folder. However, I understand there is no such function. So, I would like to just start the gallery app.
ACTION_VIEW will always result in an "unsupported file" message, if there is no URI specified, or if MediaStore.Images.Media.EXTERNAL_CONTENT_URI is specified. This is bearable, but not desirable, as it tells the user something is wrong with my app.
ACTION_PICK works partially, but the later half is not what I want. I want the user to choose images, and see the chosen images in the gallery. The gallery should not return the URI to my app, and expect my app to display it. There is a reason for this, that is, I want the user to be able to switch from one image to another without returning to my app. The user should return only after he/she has decided not to view anymore image.
The code that I have tried :
intent = new Intent (Intent.ACTION_VIEW);
intent.setType ("image/*");
startActivity (intent);
intent = new Intent (Intent.ACTION_PICK,
MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivity (intent);
Any suggestion?
I am using this code
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
photoPickerIntent.setType("image/*");
photoPickerIntent.setAction(Intent.ACTION_GET_CONTENT);
photoPickerIntent.addCategory(Intent.CATEGORY_OPENABLE);
photoPickerIntent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
startActivityForResult(Intent.createChooser(photoPickerIntent, "Image File Picker"), 1000);
to pick image from sdcard within my application.
this is working fine, according to my requirement i need to close that ACTION_PICK chooserActivity myself, like when we touch outside the dialog that will closed fine...
but how can we close this type of dialog programmatically?
You can't.
That chooser is actually a separate activity, launched by intent (which will then launch another activity via intent when the user selects something).
You don't control that chooser, its not actually in your app.
I want to launch Android built-in camera app with a thumbnail icon on the right-bottom. Here is my code to open the camera app.
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
I think I need to put a intent data to do it. I look forward to your help.
Thanks.
Just create an image button, or button or anything you desire really.
In the onclick event add something like:
String saveFileName= Environment.getExternalStorageDirectory() + "/test.png";
// BUILT IN CAMERA
Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
camera.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(saveFileName) );
this.startActivityForResult(camera, 1);
Make sure you have necessary permissions set. Like saving to the SDCard.
You are very close, you dont need those flags set. And you should ideally specify where you are saving the image.
If you are wondering how to make the button take a look here
Assuming I know that the Gallery has an album with a certain name X, what intent or broadcast can I make to open Album X with the Gallery app?
There are plenty of examples showing how to select a picture from the Gallery, but I don't see any describing how to accomplish the above.
Thanks.
try this
Intent intent = new Intent();
intent.setType("image/*");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Main.this.startActivity(intent);
program will browser all application are support with image file
but user can set default program
If you prepared the Gallery which is called X, yes you can do it.
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.package.Xapp");
if (launchIntent != null) {
launchIntent.setData("PHOTO ID OR ANYTHING ELSE");
startActivity(launchIntent);
}
After then you can set data in intent. And X app parses intent data and you can open it.
Otherwise, you can't this action. You only call the app, If the application does not provide API support for send data with intent.
I'm interested in capturing media to use in my activity in two ways:
1) capturing immediately from the supplied app. (like Using the camera activity in Android)
Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
this.startActivityForResult(camera, PICTURE_RESULT);
2) browse a picture/video/audio gallery and pick from the list.
I notice I can call up for the photo gallery
Intent intent = new Intent(Intent.ACTION_VIEW, target);
startActivity(intent);
But how about for video only? audio only? How will I get the URI from any of them?
a FEW problems, you need to do startActivityForResult..
But just take a look at this post, its already been done by lots of people.
Android ACTION_IMAGE_CAPTURE Intent