0
http를 통해 특정 정보를 저장하려고합니다. 이 정보는 로컬 데이터베이스 (sqlite)에 지속적으로 저장되고 서버 (HttpPost)에 보관됩니다.여러 작업을 연속적으로 실행
테이블에서 각 데이터별로 개별적으로 작업을 릴리스하는 정보를 어떻게 저장할 수 있습니까? 가능한 경우 정돈 된 방식. 따라서
내가 작업을 시작하고 완벽하게 작동이
이
void SaveDataOnServer()
{
String data = db.getFirstData();
task = new SaveItemTask();
task.execute(data);
//if I have, say, 5 data, it would be nice to launch 5 row consecutive (for, while...)?
}
public class SaveItemTask extends AsyncTask<String, Void, Boolean>
{
protected Boolean doInBackground(String... param)
{
...
HttpClient client = new DefaultHttpClient();
HttpPost consult = new HttpPost(url + "?x=" + param[0]);
//making an HTTP POST request
try
{
HttpResponse response = client.execute(consult);
HttpEntity entity = response.getEntity();
...
}
catch...
}
....
@Override
protected void onPostExecute(final Boolean success)
{
...
if (success)
{
//Update row (set saved onserver=true)
}
...
}
'// 데이터가 5 개인 경우, 연속 5 행을 시작하는 것이 좋을 것입니다. ' 그럼요. 당신이 말했듯이 for 또는 while 루프를 사용할 수 있습니다. – greenapps