class SendPostAsyncTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
// TODO Auto-generated method stub
String content = executeClient(params[0], params[1]);
return content;
}
@Override
protected void onPostExecute(String result)
{
// TODO Auto-generated method stub
super.onPostExecute(result);
Log.d("~~~~~onPostExecute결과~~~~~",result);
}
public String executeClient(String content, String tel)
{
//윗부분생략
try
{
UrlEncodedFormEntity entity = new UrlEncodedFormEntity( valuelist, "UTF-8");
httpPost.setEntity(entity);
HttpResponse hres = httpclient.execute(httpPost);
HttpEntity hentity = hres.getEntity();
if (hentity != null)
{
str="";//초기화
responseTime= new SimpleDateFormat ("yyyy/MM/dd/hh/mm/ss",Locale.KOREA).format(new Date());
responseStr = EntityUtils.toString(hentity);
responseResult(1,responseTime);
}
return EntityUtils.getContentCharSet(entity);
} catch (ClientProtocolException e)
{ //서버 e.printStackTrace();
}
catch (IOException e)
{ e.printStackTrace();
}
return null;
}//executeClient
}
public void responseResult(int check, String date)
{
//byte array data를 셋팅 한후 블루투스로 전송
mBluetoothLeService.writeCharacteristic(mWriteCharacteristic, data); }
안녕하세요. 서버값을 확인 후, 응답이 오면 정수값 1과, date 값을 블루투스로 보내려고 하는데.
An error occured while executing doInBackground() 라는 에러가 발생합니다.
mBluetoothLeService.writeCharacteristic(mWriteCharacteristic, data);
이 부분에서 발생하는데 값을 보내려면 다른 특정 처리를 해주어야 하는지요?
+
에러로그도 추가했습니다.