Fastest Way of Loading a Bitmap into Bytearray?

Problems with Canvas, OpenGL, etc...

Fastest Way of Loading a Bitmap into Bytearray?

Postby ikaruga3333 » Sat Jun 04, 2011 12:57 pm

As per this link: ... erfTuning/

The fastest way of loading a file is to do the buffering yourself (i.e., *don't* use BufferedInputStream).
So this is what I have to load a bitmap from a file---load into a bytearray and then load to a bitmap:

Code: Select all
       Bitmap bitmap = null, tbitmap = null;
       FileInputStream fis = null;
       try {
      int len = (int)(new File( VideoLiveWallpaper.folder+"/"
      fis =
          new FileInputStream(
      byte buf[] = new byte[len];;
      tbitmap = BitmapFactory.
      bitmap = Bitmap.createScaledBitmap(tbitmap,128,128,false);

Unforunately, it doesn't work. I get a NULL bitmap. How can I fix this? (Note "folder" and "imageList" variables have been properly defined and the bitmap exists).
Once Poster
Once Poster
Posts: 1
Joined: Sat Jun 04, 2011 12:47 pm


Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 4 guests