I want to add separate event listener to dynamically created list of textview. The code so far is like this:
while (cur.moveToNext()){
TextView tv = new TextView(this);
temp = cur.getString(cur.getColumnIndexOrThrow("_ID"));
result = "some text";
tv.setText(result);
tv.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent myIntent = new Intent(v.getContext(), newsDetails.class);
myIntent.putExtra("id", temp);
startActivity(myIntent);
}
});
lOut.addView(tv);
}
But this does not work. Separate text views are created in a form of list but separate event listeners are not working.