Saturday, November 5, 2011

Android Tutorial Communication with Server using Http step 4

In the example above, if we save the file login.php in our notebook computers in the directory atatu htdoc / android

then replace

private String url = "http://agusharyanto.net/android/login.php";

can be replaced with

private String url = "http://10.0.2.2/android/login.php";

or replace with the url server where we store the file login.php

4. Edit File AndroidManifest.xml

xml version="1.0" encoding="utf-8"?>
02<manifest xmlns:android="http://schemas.android.com/apk/res/android"
03package="com.agus.android.http"
04android:versionCode="1"
05android:versionName="1.0">
06<application android:icon="@drawable/icon" android:label="@string/app_name">
07<activity android:name=".MainActivity"
08android:label="@string/app_name">
09<intent-filter>
10<action android:name="android.intent.action.MAIN" />
11<category android:name="android.intent.category.LAUNCHER" />
12intent-filter>
13activity>
14
15application>
16<uses-permission android:name="android.permission.INTERNET">
17uses-permission>
18<uses-sdk android:minSdkVersion="7" />
19manifest>

Because here we are communicating with the server (usually using the Internet) then we must add

5. All the code is completed, it is time we Run Project.

Fill Users with agus and password with the android and click Login button, the Server will accept our input data and answered our request to send data "Kearena User and Password correctly then the server will respond with" Login Success "




















We'll try again by filling in the User with Joko and passwords with abcd, then click the login button "Because the User and Password wrong" then the server will answer "Login Fail, User and Password Wrong".





















One more weapon we are to build great applications have increased. In this article I focus on it for basic communication to the server by using the Http Get method. Logically if we can successfully access the existing PHP files in server, means we can also access the MySQL database through PHP files of course. Well if dah can access the database in server, we have the ability to create applications that are classy ya.

If just starting to learn android encouraged to read the tutorial

Simple Android application - Calculate Area of ​​Rectangle
Hopefully Helpful

0 komentar:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Lady Gaga, Salman Khan