Gettng Tweet ID from Timeline? (AndroidTwitterKit)

android
twitterkit

#1

I’m using a SearchTimeline to display a list of tweets to the user. I want to be able to open tweets that the user selects in an internal TweetView instead of giving the user the option to open the tweet in their browser or native twitter app. I’ve scoured the documentation and there doesn’t seem to be an obvious way to do this. Any help would be appreciated.


How To Customize Tweet Timeline Recycler View Adapter?
#2

Please see How To Customize Tweet Timeline Recycler View Adapter?


#3

Thanks for the reply. It seems like overriding tweet link clicks only works for when users click on any hyperlinks on the tweet. What would be the correct listener to override to handle when the user clicks on the actual tweet body itself? onClick() doesn’t seen to work. Thanks.

EDIT: Looks like all I needed to do was use an onTouch listener instead! Just have to make sure that you return true in onTouch().


#4

How were you able to obtain a single tweet? So far setOnClickListener doesnt work, setTweetLinkClickListener is just for links, and setOnTouchListener is triggered whenever a user does anything on the screen, such as clicking or scrolling.


#5

You listen for ACTION_UP motion events, like so:

compactTweetView.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    CompactTweetView tweetView = (CompactTweetView) v;
                    if (event.getAction() == MotionEvent.ACTION_UP) {
                        // do something with tweetView.getTweetId();
                        return true;
                    }
                    return false;
                }
            });

#6

Worked like a charm, thank you!