로딩화면 그냥 보여주는건 누구나할수있는데 내가 원하는타이밍에 마춰하는건 쉽지 않습니다.? 나한테만 어려울수도...
아래 참고하면 도움이 될수있습니다.
아래 참고하면 도움이 될수있습니다.
호출부 인자값은 정해주기 나름이며 처리부 protected Void doInBackground(String... urls) 에
urls에 하나씩 매칭이됩니다. urls[0],urls[1]....이런식이죠...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | //호출부... new PutLocation().execute( "1" , uniqueId, "00000" ); //서버에 값을 전송하고 정상적으로 처리될때까지 로딩화면을 보여준다. //정상적으로 처리가안될경우에 response값을 비교하여 에러처리를 한다. //처리부... protected class PutLocation extends AsyncTask<string, void = "" void ,= "" > { //이거 이상하네요.. 알아서..들.... private String Error = null ; private Dialog Dialog = new Dialog(Location. this , R.style.ProgressDialog); HttpResponse response; // - 결과값 받기전까지 보여줄 메시지 protected void onPreExecute() { Dialog.setContentView(R.layout.progressbar); Dialog.show(); // 로딩 시작 } // - 결과값 받기 protected Void doInBackground(String... urls) { StringBuffer buffer = new StringBuffer(); try { buffer.append( "platformId" ).append( "=" ).append(urls[ 0 ]).append( "&" ); buffer.append( "uniqueId" ).append( "=" ).append(urls[ 1 ]).append( "&" ); buffer.append( "locationId" ).append( "=" ).append(urls[ 2 ]); HttpGet get = new HttpGet( "URL" ); HttpClient client = new DefaultHttpClient(); response = client.execute(get); } catch (ClientProtocolException e) { Error = "ClientProtocolException" ; cancel( true ); } catch (IOException e) { Error = "IOException" ; cancel( true ); } catch (Exception e) { Error = "Exception" ; cancel( true ); } //return을 처리하면 onPostExecute에서 return값을 받아 결과값을 처리할수있다. return null ; } // 결과값 처리 protected void onPostExecute(Void unused) { Dialog.dismiss(); // 로딩종료 } } </string,> |
'programing' 카테고리의 다른 글
안드로이드 BrainTree결제 달기 (0) | 2016.02.18 |
---|---|
[안드로이드] SMS, MMS보내기 (1) | 2012.11.23 |
[기타]YTN 뉴스 동영상 저장하는법 (0) | 2012.10.04 |
[안드로이드]리스트뷰 체크박스 연결 (0) | 2012.08.14 |
[C언어]Torboc.h 파일 인스톨러 (0) | 2012.08.11 |