Есть ли способ прокрутки галереи изображений по умолчанию на устройстве Android? В моем приложении мне удалось передать выбранное изображение из галереи по умолчанию на ImageView этим кодом:Пройти через галерею изображений на устройстве Android
public void onImageGalleryClicked(View v){
//Invoke image gallery using implicit intent
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
//Where is the image gallery stored
File pictureDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
//Get path of the image gallery as string
CurrentPicturePath = pictureDirectory.getPath();
//Get the URI-representation of the image directory path
Uri data = Uri.parse(CurrentPicturePath);
//Set the data and type to get all the images
photoPickerIntent.setDataAndType(data, "image/*");
//Invoke activity and wait for result
startActivityForResult(photoPickerIntent, IMAGE_GALLERY_REQUEST);
}
и показывать картину в в ViewController по:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(resultCode == RESULT_OK){
if(requestCode == IMAGE_GALLERY_REQUEST){
//Address of the image on SD-card
Uri imageUri = data.getData();
//Declare a stream to read the image from SD-card
InputStream inputStream;
try {
inputStream = getContentResolver().openInputStream(imageUri);
//Get a bitmap
Bitmap image = BitmapFactory.decodeStream(inputStream);
imgPicture.setImageBitmap(image);
} catch (FileNotFoundException e) {
e.printStackTrace();
Toast.makeText(this, "Unable to open image!", Toast.LENGTH_LONG).show();
}
}
}
}
Теперь я хочу чтобы в моем приложении была кнопка, которая находит следующую картинку в галерее по умолчанию. Я хотел бы пройти через галерею, чтобы найти текущее изображение (по пути/имени !?), чтобы иметь возможность выбрать следующий (или предыдущий)
Возможный дубликат [Загрузка всех изображений из галереи в приложение в android] (http://stackoverflow.com/questions/18590514/loading-all-the-images-from-gallery-into-the-application- в-андроида) – abbath