2012-04-26 5 views
1

イメージをアンドロイドで表示しようとしています。プロセスはネットから1イメージをダウンロードして画面に表示しようとしていますが、私が直面している問題はアクティビティ画面にありますコンテンツビューを設定し、image.Followingはコードです:アンドロイドでイメージを表示する

main.xml:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/hello" /> 

    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/ic_launcher" /> 

</LinearLayout> 

アクティビティ画面:

public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.);---->Here i cant set as main 

     Bitmap bitmap = DownloadImage(
       "http://www.allindiaflorist.com/imgs/arrangemen4.jpg"); 
      ImageView img = (ImageView) findViewById(R.id.); //here i cant set the image id 
      img.setImageBitmap(bitmap); 

    } 

答えて

0

それは取ることはありませんあなたのproject.sometimesをきれいにR. javaファイル。

3

Androidスマートイメージビューを使用します。これは、URLを使用して画像を表示する最も簡単な方法です。ここにはlinkがあります。

+0

どのようなチュートリアルですか?私は、このURL http://oolopj.com/android-smart-image-view/ –

0

[プロジェクト] - > [クリーニング]を使用してプロジェクトをクリーンアップするだけです。まだ存在する場合は、プロジェクトを実行すると、通常は消えます。

+0

からプロジェクトを掃除して実行できませんでしたが、プロジェクトを実行する前にプロジェクトの問題を修正しています。 – subburaj

+0

それは?このようなエラーはAndroidで頻繁に発生し続けます。 Eclipseを再起動するか、新しいプロジェクトを作成して貼り付けてみてください。 Ctrl + Shift + oをクリックするとエラーが解決する可能性があります – nithinreddy

関連する問題