java - Issue working with parse - object cannot be resolved -
i trying populate page information user such name, age , profile picture parse. in attempting so, have encountered issues such as: along formatting errors such , encountering following issue:
1) object cannot resolved
public class fragment1 extends fragment { public interface constants { string log = "com.dooba.beta"; } private string currentuserid; private arrayadapter<string> namesarrayadapter; private arraylist<string> names; private arraylist<string> age; private arraylist<string> headline; private arraylist<string> activityname; private arraylist<images> alprofilepicture; private listview userslistview; private button logoutbutton; string usergender = parseuser.getcurrentuser().getstring("gender"); string activityname = parseuser.getcurrentuser().getstring("activityname"); number maxdistance = parseuser.getcurrentuser().getnumber( "maximum_distance"); string userlookinggender = parseuser.getcurrentuser().getstring( "looking_gender"); number minimumage = parseuser.getcurrentuser().getnumber("minimum_age"); number maximumage = parseuser.getcurrentuser().getnumber("maximum_age"); number userage = parseuser.getcurrentuser().getnumber("age"); @override public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); setconversationslist(); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.fragment1_layout, container, false); return view; } private void setconversationslist() { currentuserid = parseuser.getcurrentuser().getobjectid(); names = new arraylist<string>(); age = new arraylist<string>(); headline = new arraylist<string>(); activityname = new arraylist<string>(); alprofilepicture = new arraylist<images>(); // string useractivityselectionname = null; parsequery<parseuser> query = parseuser.getquery(); // query.whereequalto("activityname",useractivityselectionname); query.wherenotequalto("objectid", parseuser.getcurrentuser() .getobjectid()); // users gender = currentuser.looking_gender query.whereequalto("gender", userlookinggender); // users looking_gender = currentuser.gender query.whereequalto("looking_gender", usergender); query.setlimit(1); query.whereequalto("activityname", activityname); // query.wheregreaterthanorequalto("age", minimumage); // query.wherelessthanorequalto("age", maximumage); query.orderbydescending("name"); log.d(constants.log, ""); query.findinbackground(new findcallback<parseuser>() { @override public void done(list<parseuser> users,parseexception e) { // whatever need extract object "users" parsequery<parseobject> query = parsequery.getquery("user"); parsefile image = object.getparsefile("profilepicture"); parseimageview imageview = (parseimageview) getview().findviewbyid(r.id.profilepictureresult); // placeholder used before , during fetch, replaced fetched image // data. imageview.setplaceholder(getresources().getdrawable(r.drawable.profile_pict)); imageview.setparsefile(image); imageview.loadinbackground(new getdatacallback() { @override public void done(byte[] data, parseexception e) { log.i("parseimageview", "fetched! data length: " + data.length + ", or exception: " + e.getmessage()); } }); } }); query.findinbackground(new findcallback<parseuser>() { public void done(list<parseuser> userlistname, parseexception e) { if (e == null) { (int = 0; < userlistname.size(); i++) { names.add(userlistname.get(i).get("name").tostring()); } userslistview = (listview) getactivity().findviewbyid( r.id.userlistname); namesarrayadapter = new arrayadapter<string>(getactivity() .getapplicationcontext(), r.layout.user_list_item, names); userslistview.setadapter(namesarrayadapter); userslistview .setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> a, view v, int i, long l) { openconversation(names, i); } }); } else { toast.maketext(getactivity().getapplicationcontext(), "error loading user list", toast.length_long) .show(); } } }); } query.findinbackground(new findcallback<parseuser>() { public void done(list<parseuser> userlistheadline, parseexception e) { if (e == null) { (int = 0; < userlistheadline.size(); i++) { headline.add(userlistheadline.get(i).get("headline") .tostring()); } userslistview = (listview) getactivity().findviewbyid( r.id.userlistheadline); namesarrayadapter = new arrayadapter<string>(getactivity() .getapplicationcontext(), r.layout.user_list_all, headline); userslistview.setadapter(namesarrayadapter); userslistview .setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> a, view v, int i, long l) { openconversation(names, i); } }); } else { toast.maketext(getactivity().getapplicationcontext(), "error loading user list", toast.length_long) .show(); } } }); } query.findinbackground(new findcallback<parseuser>() { public void done2(list<parseuser> userlistage, parseexception e) { if (e == null) { (int = 0; < userlistage.size(); i++) { age.add(userlistage.get(i).get("age").tostring()); } userslistview = (listview) getactivity().findviewbyid( r.id.userlistage); namesarrayadapter = new arrayadapter<string>(getactivity() .getapplicationcontext(), r.layout.user_list_item, age); userslistview.setadapter(namesarrayadapter); userslistview .setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> a, view v, int i, long l) { openconversation(names, i); } }); } else { toast.maketext(getactivity().getapplicationcontext(), "error loading user list", toast.length_long) .show(); } } }); } query.findinbackground(new findcallback<parseuser>() { public void done3(list<parseuser> userlistactivity, parseexception e) { if (e == null) { (int = 0; < userlistactivity.size(); i++) { activityname.add(userlistactivity.get(i) .get("activityname").tostring()); } userslistview = (listview) getactivity().findviewbyid( r.id.userlistactivityname); namesarrayadapter = new arrayadapter<string>(getactivity() .getapplicationcontext(), r.layout.user_list_item, activityname); userslistview.setadapter(namesarrayadapter); userslistview .setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> a, view v, int i, long l) { openconversation(names, i); } }); } else { toast.maketext(getactivity().getapplicationcontext(), "error loading user list", toast.length_long) .show(); } } }); } public void openconversation(arraylist<string> names, int pos) { parsequery<parseuser> query = parseuser.getquery(); query.whereequalto("name", names.get(pos)); query.findinbackground(new findcallback<parseuser>() { public void done(list<parseuser> user, parseexception e) { if (e == null) { intent intent = new intent(getactivity() .getapplicationcontext(), messagingactivity.class); intent.putextra("recipient_id", user.get(0).getobjectid()); startactivity(intent); } else { toast.maketext(getactivity().getapplicationcontext(), "error finding user", toast.length_short) .show(); } } }); } }
update have added picture
you didn't post enough code show missing or bracket is. go through code carefully, work way outward, collapsing methods etc go.
Comments
Post a Comment