Android : Handling many dynamically created TextView's

on Tuesday, September 23, 2014


I have the following code:



for (int i = 0; i < dataStrings.length; i++) {
TextView tv1 = new TextView(this);
tv1.setTextSize(TEXT_SIZE);
tv1.setTypeface(Typeface.MONOSPACE);
tv1.setText(dataStrings[i]);
dynamicLL.addView(tv1);
}


Basically i am creating some amount of TextView's dynamically (the amount is unknown). I want each TextView to have its own OnLongClickListener. My question is how do i give each TextView its own unique OnLongClickListener when the textviews are generated in this way, and how do i handle the clicks once the listener has been created?


0 comments:

Post a Comment