を働いていない:ImageViewの持つカスタムビューを作成し、Asynctask私はViewFlipperにプログラムでビューを追加したい
public View anEpisode(String n, String i, String d){
View v;
LayoutInflater inflater = (LayoutInflater)getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(R.layout.episodedescription, null);
TextView nameOfEpisode = (TextView) v.findViewById(R.id.episodedescriptionname);
ImageView imageOfEpisode = (ImageView) v.findViewById(R.id.episodedescriptionimage);
TextView descriptionOfEpisode = (TextView) v.findViewById(R.id.episodedescriptiondescription);
nameOfEpisode.setText(n);
descriptionOfEpisode.setText(d);
createUrlImage(imageOfEpisode, i);
return v;
}
とcreateUrlImageは次のとおりです:
flipper.addView(anEpisode(name, null, description), i);
私の方法がある
private class CreateImage extends AsyncTask<String, Void, Drawable> {
ImageView image;
public CreateImage(ImageView img) {
image = img;
}
protected void onPreExecute() {
}
protected Drawable doInBackground(String... urls) {
InputStream is;
Drawable d = null ;
try {
is = (InputStream)new URL(urls[0]).getContent();
d = Drawable.createFromStream(is, "Image");
return d;
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return d;
}
protected void onPostExecute(Drawable d) {
image.setBackgroundDrawable(d);
}
}
public void createUrlImage(ImageView img, String url){
new CreateImage(img).execute(url);
}
事は:画像を全く表示しないので、私は何をすべきかわかりません。
あなたのコードをトレースして、コンピュータが何をするかを確認できます。 – Snicolas
どうすればいいですか?私はデバッガの使い方を知っています。 – Tsunaze
ResourceType:リソースにはリソース番号0x7fのパッケージは含まれていません....すべてのページにこの行があります。 – Tsunaze