Reputation: 11109
Here is what i am looking for...
I am developing an app in Android 2.3.3
My app has 3 .JPG files that will be downloaded as part of the app, when the user installs it. As part of configuration of my app, the user should be able to select one of the three .JPGs as the wallpaper. Since i cannot set the WallPaper directly(through programming), I wish to launch the WallPaper Chooser for the images that are in my app and the user gets to choose the WallPaper from those. Can it be done?
Upvotes: 1
Views: 1075
Reputation: 3080
Use this function simply in your code...
int ACTION_REQUEST_GALLERY = 1 // YOU CAN PUT ANY INTEGER VALUE AS A REQUEST_CODE
private void pickFromGallery() {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
Intent chooser = Intent.createChooser(intent, "Choose a Picture");
startActivityForResult(chooser, ACTION_REQUEST_GALLERY);
}
Hope this will help you.
EDITED
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
switch (requestCode) {
case ACTION_REQUEST_GALLERY:
// user chose an image from the gallery
Uri uri = data.getData();
YOUR_IMAGE_VIEW.setImageURI(uri);
break;
}
}
}
Upvotes: 1