Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get twitter profile image using Twitter4j
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/4606790/retrieve-the-user-profile-image-from-twitter">Retrieve the user profile image from twitter</a> </p> </blockquote> <p>I am making Android application that gets last tweets and pulls profile image+status text to the table. I tried:</p> <pre><code> private void setTwitTable() { List&lt;Status&gt; statuses = null; try { statuses = getTimeLine(); } catch (TwitterException te) { Log.d(TAG, "Failed to get timeline: " + te.getMessage()); return; } TableLayout twit_tl = (TableLayout) findViewById(R.id.twitsTableLayout); for (Status status : statuses) { User user = status.getUser(); TableRow tr = new TableRow(this); tr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); ImageView iv = new ImageView(this); try { iv.setBackgroundDrawable(getDrawableFromUrl(user.getProfileImageURL(), "ProfileImage")); Log.d(TAG, "Image Good!");//debug } catch (MalformedURLException e) { Log.d(TAG, "MalformedURLException: " + e.getMessage()); } catch (IOException e) { Log.d(TAG, "IOException: " + e.getMessage()); } iv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); tr.addView(iv); twit_tl.addView(tr, new TableLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); } } private List&lt;Status&gt; getTimeLine() throws TwitterException { // gets Twitter instance with default credentials Twitter twitter = new TwitterFactory().getInstance(); List&lt;Status&gt; statuses = twitter.getUserTimeline(USER); return statuses; } Drawable getDrawableFromUrl(java.net.URL url, String src_name) throws java.net.MalformedURLException, java.io.IOException { return Drawable.createFromStream( ((java.io.InputStream) url.getContent()), src_name); } </code></pre> <p>But I see only black background - nothing else. No images. No table.</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