Wednesday 29 May 2013

Android HTTP Client

Most network-connected Android apps use HTTP to send and receive data.

Android includes two HTTP clients:HttpURLConnection and Apache HttpClient.

For android HttpURLConnection recommended.

Http URL Connection simplifies connections to HTTP servers.
  •  The base class for HTTP network access in the java.net package is the HttpURLConnectionclass.
  •  The preferred way of accessing the Internet according to Google is the HttpURLConnection class,  as Google is focusing their efforts on improving this implementation.
  • HttpURLConnection which is also available in standard Java, is a general-purpose, lightweight HTTP client suitable for most applications.
Getting a connection from a URL
URL url = new URL("http://www.google.com");
HttpURLConnection urlConnection =(HttpURLConnection)url.openConnection();

Reading data
BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
while ((line = in.readLine()) != null) {
doSomethingWith(line);
}

Saturday 18 May 2013

Android Studio Installation Procedure Part2

Here you see more information about the Android Studio.
Opening SDK Manager:

  • Go to tools menu and choose android and choose SDK Manager
Opening AVD Manager
  • Go to tools menu and choose android and choose AVD Manager
now you will sell in following image how to open java files and layout means xml files:


Running Project:

Thursday 16 May 2013

Android Studio Installation Procedure Part1

Required Softwares:

1.JDK 1.6 or Later
2.Android Studio V0.1

you can download above software's from following links:

1.JDK : http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

2.Android Studio : http://developer.android.com/sdk/installing/studio.html

Installation Procedure:

Step1 : Install JDK .
Step2: Install Android Studio ,
  •  Procedure: double click on android-studio-bundle-130.677228-windows.exe
  • and follow the Android Studio installation guide means(just press next and next and finally finish) .
After running Android Studio you will see following wizard.

Creating new Android Project:
  • In the above window choose new project option as follows

  • In the next window give your application details.

  • And now click Next and again click Next and finally click finish and finally the Android Studio IDE looks like as follows



Google released new Android Development IDE called Android Studio

This version Android Studio is called EARLY ACCESS PREVIEW.

Android Studio is a new Android development environment based on IntelliJ IDEA. Similar to
Eclipse with the ADT Plugin, Android Studio provides integrated Android developer tools for
development and debugging. On top of the capabilities you expect from IntelliJ, Android Studio
offers:
  1. Gradle-based build support.
  2. Android-specific refactoring and quick fixes.
  3. Lint tools to catch performance, usability, version compatibility and other problems.
  4. ProGuard and app-signing capabilities.
  5. Template-based wizards to create common Android designs and components.
  6. A rich layout editor that allows you to drag-and-drop UI components, preview layouts on multiple screen configurations, and much more.
For more information visit :http://developer.android.com/sdk/installing/studio.html

Thursday 2 May 2013

Web Services

What is Web service?
  • Web services are client and server applications that communicate over the World Wide Web's(www) HyperText Transfer Protocol(HTTP)

  • As described by the World Wide Web consortium,  web services provide a standard means of  interoperating between software applications  running on a variety of platforms  and frameworks. 
There are two major categories of web services
  1.     SOAP Web Service
  2.     RESTful Web Service
1.Soap Web Service

Simple Object Access Protocol (SOAP) is a standard protocol specification for message exchange based on XML. Communication between the web service and client happens using XML messages. SOAP defines the rules for communication like what are all the tags that should be used in XML and their meaning.

2.RESTful Web Service

RESTful web service uses architectures that use HTTP or similar protocols by restricting the interface to use standard operations like GET, POST, PUT, DELETE for HTTP. RESTful is easier to develop. 

 WSDL

One major component of a web service is Web Services Description Language (WSDL). It is an xml file that describes the web service technically in a machine readable format. That is, using this WSDL file we can understand things like,
  •     Port / Endpoint – URL of the web service (using which we should access it)
  •     Input message format
  •     Output message format
  •     Security protocol that needs to be followed (like https)
  •     Which protocol the web service uses