Created
October 20, 2011 17:02
-
-
Save skayred/1301664 to your computer and use it in GitHub Desktop.
Default image viewer example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
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
import com.jettaxi.lib.ImageLoader;
Por favor me podrían decir donde puedo conseguir esta clase?