0
My part of php I believe is working. I don’t know how to get this data to Android. How can I do? I need to pass the name data,message,lat,long for some variable on android.
Part in Php:
$sql = $dbcon->query("SELECT * FROM mensagem
INNER JOIN usuarios ON mensagem.idUsuarios = usuarios.idUsuarios
");
foreach ($sql as $value) {
//$sql = $value['mensagem'];
echo $value['nome'];
echo "<br>";
echo $value['mensagem'];
echo "<br>";
echo $value['lat'];
echo "<br>";
echo $value['long'];
echo "<br>";
}
?>
Part on Android:
package mundosenai.mundosenai.com.mundosenai;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import android.content.Intent;
import android.widget.Button;
public class MapsFragment extends SupportMapFragment implements OnMapReadyCallback {
private GoogleMap mMap;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getMapAsync(this);
}
double lat;
double longi;
String mensagem;
String nome;
@Override
public void onMapReady(GoogleMap map) {
LatLng MinhaLocalizacao = new LatLng(lat, longi);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(MinhaLocalizacao, 3));
}
}
I’m novice in php and android, could show me how I do it?
– Marcos Kropp
@Marcoskropp I put some references to you to better understand. Read this article and you will learn more: http://mariohercules.blogspot.com.br/2012/04/utilizando-mysql-e-php-para-gerar-json.html
– viana
@Marcoskropp we are already in contact! Questions can be taken from here. And I’m also in my job, I can only answer when there’s some time left.
– viana
So, I do not know how to make the code, the way I did I can receive the data from the Database, but I do not know how to return it to Android, and I need to return this data to Mapsfragment which is all different from other.
– Marcos Kropp