1. Create new >> project >>android project klik next
2. Beri nama project : HelloWorld
3. Pilih create new project in workspace
4. Checklist BuildTargetnya misal Android 1.6
5. Aplication name : hello, world
6. Package : com.example.helloworld
7. Create Activity : HelloWorld
2. Beri nama project : HelloWorld
3. Pilih create new project in workspace
4. Checklist BuildTargetnya misal Android 1.6
5. Aplication name : hello, world
6. Package : com.example.helloworld
7. Create Activity : HelloWorld
package com.example.helloworld;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HelloWorld extends Activity {
/** Called when the activity is first created. */
@Prima
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello World!");
setContentView(tv);
}
}
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HelloWorld extends Activity {
/** Called when the activity is first created. */
@Prima
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello World!");
setContentView(tv);
}
}
9. Klik kanan pada project > Run As > Android Application
10. Tampilannya adalah seperti berikut:
Semoga bermanfaat...
Numpang iklan::
Tidak ada komentar:
Posting Komentar