Skip to content

Instantly share code, notes, and snippets.

@skayred
Created October 20, 2011 17:02
Show Gist options
  • Save skayred/1301664 to your computer and use it in GitHub Desktop.
Save skayred/1301664 to your computer and use it in GitHub Desktop.
Default image viewer example
package com.jettaxi;
import java.io.OutputStream;
import com.jettaxi.lib.ImageLoader;
import android.app.Activity;
import android.content.ContentValues;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
public class BigPhotoTestActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Bitmap bitmap = ImageLoader.fetchImage("http://habrastorage.org/storage1/99bb2c69/f113380e/ece49982/a471c2d7.jpg");
ContentValues values = new ContentValues();
values.put(android.provider.MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
Uri uri = getContentResolver().insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
try {
OutputStream os = getContentResolver().openOutputStream(uri);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, os);
os.close();
} catch (Exception e) {
e.printStackTrace();
}
bitmap.recycle();
bitmap = null;
System.gc();
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(uri, "image/png");
startActivity(intent);
}
}
@JAntoniodomga
Copy link

No necesitas esa biblioteca, el la utiliza para otra cosa pero tu puedes implementar el código que se encuentra allí sin problema

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment