0

URLからAndroidフォンに画像を表示するためのすべてのチュートリアルを実行しました。イメージビュー オブジェクトを HTTP URL にバインドしようとしていますが、イメージビュー クラスをインフレートできないというエラーが引き続き発生します。

02-16 23:32:50.204: E/AndroidRuntime(499): java.lang.RuntimeException: アクティビティ ComponentInfo{com.DBResults/com.DBResults.ContactView} を開始できません: android.view.InflateException: バイナリ XML ファイル行 # 82: クラス Imageview の拡張中にエラーが発生しました

私のJavaファイルのTheoコード:

 ....
 setContentView(R.layout.contact_view);
 ImageView imageView = (ImageView)findViewById(R.id.ImageView1); 
 imageView.setImageDrawable(createDrawableFromURL("http://savagelook.com/misc/sl_drop2.png"));
 ....
 private Drawable createDrawableFromURL(String urlString) {
    Drawable image = null;
try {
    URL url = new URL(urlString);
    InputStream is = (InputStream)url.getContent();
    image = Drawable.createFromStream(is, "src");
} catch (MalformedURLException e) {
    // handle URL exception
    image = null;
} catch (IOException e) {
    // handle InputStream exception
    image = null;
}

return image;
}

私の XML ファイルは次のようになります (82 行目は開始イメージビュー タグです)。

<LinearLayout android:orientation="horizontal"
    android:layout_width="fill_parent" android:layout_height="wrap_content"
    android:gravity="left" android:background="@drawable/white">
    <Imageview  android:id="@+id/ImageView1" 
                android:layout_height="wrap_content" 
                android:layout_width="fill_parent" /> 
     </LinearLayout>
4

1 に答える 1

1

それはタイプミスです。ImageView である必要があります。

于 2012-02-17T00:02:02.073 に答える