Home > Mobile >  Used in the Android studio fragments showed listview but run a click in the listview flash back line
Used in the Android studio fragments showed listview but run a click in the listview flash back line

Time:10-09

Help agghh very anxious!!!!!

CodePudding user response:

How change can not enter the next screen, this is a page to check the weather, the first interface is province, the second is the city, and then click the provinces flash back

CodePudding user response:

Check logcat, look at what mistakes, from the error stack can positioning error code

CodePudding user response:

What is wrong to stick, said light flash back what bad judgment.

CodePudding user response:

CodePudding user response:

This is an error?

CodePudding user response:


On a null object reference this mistake how to solve

CodePudding user response:

Not clear, your getCityName (where) null pointer exception

CodePudding user response:

refer to 6th floor qq_42561639 response:

On a null object reference this mistake how to solve?


You read the newspaper wrong not clickable links have blue? Point in to is an error code, this error is that call getCityName method is an empty object

CodePudding user response:

Found the problem but don't know how to solve, according to the textbook play, didn't find anything,,, too bad

CodePudding user response:


This is the place where the three problems, but didn't find what's the problem

CodePudding user response:

Click on the logic of the problematic, currentLevel==LEVEL_CITY CaiFu selectedCity object value, but queryCounties method directly using the selectedCity object, so an error, you can determine whether selectedCity in queryCounties method is null, is can't return null to continue

CodePudding user response:

Write or not, after, the code below for help
Private void queryCounties () {
TitleText. SetText (selectedCity getCityName ());
BackButton. SetVisibility (the VISIBLE);
CountyList=DataSupport. Where (" cityid=?" String. The valueOf (selectedCity getId ())). The find (County. The class);
If (countyList. The size () & gt; 0 {
DataList. The clear ();
For (County County: countyList) {
DataList. Add (county) getCountyName ());
}
Adapter. NotifyDataSetChanged ();
ListView. SetSelection (0);
CurrentLevel=LEVEL_COUNTY;
} else {
Int provinceCode=selectedProvince. GetProvinceCode ();
Int cityCode=selectedCity. GetCityCode ();
String address="http://guolin.tech/api/china/" + "/" + + provinceCode cityCode;
QueryFromServer (address, "county");
}
}

CodePudding user response:

refer to 12 floor qq_42561639 reply:
wrote later or not,,
code below for helpPrivate void queryCounties () {
TitleText. SetText (selectedCity getCityName ());
BackButton. SetVisibility (the VISIBLE);
CountyList=DataSupport. Where (" cityid=?" String. The valueOf (selectedCity getId ())). The find (County. The class);
If (countyList. The size () & gt; 0 {
DataList. The clear ();
For (County County: countyList) {
DataList. Add (county) getCountyName ());
}
Adapter. NotifyDataSetChanged ();
ListView. SetSelection (0);
CurrentLevel=LEVEL_COUNTY;
} else {
Int provinceCode=selectedProvince. GetProvinceCode ();
Int cityCode=selectedCity. GetCityCode ();
String address="http://guolin.tech/api/china/" + "/" + + provinceCode cityCode;
QueryFromServer (address, "county");
}
}


Didn't see have write ah, in this way you add
If (selectedCity==null) {
return;
}

CodePudding user response:

Thank you big! Flash back problem solved!

CodePudding user response:

Results come out new problems again, don't flash back but on the next page load not to come out, who can help again see

CodePudding user response:

English should be enhanced, this kind of error prompt all look not to understand not debugging, is development can't do.
Here said, line 36 this String response cannot be parsed into JSON, should be the format is not correct.
You in 35 line number on the left there, mouse the left key click (break), and then enter debug mode (shift + F9),
Then in the debug window below to find variables, and see what this variable is the response value, then the next step.

CodePudding user response:

This looks more trouble,

CodePudding user response:

reference 15 floor qq_42561639 response:
, and the results come out new problem again, don't flash back but on the next page load not to come out, who can help again see


Which means that your response is not a JSONArray format strings, so into a JSONArray failed

CodePudding user response:

Seems a little bit trouble

CodePudding user response:

Brothers, null pointer, it is easy to solve

CodePudding user response:

The db problem? For instance?nullnull
  • Related