Skip to main content

Android HelloWorld Example


After install android Create New Android Helloworld Application.
1) HelloWorld.java
package co.in.helloworld;

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

public class HelloWorld  extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        System.out.println("Hello World......");
       
    }
}

2) res/layout/main.xml


<?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" /> (We can write own text in between " ")

</LinearLayout>

3) res/values/string.xml(Optional step)


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

    <string name="hello">Hello World, HelloWorldActivity!</string>
    <string name="app_name">HelloWorld</string>

</resources>

4) AndroidManifest.xml


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

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

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

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

</manifest>

5) Run Android Application and Got Output in Emulator.







Comments

Popular posts from this blog

Login Application using Database with dialog demo

Follow Below Steps for make simple login applicaiton in Android using database with Dialog demo. 1)DataBaseDemoActivity.java This file diplay login page and trasfer two edit text data into second activity........  package database.co.in; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; public class DataBaseDemoActivity extends Activity implements OnClickListener {     /** Called when the activity is first created. */     EditText mtxt_email, mtxt_password;     Button mLogin; @Override     public void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.main);         mtxt_email = (EditText)findViewById(R.id.editEmail_id);   ...

Animation Demo in Android(Tween Animation)

This Animation Demo..... Download This Code Click Here...... The view animation framework supports both tween and frame by frame animations, which can both be declared in XML. The following sections describe how to use both methods. Tween animation An animation defined in XML that performs transitions such as rotating, fading, moving, and stretching on a graphic. file location: res/anim/ filename .xml The filename will be used as the resource ID. compiled resource datatype: Resource pointer to an  Animation . resource reference: In Java:  R.anim. filename In XML:  @[ package :]anim/ filename syntax: <? xml version = "1.0" encoding = "utf-8" ?> < set xmlns:android = "http://schemas.android.com/apk/res/android" android:interpolator = "@[package:]anim/ interpolator_resource " android:shareInterpolator = ["true" | "false" ] > < alpha android:fromAlpha = " float " ...

Camara Application in Android(Use Hardware Camara)

hi .... write Following code in your project first create camaratest android project....... this example for take image and view in below image view check it........ and enjoy 1) CamaratestActivity.java   package com.in.test; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.hardware.Camera; import android.hardware.Camera.PictureCallback; import android.hardware.Camera.ShutterCallback; import android.os.Bundle; import android.os.Handler; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; /*  * O@K tech...  */ public class CamaratestActivity extends Activity implements SurfaceHolder.Callback ,OnClickListener { Camera camera; SurfaceView surfaceview;     SurfaceHolder mHolder ;     Button btnSnap; ...