0

I am Using APK Expansion File from http://developer.android.com/guide/market/expansion-files.html

CODE :

String[] path= getAPKExpansionFiles(this,2,0);
ZipResourceFile expansionFile;
try {
        expansionFile = new ZipResourceFile(path[0]);
        InputStream fileStream = expansionFile.getInputStream("assets/Tablet/Chester_the_cat/chester_the_cat_2.png");
        Bitmap bit=BitmapFactory.decodeStream(fileStream);
            iv_new=(ImageView)findViewById(R.id.iv_new);
            iv_new.setImageBitmap(bit);

and m getting this NullPointerException in this line

   iv_new.setImageBitmap(bit);

and in XML my ImageView is :

 <ImageView android:id="@+id/iv_new"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"/>
2
  • Please debug is iv_new is null or bit is null there at that line ? Commented May 25, 2012 at 6:02
  • ok i will try this nd let u know d result :) Commented May 25, 2012 at 6:21

1 Answer 1

2

Did you call the setContentView(View) with the layout which contains the ImageView?

Sign up to request clarification or add additional context in comments.

4 Comments

Please check this again, because he can not find the view in the inflated layout. (The findViewById returns null means this view you want isn't inflated)
i check it again but i mention in it
is it possible to load Bitmap content in webview ?
I guess yes, you should pass the location of the bitmap as url. But you shouldn't do that. Try figuring out what you did wrong :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.