In my sample news application I have a view Flipper that display news title, you can see XML code of the ViewFlipper below.
<ViewFlipper android:id="@+id/pushFlipper"
android:layout_width="fill_parent"
android:layout_height="25dp"
android:background="#90333333"
android:flipInterval="4000"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dip"
>
</ViewFlipper>
Dynamically I add TextViews to this ViewFlipper in order to display the news title in animated form. Here is the code where I add TextViews to the Flipper.
Now, the issue I am facing is how to set listener on the dynamic TextViews, that I could display the appropriate news descriptionin new Activity of the title that has been displayed on the textview. Please help me in this respect, your help would be greatly appreciated.
pushFlipper = ((ViewFlipper) this.findViewById(R.id.pushFlipper));
pushFlipper.startFlipping();
try
{
RSSdata = new RSSHandler();
for (int i = 2; i < RSSdata.getTitle().size(); i++)
{
TextView tvNewsRSS = new TextView(this);
tvNewsRSS.setText(RSSdata.getTitle().get(i).toString());
tvNewsRSS.setTextColor(Color.parseColor("#FFFFFF"));
tvNewsRSS.setTextSize(14);
tvNewsRSS.setGravity(Gravity.CENTER_VERTICAL);
pushFlipper.addView(tvNewsRSS);
}
}
catch(Exception e)
{
}