Articles

Tuto Android : Peupler un Spinner à partir d'une base Mysql à l'aide de web Service REST (php, json)

Peupler un Spinner à partir d'une base Mysql à l'aide de web Service REST (php, json) Dans un précédent tutoriel nous avons appris à insérer des données dans une base distante à travers une application android. Dans ce tuto on va apprendre à peupler un Spinner à partir d'une base Mysql externe. Tout d'abord nous devons avoir un logiciel qui contient un serveur web apache et un SGBD mysql. Parmi ces applications on trouve : WAMP  ou EasyPHP.  Ou vous pouvez tout simplement utiliser un serveur distant. La première étape consiste à créer sa base de données. Dans notre cas notre base s'appelle culture qui contient une table qui s'appelle plante. CREATE TABLE `plante` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `nom` varchar(30) COLLATE latin1_general_ci NOT NULL,   `nature` varchar(30) COLLATE latin1_general_ci NOT NULL,   PRIMARY KEY (`id`) ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=12 ; Par la s

Android Tutorial: Geolocation of the user's phone on a GoogleMap V2 through a Marker

Image
Geolocation of the  phone on a GoogleMap In a previous tutorial we learned how to integrate Google Maps V2 in an application. This article is a continuation of the previous tutorial and could be performed only after completing the work presented in this tutorial:  Integrating Google Map V2 in an Android app with Android Studio  . Now after integrating the Map. we will learn : how to geo-locate the user's device on the Map through a marker.  To geo-locate the user we must implement the interface OnLocationListener. The code of our activity will explain better: public class Map extends AppCompatActivity implements LocationListener{ LocationManager l; GoogleMap gMap; Marker marker; String providerFine; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); gMap = ((MapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap();

Android Tutorial: integrating Google Map V2 in an Android app with Android Studio

Image
Integrating Google Map V2 in an Android  If you want to include Google Maps V2 in your Android  app using Android Studio,you must follow  steps below: 1. In your SDK Manager, make sure that the Google Play Services is installed. 2. To get your MAP key   from Google console, you must have the SHA1 key to your IDE (Android Studio). You must use the following command in your command prompt: (this command line must be executed in the" /bin" folder of the JDK used by Android Studio).  keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android Note the SHA1 key provided. It is needed later. 3. Create a new project. 4. Now you have to get a free API key to your application. Sign in Google Developers Console API:  https://console.developers.google.com . Click the Create Project button. Next, you need  enabling   Google Maps  v2  API  for Android  Click afterwards on "credentials"