Hi,
I have a case where I have add to listview textview based on no of messages.
1)
I am doing like this
for(int i=0;i<10;i++)
{
TextView tv=new TextView(context);
linearlayout.add(tv);
}
this seems fine but it seems to be very slow especially where there are lot
of messages.
2)
I also tried inflating a xml where xml file contains just the textview
xml file is
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text_favmsg_botg_msg"
android:paddingTop="10px" android:paddingBottom="10px"
android:paddingLeft="15px" android:paddingRight="15px"
android:layout_width="315px" android:layout_height="wrap_content"
android:background="@drawable/textview_background"
></TextView>
for(int i=0;i<10;i++)
{
View v= mLayoutInflater.inflate(R.layout.fav, null, false);
TextView mTextMessage=(TextView)v.findViewById(R.id.text);
mMessageLayout.addView(mTextMessage);
}
this seems fine little bit faster
I really like to know is there a better way to do than this way. is there a
way to clone a textview and reuse it rather than inflating every time
Thanks in advance for your help.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en