this is the code to access the php file from android
DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost("http://localhost/file.php?value="+output);
// put the above code inside the case of R.id.bChange: // also remember to use try {} catch {}
php file
<?php $n="file.txt"; $f=fopen($n,'w'); $value=$_GET['value']; fwrite($f,$value); fclose($f); ?>
// this code is for writing vlue to a file
source share