0
내 안드로이드 응용 프로그램에서 여러 레코드가 MySQL 데이터베이스로 업데이 트해야합니다. 하나의 레코드로는 가능하지만 여러 레코드를 업데이트 할 수 있습니다. 아래의 은 여러 레코드에 대해 단일 레코드를 보내는 방법에 대한 코드입니다.단일 HTTP 요청으로 여러 레코드를 보내는 방법과 안드로이드에서 상대방 수신하는 방법?
ArrayList<NameValuePair> nameValuePair = new ArrayList<NameValuePair>();
nameValuePair.add(new BasicNameValuePair("appname", appName));
nameValuePair.add(new BasicNameValuePair("start_time", startTime));
nameValuePair.add(new BasicNameValuePair("end_time", endTime));
try{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://192.168.1.24/file_data_insert.php");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
}
catch(Exception e){
Log.e("log_tag", "Error in http connection"+e.toString())
}
그래서 난 당신이 공유 pref에서 마지막 레코드 번호를 추적 할 필요가 있다고 생각합니다 그래서 당신은 다음 –
에서 업데이 트하거나 증가하므로 두 번째 시간을 가져올 때 가져옵니다. –