Try changing your code to something like the following:
Bitmap mBackground = null;
try {
FileInputStream fis = new FileInputStream("/sdcard/Image/
Images.zip");
ZipInputStream zis = new ZipInputStream(fis);
ZipEntry ze = null;
while ((ze = zis.getNextEntry()) != null) {
if (ze.getName().equals("Background.png")) {
mBackground = BitmapFactory.decodeStream(zis);
break;
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
--
Jack Ha
Open Source Development Center
・T・ ・ ・Mobile・ stick together
The views, opinions and statements in this email are those of
the author solely in their individual capacity, and do not
necessarily represent those of T-Mobile USA, Inc.
On Aug 8, 5:18 pm, Orion2569 <[email protected]> wrote:
> Ok, basically what i'm attempting to do is place several images into 1
> zip file, and then read the images back out of the zip file, and draw
> them onto a canvas using BitmapFactory. This is what my code looks
> like, but when i debug i only get a source not found error.
>
> Code:
> try {
>
> FileInputStream fis = new FileInputStream("/sdcard/Images/
> Images.zip");
> ZipInputStream zis = new ZipInputStream(fis);
> ZipEntry ze = null;
>
> // Until we find their map, or we run out of options
> if(zis.getNextEntry()!=null) ze = zis.getNextEntry();
>
> while ((ze.getName() != ("Background.png")) &&
> zis.getNextEntry() != null){
> ze = zis.getNextEntry();
> }
>
> if (ze.getName() == "Background.png"){
> mBackground = BitmapFactory.decodeStream(zis);
> }
> else
> mBackground = null;
>
> } catch (FileNotFoundException e) {
> e.printStackTrace();
> } catch (IOException e) {
> e.printStackTrace();
> }
>
> Zip File Contents:
> -Images.zip
> --Background.png
>
> I'm not too familiar with the debugging android apps, or what is
> causing the file not found. (And the archive is located correctly on
> my SD card). Any help would be greatly appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---