android.content.res.ResourceNotFoundException:String resource ID #0x2 in onListItemClicked

final int row_index = participant.getColumnIndex(HRADbAdapter.participant_id);
final int participant_id = participant.getInt(row_index);

TextView participant_id_tv = (TextView )new_participant_view.findViewById(;
participant_id_tv.setText(participant_id);  //this is the line that caused the above exception.

At the beginning, I was thinking it’s because participant_id_tv is null. but after looking at my laoyout file, is clearly a valid resource id, with <TextView android:id=”@+id/patient_id”…./>

It turns out it’s because when I pass an integer to setText, android thinks I am passing a resource id and tries to find resource. what I need is to explicitly convert int to String as below:


Now it’s okay. simple.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s