0

how to get tweet post with image and display it on list view? i'm only getting text in retrieving tweet post on twitter.

this is what i wanted to do http://tinypic.com/r/2ztee84/8 and this is what I've done on my application http://tinypic.com/r/zkmknm/8

thanks in advance.

Macsanity
  • 65
  • 6

1 Answers1

0

Well, it would help if you provided us with more code. But... Try to "parse" the image link from the tweet, and download it.

You could try this lib, which will download images asynchronously. Or you could try a native approach. Something like:

public class LoginActivity extends Activity implements OnClickListener {

   protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.login);

   this.findViewById(R.id.userinfo_submit).setOnClickListener(this);
   // Verify Code
   LinearLayout view = (LinearLayout) findViewById(R.id.txt_verify_code);
   view.addView(new VerifyCodeView(this));

   // show The Image
   new DownloadImageTask((ImageView) findViewById(R.id.imageView1))
   .execute(“http://java.sogeti.nl/JavaBlog/wp-content/uploads/2009/04/android_icon_256.png”);
   }

  public void onClick(View v) {
    startActivity(new Intent(this, IndexActivity.class));
    finish();
  }

  private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
    ImageView bmImage;

    public DownloadImageTask(ImageView bmImage) {
      this.bmImage = bmImage;
    }

    protected Bitmap doInBackground(String… urls) {
      String urldisplay = urls[0];
      Bitmap mIcon11 = null;
      try {
        InputStream in = new java.net.URL(urldisplay).openStream();
        mIcon11 = BitmapFactory.decodeStream(in);
      } catch (Exception e) {
        Log.e(“Error”, e.getMessage());
        e.printStackTrace();
      }
      return mIcon11;
    }

    protected void onPostExecute(Bitmap result) {
      bmImage.setImageBitmap(result);
    }
  }
}

This code was taken from here.

And there's this related question, which might be an interesting read for you.

Community
  • 1
  • 1
Mauker
  • 11,237
  • 7
  • 58
  • 76