Note that there are some explanatory texts on larger screens.

plurals
  1. POcreate custom view with ImageView, Asynctask not working
    primarykey
    data
    text
    <p>I want to add Views programmatically to a ViewFlipper :</p> <pre><code>flipper.addView(anEpisode(name, null, description), i); </code></pre> <p>my method is : </p> <pre><code>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; } </code></pre> <p>and the createUrlImage is :</p> <pre><code>private class CreateImage extends AsyncTask&lt;String, Void, Drawable&gt; { 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); } </code></pre> <p>The thing is : it doesn't display image at all so i don't know what to do.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload