0

http://developer.android.com/guide/market/expansion-files.htmlのAPK拡張ファイルを使用しています

コード:

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);

そしてmこの行でこのNullPointerExceptionを取得します

   iv_new.setImageBitmap(bit);

XMLでは私のImageViewは:

 <ImageView android:id="@+id/iv_new"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"/>
4

1 に答える 1

2

setContentView(View)ImageViewを含むレイアウトでを呼び出しましたか?

于 2012-05-25T06:16:42.847 に答える