[ANDROID] Set custom OnClickListener in Timeline


#1

Hello
I can’t set OnClickListener on my project using Fabric.
I create custom adapter, but doesn’t load OnClickListener and load OnClickListener written in BaseTweetView. I try to extend BaseTweetView in new class but I can’t override methods.

public class TweetAdapter extends TweetTimelineListAdapter {
    public ArrayList<Long> tweetIds=new ArrayList<Long>();
    public TweetAdapter(Context context, Timeline<Tweet> timeline) {
        super(context, timeline);
    }

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    Object rowView = convertView;
    final Tweet tweet = (Tweet)this.getItem(position);
    if(convertView == null) {
        rowView = new CompactTweetView(this.context,tweet);

    } else {
        ((CompactTweetView)convertView).setTweet(tweet);
    }
    ((View)rowView).setClickable(true);

    ((View)rowView).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            tweetIds.add(tweet.getId());
        }
    });

    return (View)rowView;
}

Any ideas? Thanks


#2

I’ve finally found the solution.


#3