¿Hay un visor de fotos nativo?

I am building a camera and gallery app for android ICS. I have a gallery view and camera working but now want to add the ability to click on an image from the gallery and make that photo full screen with standard zoom gestures ect. Not sure if this is something i will have to write from scratch or if there is already a native ICS photo viewer i can just pass the file too via an intent extras or something.. either way.. can someone point me to an example online?

preguntado el 28 de agosto de 12 a las 14:08

1 Respuestas

You can launch the phone's photo viewer using an Intent.ACTION_VIEW y el Url object pointing to the location of the photo. See Start an Activity with the Intent.

// Build the intent
Intent photoIntent = new Intent(Intent.ACTION_VIEW); 
photoIntent.setDataAndType(Uri.fromFile(new File(path)), "image/png");

// Verify it resolves
PackageManager packageManager = getPackageManager();
List<ResolveInfo> activities = packageManager.queryIntentActivities(photoIntent, 0);
boolean isIntentSafe = activities.size() > 0;

// Start an activity if it's safe
if (isIntentSafe) {
    startActivity(photoIntent);
}

Respondido 28 ago 12, 16:08

this does not work, you need to define a file provider and some additionnal stuff - Zhar

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.