What I want to do: A list with messages like this:
<UserName> and here is the mnessage the user writes, that will wrap nicely to the next line. exactly like this.
What I have:
ListView R.layout.list_item:
<TextView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/text_message"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:text="(Message Text)" />
Adapter that inflates the above layout and does:
SpannableStringBuilder f = new SpannableStringBuilder(check.getContent());
f.append(username);
f.setSpan(new InternalURLSpan(new OnClickListener() {
    @Override
    public void onClick(View v) {
        Toast.makeText(context, "Clicked User", Toast.LENGTH_SHORT).show();
    }
}), f.length() - username.length(), f.length(),
        Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
f.append(" " + message);
messageTextView.setText(f);
messageTextView.setMovementMethod(LinkMovementMethod.getInstance());
meesageTextView.setFocusable(false);
The InternalURLSpan class
public class InternalURLSpan extends ClickableSpan {
    OnClickListener mListener;
    public InternalURLSpan(OnClickListener listener) {
        mListener = listener;
    }
    @Override
    public void onClick(View widget) {
        mListener.onClick(widget);
    }
    @Override
    public void updateDrawState(TextPaint ds) {
        super.updateDrawState(ds);
        ds.setUnderlineText(false);
    }
}
In the activity I have in onCreate(...):
listView.setOnItemClickListener(ProgramChecksActivity.this);
and the implementation of the above
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
    Toast.makeText(context, "Clicked Item", Toast.LENGTH_SHORT).show();
}
The problem:
Clicking on the item, does not show the toast. Only clicking on the username does show the toast.
I am guessing, that setMovementMethod(LinkMovementMethod.getInstance()); makes the TextView clickable. So the items themselves do never get clicked anymore.
How can I make the items clickable again? Having the same functionality as I want.
 
     
     
     
     
     
     
     
     
     
     
     
    