Home > Mobile >  Request for help about the for loop and network problem!!!!!!!!!!!!!!!!!!!
Request for help about the for loop and network problem!!!!!!!!!!!!!!!!!!!

Time:09-17

The younger brother I have such a code
 for (int I=0; I & lt; Ans. The size (); I++) {
String STR=ans. Get (I). The toString ();//get the current tag name
String tag_id=null;

/* this paragraph is to obtain the tag_id code I will not put up */

//the following are network request copy document
BmobQuery Query=new BmobQuery (a);
Query. GetObject (tag_id, new QueryListener () {
@ Override
Public void done (Tag Tag, BmobException e) {
If (e==null) {
BmobRelation base=new BmobRelation ();
A function. The add (tag);
Question. SetTag_id (base);
Question. The update (new UpdateListener () {
@ Override
Public void done (BmobException e) {
If (e==null) {
The e (" Bmob ", "add a many-to-many association success!" );
} else {
The e (" add relationships fail, "um participant etMessage ());
}
}
});
}
}
});

}


Her little brother, I just contact with android programming, now results sometimes choose all tags can be added to the correlation, sometimes not,,,, I doubt that is the cause of the cycle and speed of the network request (I guess) I want to make it success before the next cycle time should be how to do?

CodePudding user response:

A piece of code that what, don't know what do you want to do,

CodePudding user response:

You use handler, pass a message to keep the position, on behalf of the currently executing the position of the label, the handler to accept the message after calling bmob, after the success of the call, send a message again, the position + 1
  • Related