Command priority problem

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

Command priority problem

Postby reallife » Wed Oct 14, 2009 12:34 pm

Hello All

Can someone help me how to make this part of code:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. SERVER = Uri.parse("http://192.168.1.4:9090/receivedata");
  3.  
  4. url = SERVER.toString();
  5.  
  6. cords = new HashMap<String, String>();
  7.  
  8. String sendedcords;
  9.  
  10. sendedcords = MyHttpClient.getInstance().doGet(url, cords);
  11.  
  12. String[] finalcords = TextUtils.split(sendedcords, "a");
  13.  
  14. sendedcordx = Integer.parseInt(finalcords[0]);
  15.  
  16. sendedcordy = Integer.parseInt(finalcords[1]);
  17.  
  18.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


run after this part has finished with drawing:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. Bitmap bitmap2 = BitmapFactory.decodeResource(getResources(), R.drawable.red);
  3.  
  4. canvas.drawBitmap(bitmap2, finalx[0], finaly[0], null);
  5.  
  6.  
Parsed in 0.031 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:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. if (finalx[0] < 260 && finaly[0] < 331 && playerNo.equals("1")) {
  3.  
  4.                 Bitmap bitmap2 = BitmapFactory.decodeResource(getResources(), R.drawable.red);
  5.  
  6.                 canvas.drawBitmap(bitmap2, finalx[0], finaly[0], null);
  7.  
  8.                 finalx[1] = finalx[0];
  9.  
  10.                 finaly[1] = finaly[0];
  11.  
  12.  
  13.  
  14.                 if (drawok > 0) {
  15.  
  16.                     if (sendonce == 0) {
  17.  
  18.  
  19.  
  20.                         Uri SERVER = Uri.parse("http://192.168.1.4:9090/senddata");
  21.  
  22.                         String url = SERVER.toString();
  23.  
  24.                         Map<String, String> cords = new HashMap<String, String>();
  25.  
  26.                         cords.put("cords", String.valueOf(finalx[1]) + "a" + String.valueOf(finaly[1]));
  27.  
  28.                         MyHttpClient.getInstance().doGet(url, cords);
  29.  
  30.  
  31.  
  32.                         SERVER = Uri.parse("http://192.168.1.4:9090/receivedata");
  33.  
  34.                         url = SERVER.toString();
  35.  
  36.                         cords = new HashMap<String, String>();
  37.  
  38.                         String sendedcords;
  39.  
  40.                         sendedcords = MyHttpClient.getInstance().doGet(url, cords);
  41.  
  42.                         String[] finalcords = TextUtils.split(sendedcords, "a");
  43.  
  44.                         sendedcordx = Integer.parseInt(finalcords[0]);
  45.  
  46.                         sendedcordy = Integer.parseInt(finalcords[1]);
  47.  
  48.  
  49.  
  50.                         sendonce++;
  51.  
  52.  
  53.  
  54.                     }
  55.  
  56.                     Bitmap bitmap1 = BitmapFactory.decodeResource(getResources(), R.drawable.yellow);
  57.  
  58.                     canvas.drawBitmap(bitmap1, sendedcordx, sendedcordy, null);
  59.  
  60.                     //Bitmap _okbutt = BitmapFactory.decodeResource(getResources(), R.drawable.mademove);
  61.  
  62.                     //canvas.drawBitmap(_okbutt, 225, 393, null);
  63.  
  64.                 }
  65.  
  66.             }
  67.  
  68.  
Parsed in 0.042 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.
Playing with android..
reallife
Freshman
Freshman
 
Posts: 5
Joined: Mon Jul 20, 2009 7:29 pm

Top

Return to Android 2D/3D Graphics - OpenGL Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests