java - Formatting errors - issues with code formation -
i have experienced various minor errors forming code, , having difficulty resolving them. in particular, have following line underline following message
query.findinbackground(new findcallback<parseobject>() { method findinbackground(findcallback<parseuser>) in type parsequery<parseuser> not applicable arguments (new findcallback<parseobject>(){})
as errors closing statements.
and
below complete code
any appreciated. in advance
update:
updated code
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, ""); parsequery<parseobject> queryo = parsequery.getquery("user"); queryo.wherenotequalto("objectid", parseuser.getcurrentuser() .getobjectid()); // users gender = currentuser.looking_gender queryo.whereequalto("gender", userlookinggender); // users looking_gender = currentuser.gender queryo.whereequalto("looking_gender", usergender); queryo.setlimit(1); queryo.whereequalto("activityname", activityname); // query.wheregreaterthanorequalto("age", minimumage); // query.wherelessthanorequalto("age", maximumage); queryo.orderbydescending("name"); queryo.findinbackground(new findcallback<parseobject>() { @override public void done(list<parseobject> object, parseexception e) { // todo auto-generated method stub 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(); } } public void done1(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(); } } 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(); } } 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 2 few formating issues such 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(); } } }); } }
this should start:
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, ""); parsequery<parseobject> queryo = parsequery.getquery("user"); queryo.wherenotequalto("objectid", parseuser.getcurrentuser() .getobjectid()); // users gender = currentuser.looking_gender queryo.whereequalto("gender", userlookinggender); // users looking_gender = currentuser.gender queryo.whereequalto("looking_gender", usergender); queryo.setlimit(1); queryo.whereequalto("activityname", activityname); // query.wheregreaterthanorequalto("age", minimumage); // query.wherelessthanorequalto("age", maximumage); queryo.orderbydescending("name"); queryo.findinbackground(new findcallback<parseobject>() { @override public void done(list<parseobject> object, parseexception e) { // todo auto-generated method stub 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) { for(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(); } } }); public void done1(list<parseuser> userlistheadline, parseexception e) { if(e == null) { for(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(); } } public void done2(list<parseuser> userlistage, parseexception e) { if(e == null) { for(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(); } } public void done3(list<parseuser> userlistactivity, parseexception e) { if(e == null) { for(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(); } } }); } }
Comments
Post a Comment