Mostrando entradas con la etiqueta basic. Mostrar todas las entradas
Mostrando entradas con la etiqueta basic. Mostrar todas las entradas

How to do "Hello, Android"?

Ok, this time we are going to learn how to do a tipical "Hello, World!" and emulate it in a virtual Android OS.
The first step its this, when you have installed the SDK and the eclipse plugin we can to start.
Once you have the SDK installed you must link the SDK folder with the Eclipse plugin.
For this, do it:
Press Window>Preference... and then:



(Click for see picture bigger)
Then, create a new Android project and create a new class with any name. The class contains generated code, so i'm going to highlight the new code.
So, this is the code:


package com.example.android.apis;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

public class ApiDemos extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TextView tv = new TextView(this);
        tv.setText("Hello dotNet, from Android");
        setContentView(tv);
      
    }
}


Then you must run it like a "Android aplication" and you'll get something like this:


(Click for see picture bigger)


Ok, this is all for now, if you can any question you can post a comment here, or you can write me at jessanmen1@gmail.com

Cheers!

Read Users' Comments (4)