public String update(BluetoothDevice newDevice, int rssi, byte[] scanRecord) {
cihazno = newDevice.toString();
new Post().execute();
}
class Post extends AsyncTask<Void, Void, Void> {
protected Void doInBackground(Void... unused) {
List params = new ArrayList();
params.add(new BasicNameValuePair("PARAM", "Giden Veri"));
veri_string = post.httpPost(cihazurl,"POST",params,20000); //PostClass daki httpPost metodunu çağırdık.Gelen string değerini aldık
Log.d("HTTP POST CEVAP:",""+veri_string);// gelen veriyi log tuttuk
return null;
}
}Android studio da yukarıdaki kod örneğinde cihazno değişkenini Post class ı içine nasıl gönderebilirim ve nasıl alabilirim.
class içine değer gönderme ve alma
3
●225
- 26-12-2018, 17:42:13
- 27-12-2018, 03:23:32Asynctask extend edilen classlarda şu şekilde parametre gönderebilirsin.
https://stackoverflow.com/questions/...s-to-asynctask
iyi çalışmalar