2013-06-19 5 views
-1

보여줍니다 이미지가로드되지 않습니다 ....이미지는 내가 여기에서 가져온 이미지 비동기 작업을 구현하기 위해 노력

내 xml 파일은 다음과 같습니다.

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

    <LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" > 


    <TextView 
     android:id="@+id/beerTitle" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:ems="10" 
     android:textSize="40sp" 
     android:textStyle = "bold" 
     android:padding="5dip" 
     > 
    </TextView> 

    <ImageView android:id="@+id/image" 
     android:layout_height="wrap_content" 
     android:layout_width="fill_parent" 
     android:layout_margin="10dip"/> 

    <Button 
     android:id="@+id/buttonBrewery" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:padding="5dip" 
     android:text="" /> 
    <Button 
     android:id="@+id/buttonStyle" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:padding="5dip" 
     android:text="" /> 

    <TextView 
     android:id="@+id/beerDEscriptionTitle" 
     android:textStyle = "bold" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:ems="10" 
     android:textSize="20sp" 
     android:text="Description" 
     android:padding="5dip" 
     ></TextView> 
    <TextView 
     android:id="@+id/beerDescription" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:ems="10" 
     android:textSize="15sp" 
     android:padding="5dip" 

     ></TextView> 

</LinearLayout> 
</ScrollView> 

답변

1

없음 놀라운

또한, 적절한 인터넷 권한이 있는지 확인하십시오. ASyncTask의 "url"필드는 절대로 설정되지 않습니다.

InputStream in = new java.net.URL(params[0]).openStream(); 
+0

또한 같은 분야 "URL"을 제거 할 수 있습니다

InputStream in = new java.net.URL(url).openStream(); 

실제로이 작동합니다 (String)를 실행에 보낸 매개 변수 ... 뭔가 링크를 사용하려면 다음 AsyncTask를이 줄을 변경 미사용 제품 – JBirdVegas

+0

대단히 감사합니다! – Mike

+0

다행이 당신을 위해 일했습니다. – JBirdVegas

0

AsyncTask 이미지 로더 클래스의 URL이 절대 설정되지 않으며 이미지가 다운로드되지 않습니다. execute()를 호출 할 때 생성자 또는 params에 설정하십시오. 다른 방법으로 이미지를로드하는 방법을 살펴볼 것입니다.

<uses-permission android:name="android.permission.INTERNET"> 
관련 문제