Wednesday, 7 March 2012

Android Default Application


First Sample Application in Android:
==========================

SampleApp
*assets
*bin
   ->classes
-->>(java classes)
   ->res
-->>(resources)
   ->classes.dex
   ->resources.ap_
   ->SampleApp.apk
*gen
   ->com
-->>sampleapp
--->>>R.java
*res
   ->drawable-hpdi
   ->drawable-lpdi
   ->drawable-mpdi
   ->layout
-->>main.xml
   ->values
-->>strings.xml
*src
   ->com
-->>sampleapp
--->>>SampleAppActivity.java
-.classpath
-.project
-AndroidManifest.xml
-progaurd.cfg
-project.properties


****************SampleAppActivity.java***********

package com.sampleapp;

import android.app.Activity;
import android.os.Bundle;

public class SampleAppActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.main);
    }
}

*************AndroidManifest.xml*************

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.sampleapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="7" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".SampleAppActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

*******************main.xml*********************

Each and every component and the layout design is defined in this file.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />
</LinearLayout>


********************strings.xml*****************

Handles all the strings used in the project. (similar to messages.properties)

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="hello">Hello World, SampleAppActivity!</string>
    <string name="app_name">SampleApp</string>

</resources>


***********project.properties*******************

This is a Version Control Systems.

# Project target.
target=android-7


******************progaurd.cfg******************


No comments:

Post a Comment