Ok, we can begin to approach with Android. Because without approximation, we can not wholeheartedly love Android. hehehehe
I mean the approach is to try to make the most basic program in Android. That shows the character Hello Droid. Usually the programmer always tries to determine the character of Hello World! every time they try a new programming language they know. But I tried to replace it with Hello Droid (biz already bored the same Hello world, hehehehe).
Okay, first of all run the Eclipse application. Then select the menu File -> New -> Project. Will display the New Project window, select Android -> Android Project -> Next. Next fill in the Project Name field with HelloDroid (can be replaced, remember do not put spaces). Fill in the Application Name to Hello Droid (can be replaced), Package Name with com.example.hellodroid (can be replaced but follow the rules of writing package as in java) and CreateActivity with HelloDroid (can be replaced but still no spaces). On the Build Target select the platform that will be used (eg 1.6) and then click Finish.
After that we can get into the writing of source code (source code). Expand project HelloDroid -> src -> com.example.hellodroid. There we can find HelloDroid.java file, double click so that we can edit it on a worksheet Eclipse. Replace the writing source code HelloDroid.java be as below:
package com.example.hellodroid;
public class HelloWorld 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, Droid!");
setContentView(tv);
}
}
and After that, save by pressing CTRL + S on the keyboard. To view the results or output of the program we have written, select the menu Run -> Run, and select Android Application. After that will come the Android emulator. Wait a few seconds or minutes, because as we light the real Android phones that takes time to boot.
Tidak ada komentar:
Posting Komentar
Pesan tidak boleh bersifat sara dan di harapkan sopan