How to get a tweet image?

fabric

#1

I obtain a Tweet info with his id calling the show method , called result In my code but in this result object ,hoy I can get the tweet image or the tweet image url from result.data??

package client.tclient.com.client;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import com.twitter.sdk.android.core.Callback;
import com.twitter.sdk.android.core.Result;
import com.twitter.sdk.android.core.TwitterApiClient;
import com.twitter.sdk.android.core.TwitterCore;
import com.twitter.sdk.android.core.TwitterException;
import com.twitter.sdk.android.core.models.Tweet;
import com.twitter.sdk.android.core.services.StatusesService;

public class ShowTweetActivity extends AppCompatActivity {
    TextView texto;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show_tweet);

        texto = (TextView)findViewById(R.id.textView);
        Bundle b = getIntent().getExtras();
        Long id = b.getLong("TWEET_ID");
        texto.setText(id.toString());

        TwitterApiClient twitterApiClient = TwitterCore.getInstance().getApiClient();
// Can also use Twitter directly: Twitter.getApiClient()
        StatusesService statusesService = twitterApiClient.getStatusesService();
        statusesService.show(id, null, null, null, new Callback<Tweet>() {
            @Override
            public void success(Result<Tweet> result) {
                texto.setText(result.data.text);
            }

            public void failure(TwitterException exception) {
                //Do something on failure
            }
        });
    }
}

#2

Hey @AFS_1984,

Just to confirm, you’re looking to get the url of the image or embedded media from a Tweet whose ID is already known?

-Mike


#3

I’m looking for the url image but it’s already solved.

Thank you


#4