-
Hi friends,
In the LazyAdapter class i am sending an object which consists of an arraylist , while scrolling the listview it gets stuck and shows the infamous ANR dialog.
This is the listview in xml
<ListView
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:background="@android:color/transparent"
android:cacheColorHint="#00000000"
android:divider="@android:color/darker_gray"
android:scrollbars="none"
android:fastScrollEnabled="true"
>
Below is thegetView method
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
String name = "";
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.commentitem, null);
holder = new ViewHolder();
holder.reviewText = (TextView) convertView
.findViewById(R.id.reviewText);
holder.fbImage = (ImageView) convertView.findViewById(R.id.fbImage);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
String profilePictureURL = "http://graph.facebook.com/"
+ cList.getData().get(position).getFbid() + "/picture";
if (cList.getData().get(position).getName() == null) {
name = "";
} else {
name = cList.getData().get(position).getName() + " says ";
}
holder.reviewText.setText("" + name
+ cList.getData().get(position).getComment());
try {
Bitmap bitmap = BitmapFactory.decodeStream((InputStream) new URL(
profilePictureURL).getContent());
holder.fbImage.setImageBitmap(Utility.getRoundedCornerBitmap(
bitmap, 10));
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return convertView;
}
How to resolve this??
Hi friends,
In the LazyAdapter class i am sending an object which consists of an arraylist , while scrolling the listview it gets stuck and shows the infamous ANR dialog.
This is the listview in xml
<ListView
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:background="@android:color/transparent"
android:cacheColorHint="#00000000"
android:divider="@android:color/darker_gray"
android:scrollbars="none"
android:fastScrollEnabled="true"
>
Below is thegetView method
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
String name = "";
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.commentitem, null);
holder = new ViewHolder();
holder.reviewText = (TextView) convertView
.findViewById(R.id.reviewText);
holder.fbImage = (ImageView) convertView.findViewById(R.id.fbImage);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
String profilePictureURL = "http://graph.facebook.com/"
+ cList.getData().get(position).getFbid() + "/picture";
if (cList.getData().get(position).getName() == null) {
name = "";
} else {
name = cList.getData().get(position).getName() + " says ";
}
holder.reviewText.setText("" + name
+ cList.getData().get(position).getComment());
try {
Bitmap bitmap = BitmapFactory.decodeStream((InputStream) new URL(
profilePictureURL).getContent());
holder.fbImage.setImageBitmap(Utility.getRoundedCornerBitmap(
bitmap, 10));
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return convertView;
}
How to resolve this??
--
Regards,
Vani Reddy
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment