I'm trying to make an android app using JAVA, PHP, and MySQL. I'm using PHP to process the calculations...now I'm trying to show the output of the calculations in ANdroid. But I still don't know how to..can't find any tutorial to do so..here's my php code :
<?php
$tinggi = $_GET['$tinggi'];
$berat = $_GET['berat'];
$kUsia = $_GET['usia'];
$jk = $_GET['jk'];
$BBI = 0.9 * ($tinggi-100);
if ( kUsia >= 40 and kUsia <= 29) {
$kUsia = 0.05
if ( $jk == "perempuan" ) {
$Basal = $BBI * 25 ;
$KKT = $Basal + ($Basal * 0.2) - ($Basal * $kUsia);
Echo ($KKT);
}
elseif ( $k == "laki-laki" ) {
$Basal = $BBI * 30 ;
$KKT = $Basal + ($Basal * $AF) - ($Basal * $kUsia);
Echo ($KKT);
}
else {
Echo ($KKT);
}
}
if ( kUsia >= 60 and kUsia <= 69) {
$kUsia = 0.1
if ( $k == "perempuan" ) {
$Basal = $BBI * 25 ;
$KKT = $Basal + ($Basal * $AF) - ($Basal * $kUsia);
Echo ($KKT);
}
elseif ( $k == "laki-laki" ) {
$Basal = $BBI * 30 ;
$KKT = $Basal + ($Basal * $AF) - ($Basal * $kUsia);
Echo ($KKT);
}
else {
Echo ($KKT);
}
}
if ( kUsia >= 70) {
$kUsia = 0.2
if ( $k == "perempuan" ) {
$Basal = $BBI * 25 ;
$KKT = $Basal + ($Basal * $AF) - ($Basal * $kUsia);
Echo ($KKT);
}
elseif ( $k == "laki-laki" ) {
$Basal = $BBI * 30 ;
$KKT = $Basal + ($Basal * $AF) - ($Basal * $kUsia);
Echo ($KKT);
}
else {
Echo ($KKT);
}
}
?>
the one that I want to be showed on my android app is $KKT need your help, thanks before and sorry for my bad english
You want to create a web service that feeds the response in some known format to the requesting device (usually xml or json). Then an android app will make a call to that web service and display the result.
If my understanding is correct about your question. You are looking for this.
To integrate your application with the server, You should call an API
. Here is the link to start with Json tutorial and Json Quick Reference Guide
And here is the example to integrate the android application with your web service.
Happy coding.