In order to improve the encapsulation and readability of the code, I put the original hand lazy to engage in some asynctask inherited internal class decisions are pulled into a folder alone, but this pull, out of the matter!
My application business is, there is a min_question_id (int) to record the currently read server-side data, the original is the internal class, with a good, this separate it out, each pull the data is pulled from scratch!
OK, first on the original code!
public class Getquestionlistdatatask extends Asynctask<void, Void, void>{private static final int getrefresuccess= 5000;private static final int getrequesterror=5001;private static final int datasetempty=5002; Pulltorefreshlistview mpulltorefreshlayout; List}
Inside the Getquesionlistdata is a pull network data interface, because everyone understands the reason, I do not post it ~ ~ ~ My request is to pull the data every time (instantiate onceGetquesionlistdatatask and Execute), all ingetquesionlistdata Update the value of the min_question_id. Obviously, the reason why the data is always pulled back is that the min_question_id has not been updated!
is the delivery of Java not a value pass?!
Is it?! No, this is just one of my misconceptions.
① basic type variables, including char, Byte, short, int, long, float, double, Boolean.
② non-basic variables.
Instead of the basic variable is the reference pass, the basic variable is the value pass!
What about that? Should we write a wrapper of Char, Byte, short, int, long, float, double, and Boolean to wrap them into classes? But that's the way it is! But we don't have to write on our own, Java itself with these packages, is these basic types of packaging Class!
Corresponding to the above basic variable type are:Character,Byte, short,Integer,long,Float,Double,Boolean.
and support automatic wrap/unwrap, mother no longer have to worry about my finger!
In this way, we can change the underlying type variable type inside and outside the wrapper class name when the value of the underlying variable needs to be changed inside the function or class ~
So, my current code is this:
External class:
Public class Askfragment extends Fragment implements Onclicklistener {private static Boolean Isfirstenter=true ;p rivate Integer min_question_id=1000;private list
The Getquestionlistdatatask is this:public class Getquestionlistdatatask extends Asynctask<void, Void, void>{private static final int getrefresuccess= 5000;private static final int getrequesterror=5001;private static final int datasetempty=5002; Pulltorefreshlistview mpulltorefreshlayout; List}
So it's done, there's wood! The list is displayed properly!Description: Because it is just an example of the role of code truncation of the project, a lot of things deleted, but also some variables are not initialized, but people do not mind these details ~
Android Java Foundation---A list box of the murders and the actual application of the Java boxing unpacking