Display Image with Universal ImageLoader with Bitmap

I wonder how to display image if I have a Bitmap and don't want to give as a parameter URL to image using Universal ImageLoader library.

 Bitmap img = getDefaultBitmap();
 ImageLoader.getInstance().displayImage(img); // I need something like this (for example with parameters to display image like width and height)

Answers


Firstly, you have to save bitmap and then u can pass that path to show that bitmap into imageview using imageloader.

//-- Saving file
String filename = "pippo.jpg";
File sd = Environment.getExternalStorageDirectory();
File dest = new File(sd, filename);

Bitmap bitmap = (Bitmap)data.getExtras().get("data");
try {
     FileOutputStream out = new FileOutputStream(dest);
     bitmap.compress(Bitmap.CompressFormat.PNG, 90, out);
     out.flush();
     out.close();
} catch (Exception e) {
     e.printStackTrace();
}

//-- show bitmap to imageview
imageLoader.displayImage(dest.getAbsolutePath(), imageView);

Need Your Help

Where can I find the source code for the gmail, facebook, and twitter apps for android? Are they even open source?

android facebook twitter gmail

There are some components I need to use from these three 'supposedly' open source apps for android.

How to check if selected cells on a grid form a 'tunnel'?

algorithm language-agnostic grid

Given a grid map where each cell can be described by a pair (x, y), and a vector of such cells, how can I (nicely) check if the cells in that vector form a 'tunnel', ie. they are all lined up either

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.