Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development > Application Requests

Application Requests Request Apps or provide ideas for the devs here.



Reply
 
LinkBack Thread Tools
Old June 4th, 2011, 09:04 AM   #1 (permalink)
New Member
 
Join Date: Jun 2011
Posts: 2
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default I create a Adapter (extends ResourceCursorAdapter)for listView,but the app always out of memory

Hi all,
Following is the Adapter I create; I'm sure it must be the problem of the

adapter, but i don't know what is wrong in it ; my app can be start ,but

it only can running for a while ,then the Eclipse Logcat tell me the

error:: ERROR/JavaBinder(1496): java.lang.RuntimeException: No memory in memObj

I hope your help , I really don't know why, HELP!!!!!

THANK YOU!!!!

you can also tell me by email ---zxxjjforever@gmail.com!

private class ContactListItemAdapter extends ResourceCursorAdapter {
public ContactListItemAdapter(Context context, int layout, Cursor c) {
super(context, layout, c);
}


@Override
public void bindView(View view, Context context, Cursor cursor) {
System.out.println(" bindView");
final ContactListItemCache cache = (ContactListItemCache) view
.getTag();

TextView nameView = cache.nameView;
QuickContactBadge photoView = cache.photoView;

nameView.setText(cursor.getString(SUMMARY_NAME_COL UMN_INDEX));
final long contactId = cursor.getLong(SUMMARY_ID_COLUMN_INDEX);
final String lookupKey = cursor.getString(SUMMARY_LOOKUP_KEY);
int photoid = cursor.getInt(SUMMARY_PHOTO_ID_COLUMN_INDEX);
photoView.setMode(QuickContact.MODE_SMALL);
photoView.assignContactUri(Contacts.getLookupUri(c ontactId,
lookupKey));
if (getPhoto(context, photoid) != null) {
photoView.setImageDrawable(getPhoto(context, photoid));
} else {
photoView.setImageResource(R.drawable.ic_contact_p icture);
}

}

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
View view = super.newView(context, cursor, parent);
ContactListItemCache cache = null;

cache = new ContactListItemCache();
cache.nameView = (TextView) view.findViewById(R.id.name);
cache.photoView = (QuickContactBadge) view.findViewById(R.id.badge);

view.setTag(cache);
System.out.println("View newView");

return view;

}

}

static class ContactListItemCache {
public TextView nameView;
public QuickContactBadge photoView;

ContactListItemCache() {
System.out.println("ContactListItemCache");
}

}

zxxjj is offline  
Reply With Quote
Sponsors
Reply

Bookmarks


Go Back   Android Forums > Android Development > Application Development > Application Requests User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 03:04 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo