Can someone help me how to make this part of code:
Using java Syntax Highlighting
- SERVER = Uri.parse("http://192.168.1.4:9090/receivedata");
- url = SERVER.toString();
- cords = new HashMap<String, String>();
- String sendedcords;
- sendedcords = MyHttpClient.getInstance().doGet(url, cords);
- String[] finalcords = TextUtils.split(sendedcords, "a");
- sendedcordx = Integer.parseInt(finalcords[0]);
- sendedcordy = Integer.parseInt(finalcords[1]);
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
run after this part has finished with drawing:
Using java Syntax Highlighting
- Bitmap bitmap2 = BitmapFactory.decodeResource(getResources(), R.drawable.red);
- canvas.drawBitmap(bitmap2, finalx[0], finaly[0], null);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
I want to wait until i see on the screen the bitmap and then run the receivedata.
The whole code is:
Using java Syntax Highlighting
- if (finalx[0] < 260 && finaly[0] < 331 && playerNo.equals("1")) {
- Bitmap bitmap2 = BitmapFactory.decodeResource(getResources(), R.drawable.red);
- canvas.drawBitmap(bitmap2, finalx[0], finaly[0], null);
- finalx[1] = finalx[0];
- finaly[1] = finaly[0];
- if (drawok > 0) {
- if (sendonce == 0) {
- Uri SERVER = Uri.parse("http://192.168.1.4:9090/senddata");
- String url = SERVER.toString();
- Map<String, String> cords = new HashMap<String, String>();
- cords.put("cords", String.valueOf(finalx[1]) + "a" + String.valueOf(finaly[1]));
- MyHttpClient.getInstance().doGet(url, cords);
- SERVER = Uri.parse("http://192.168.1.4:9090/receivedata");
- url = SERVER.toString();
- cords = new HashMap<String, String>();
- String sendedcords;
- sendedcords = MyHttpClient.getInstance().doGet(url, cords);
- String[] finalcords = TextUtils.split(sendedcords, "a");
- sendedcordx = Integer.parseInt(finalcords[0]);
- sendedcordy = Integer.parseInt(finalcords[1]);
- sendonce++;
- }
- Bitmap bitmap1 = BitmapFactory.decodeResource(getResources(), R.drawable.yellow);
- canvas.drawBitmap(bitmap1, sendedcordx, sendedcordy, null);
- //Bitmap _okbutt = BitmapFactory.decodeResource(getResources(), R.drawable.mademove);
- //canvas.drawBitmap(_okbutt, 225, 393, null);
- }
- }
Parsed in 0.040 seconds, using GeSHi 1.0.8.4
But SERVER = Uri.parse("http://192.168.1.4:9090/receivedata"); runs first.
It would be helpfull is someone give a solution such is wait or something like that.

