JSON In Browser Client Side Task (Android Application)After the server side is ready and tested, now we’ll create an android application that will create a http request to PHP script that we’ve created previously to get all application data and display the data in a list view. In order to display all of data like application title, total downloads, rating and icon, we must create a custom adapter for the list view.Open your Eclipse IDE and create new android application. Use JsonDemo as the project’s name.Do the following step by step to create the application.
Script PHP Menampilkan Table Data Dari Database. Untuk menampilkan data biasanya menggunakan kode HTML yang diselipkan Script PHP. Kali ini kita akan menampilkan data buku dalam bentuk tabel yang sederhana. Langkah pertama yang kita lakukan adalah membuat koneksi ke database MySql.
Create Main Layout FileThis file is an xml layout file that defines the main user interface. It contains a list view that will display all of the application data.Save below source code as /res/layout/activitymain.xml. Create Custom List View Layout FileThis file is an xml layout file.
It responsibles to define a custom view the list view that is contained in the main layout. This file will be used in the custom adapter that will be defined later.
The layout contains 3 TextView and 1 ImageView. The image view is used to display the application icon. It is placed on the left. First text view is used to display application’s title. It is placed on the right of the icon. Second text is used to display application’s rating.
It is placed on the bottom application’s title. The last text view is used to display the application’ total download.Save below source code as /res/layout/appcustomlist.xml.
If ($POST)// username and password sent from form$myusername = $POST'username';$mypassword = md5($POST'password').dan jangan lupa untuk membuat password di phpmyadmin (database) menjadi md5. Bisa menggunakan tool ini.atau bisa juga membuat md5 dengan cara mengedit data sebelumnya.12Demikian Cara Membuat Login PHP Sederhana menggunakan php dan mysql database.
Pada tulisan sebelumnya kita sudah membahas bagaimana cara kembali kehalaman sebelumnya setelah melakukan login.Source code bisa di download disini.