Posts

Showing posts from April, 2017

Android - Google Maps

Android allows us to integrate google maps in our application. You can show any location on the map , or can show different routes on the map e.t.c. You can also customize the map according to your choices. Google Map - Layout file Now you have to add the map fragment into xml layout file. Its syntax is given below − <fragment android:id = "@+id/map" android:name = "com.google.android.gms.maps.MapFragment" android:layout_width = "match_parent" android:layout_height = "match_parent" /> Google Map - AndroidManifest file The next thing you need to do is to add some permissions along with the Google Map API key in the AndroidManifest.XML file. Its syntax is given below − <!--Permissions--> <uses-permission android:name = "android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name = "android.permission.INTERNET" /> <uses-permission android:name = "c...

Android - Text To Speech

Android allows you convert your text into voice. Not only you can convert it but it also allows you to speak text in variety of different languages. Android provides  TextToSpeech  class for this purpose. In order to use this class, you need to instantiate an object of this class and also specify the  initListnere . Its syntax is given below − private EditText write ; ttobj = new TextToSpeech ( getApplicationContext (), new TextToSpeech . OnInitListener () { @Override public void onInit ( int status ) { } }); In this listener, you have to specify the properties for TextToSpeech object , such as its language ,pitch e.t.c. Language can be set by calling  setLanguage()  method. Its syntax is given below − ttobj.setLanguage(Locale.UK); The method setLanguage takes an Locale object as parameter. The list of some of the locales available are given below − Sr.No Locale 1 US 2 CANADA_FRENCH 3 GERMANY 4 ITALY 5 JAPAN 6 CHINA O...

Android web view

WebView is a view that display web pages inside your application. You can also specify HTML string and can show it inside your application using WebView. WebView makes turns your application to a web application. In order to add WebView to your application, you have to add  <WebView>  element to your xml layout file. Its syntax is as follows − <WebView xmlns:android = "http://schemas.android.com/apk/res/android" android:id = "@+id/webview" android:layout_width = "fill_parent" android:layout_height = "fill_parent" /> In order to use it, you have to get a reference of this view in Java file. To get a reference, create an object of the class WebView. Its syntax is − WebView browser = (WebView) findViewById(R.id.webview); In order to load a web url into the WebView, you need to call a method  loadUrl(String url)  of the WebView class, specifying the required url. Its syntax is: browser.loadUrl("http://www.tu...

Android sensors

Most of the android devices have built-in sensors that measure motion, orientation, and various environmental condition. The android platform supports three broad categories of sensors. Motion Sensors Environmental sensors Position sensors Some of the sensors are hardware based and some are software based sensors. Whatever the sensor is, android allows us to get the raw data from these sensors and use it in our application. For this android provides us with some classes. Android provides SensorManager and Sensor classes to use the sensors in our application. In order to use sensors, first thing you need to do is to instantiate the object of SensorManager class. It can be achieved as follows. SensorManager sMgr; sMgr = (SensorManager)this.getSystemService(SENSOR_SERVICE); The next thing you need to do is to instantiate the object of Sensor class by calling the getDefaultSensor() method of the SensorManager class. Its syntax is given below − Sensor light; light = sMgr.getD...

Andorid PHP mySql

Creating Database MYSQL database can be created easily using this simple script. The  CREATE DATABASE  statement creates the database. <? php $con = mysqli_connect ( "example.com" , "username" , "password" ); $sql = "CREATE DATABASE my_db" ; if ( mysqli_query ( $con , $sql )) { echo "Database my_db created successfully" ; } ?> Creating Tables Once database is created, its time to create some tables in the database. The  CREATE TABLE  statement creates the database. <? php $con = mysqli_connect ( "example.com" , "username" , "password" , "my_db" ); $sql = "CREATE TABLE table1(Username CHAR(30),Password CHAR(30),Role CHAR(30))" ; if ( mysqli_query ( $con , $sql )) { echo "Table have been created successfully" ; } ?> Inserting Values in tables When the database and tables are created. Now its time to inser...