Tuesday, 17 September 2013
Sunday, 1 September 2013
NEED TO KNOW BEFORE INSTALLING ANDROID SDK
BEFORE YOU INSTALL ANDROID SDK YOU MUST BE AWARE OF THE SYSTEM REQUIREMENTS.HERE ARE THE SYSTEM REQUIREMENTS l
Supported Operating Systems
- Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)
- Mac OS X 10.5.8 or later (x86 only)
- Linux (tested on Ubuntu Linux, Lucid Lynx)
- GNU C Library (glibc) 2.7 or later is required.
- On Ubuntu Linux, version 8.04 or later is required.
- 64-bit distributions must be capable of running 32-bit applications.
Other development environments
- JDK 6 (JRE alone is not sufficient)
- Apache Ant 1.8 or later
- Not compatible with Gnu Compiler for Java (gcj)
Note: Some Linux distributions may include JDK 1.4 or Gnu Compiler for Java, both of which are not supported for Android development.
ANDROID SDK BUNDLE
IT IS BETTER TO INSTALL ANDROID SDK BUNDLE AS IT COMES WITH ECLIPSE AS WELL SO YOU DO NOT NEED TO INSTALL IT SEPRATELY
HOW TO ADD STRING ARRAY IN ANDROID APPLICATION
YOU CAN STORE YOUR DATA IN STRINGS.XML FILE.YOU CAN ADD YOUR DATA IN THAT FILE BY DECLARING ARRAY.YOU CAN DO THAT BY USING GUI AS WELL OR YOU CAN JUST ADD FOLLOWING CODE IN YOUR STRINGS.XML FILE.
HERE IS HOW YOUR STRINGS.XML FILE LOOKS LIKE BY DEFAULT
<?xml version="1.0" encoding="utf-8"?>NOW SUPPOSE WE WANT TO STORE DAYS NAME IN THIS FILE.WE NEED TO WRITE FOLLOWING CODE
<resources>
<string name="app_name">Days</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
</resources>
<string-array name="days">
<item >MONDAY</item>
<item >TUESDAY</item>
<item >WEDNESDAY</item>
<item >THURSDAY</item>
<item >FRIDAY</item>
<item >SATURDAY</item>
<item >SUNDAY</item>
</string-array>
HOW TO ADD LISTVIEW IN ANDROID ACTIVITY
1.CREATE A NEW ANROID APPLICATION PROJECT
2.GIVE A NAME TO YOUR APPLICATION
2.GIVE A NAME TO YOUR APPLICATION
3.ADD A LISTVIEW FROM COMPOSITE
4.NOW YOUR ACTIVITY_MAIN.XML CODE WILL LOOKE LIKE FOLLOWING AFTER ADDING LISTVIEW
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
</ListView>
</RelativeLayout>
5.NOW WE NEED TO SHOW DATA IN LISTVIEW ITEMS SO FOR THAT WE NEED TO CREATE STRING ARRAY.SO FOR THAT YOU NEED TO OPEN STRING FILE(res/values/strings.xml).IT WILL LOOK LIKE FOLLOWING
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">ListView Demo</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
</resources>
6.NOW WE WILL ADD STRING ARRAY IN THAT SO WHERE WE CAN STORE OF LISTVIEW ITEM DATA.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">ListView Demo</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string-array name="COUNTRY">
</string-array>
</resources>
HERE WE HAVE CREATED COUNTRY ARRAY WHERE WE WILL STORE OUR DATA
7.NOW WE WILL ADD OUR DATA INTO LISTVIEW
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">ListView Demo</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string-array name="COUNTRY">
<item >AUSTRALIA</item>
<item >NEW ZEALAND</item>
<item >USA</item>
<item >CANADA</item>
<item >INDIA</item>
</string-array>
</resources>
AFTER ADDING ALL THE DATA OUR STRINGS.XML FILE WILL LOOK LIKE THIS.SAVE THE PROJECT AND RUN IT.YOU WILL SEE ALL THE COUNTRIES IN A LISTVIEW.
Subscribe to:
Posts (Atom)