Skip to main content

Posts

Showing posts from September, 2011

Horizontal Progress Bar in Android

In your Main Activity:

Ratingbar with ToggleButton example in ANDROID

create ANDROID project with this structure : in your main layout : in your main Activity :

Get IMEI, Phone Number, and SIM information of ANDROID Phone

Use this code for get all information O/P: (in emulator) in Android Phone :

Get IP Address of Host in ANDROID

1 ) First In androidmanifest.xml file give the permission of internet given below :      <uses-permission android:name="android.permission.INTERNET"></uses-permission> 2) Go to res/layout/main.xml :     3 ) Go to Acitivity :- 

Check Internet connection in your Android Device and AVD

 For many application, you have to check internet connection in emulator or in handset. First In androidmanifest.xml file give the permission of internet given below :      <uses-permission android:name="android.permission.INTERNET"></uses-permission>     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE">     </uses-permission>     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE">    </uses-permission> Now add Internet Connection code given below : 

Custome Listview with Hashmap in ANDROID

1) Go to res/Lauout/main.xml :- 2) Now Nextgot o res/Layout/row.xml :- 3) Now go to main Activity:- 

How Create AVD for Samsung Galaxy Tab

1. Open the Android AVD and SDK Manager  2.  Select Available Packages in the left panel of AVD Manager. 3.  Click “Add ADD-on Site” and enter the URL below. http://innovator.samsungmobile.com/android/repository/srepository.xml   4. Check Samsung GALAXY Tab Add-on packages and click install button. 5. Check Samsung GALAXY Tab Add-on license & Click install button. 6) After downloading and installation of GALAXY Tab Add-on, you should restart ADB (Android Debug Bridge) or Eclipse. The important specs of this device, from an Emulator perspective, are: Target platform: Android 2.2, Galaxy Tab Screen Info: High Density, despite the fact that it’s not, this is what it reports, WSVGA (1024×600) No keyboard Has dual cameras Let’s create an AVD configuration called GalaxyTab: Within Eclipse, launch the Android SDK and AVD Manager Select “Virtual Devices” from the left-hand options Click the “New” button to create a new AVD configuration Name the AVD: “Gal

Connecting mysql Database in ANDROID using PHP & JSON

 To implement this tutorial you should have basic knowledge of how to run PHP script and start server.  If we talk about client-server architecture, client is Android device and in server side there is a combination of PHP Script and MySQL. In short, PHP Script sits in middle as shown in image. Lets suppose that we have a MySQL database named Employee, and a table int created, with the following SQL: CREATE TABLE `employee` (   `emp_id` int(11) NOT NULL auto_increment,   `emp_name` varchar(100) NOT NULL,   PRIMARY KEY  (`emp_id`) ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; The PHP code will be very simple: Now Create Android Project :  The Android part is only a bit more complicated: -use a HttpPost to get the data -convert response to string -parse JSON data in to List In Your First Activity : O/P :

JSON parsing in ANDROID (simple example)

JSON String private String jString = "{\"menu\": {\"id\": \"file\", \"value\": \"File\", \"popup\": " + "{ \"menuitem\": [ {\"value\": \"New\",   \"onclick\": \"CreateNewDoc()\"}, " + "{\"value\": \"Open\", \"onclick\": \"OpenDoc()\"}, {\"value\": \"Close\", " + "\"onclick\": \"CloseDoc()\"}]}}}"; Use this code to parsing JSON. out put of this code :

How Hide Keyboard in your Apps

Create your layout: In Your first Activity : 

Custom Grid View

This example shows  custom   Grid View, have a ImageView and TextView in each grid like this:  1) Create a  folder  /res/drawable to hold the different  pictures . 2)  Modify main.xml to have a   GridView :  <?xml version="1.0" encoding="utf-8"?> <GridView xmlns:android="http://schemas.android.com/apk/res/android"          android:layout_width="fill_parent"  android:id="@+id/gridView1"  android:layout_height="fill_parent" android:horizontalSpacing="5px" android:verticalSpacing="5px" android:stretchMode="columnWidth" android:columnWidth="60px" android:numColumns="3" android:gravity="center" /> Now, 3)   Implement mygrid.xml in folder /res/layout/, it's the layout of individual grid.  <?xml version="1.0" encoding="utf-8"?>  <LinearLayout    android:id="@+id/linearLayout1"   android:layout_widt

How to Support Multiple Screens in ANDROID

A sample application that shows how to use resource directory qualifiers to show different resources to different screen configurations. create application in res folder create new folder for layout name layout-land . in res/layout/main.xml in res/layout-land/main.xml also add in your Androidmanifest.xml file check output in different size screen  1. Android 2.2 Skin : WVGA  -> when screen is portrait -> when screen is landscape 2. Android 2.3.3 Skin : WVGA854 -> when screen is landscape - > when screen is portrait it is also tested in Android 2.2 skin HVGA

how create emulator for android OS 3.1

Open your Android SDK and AVD Manager. fill this details in to all fields. create AVD for android 3.1