Sabtu, 19 Oktober 2013
Browse Manual »
Wiring »
3
»
android
»
application
»
egypt
»
hello
»
simple
»
3 simple Hello Egypt Android Application
1 - The first step is to open Eclipse IDE like the image :
Eclipse
2- it should look like that - if its open in another view its ok
3 - then we create a new project follow that in order :
File > New Project >Android Application Project
and then press:
Next
4- then do like the following Image :
and follow :
Next> Next > Next > Finish
and in the next articles will will told you all about these elements
5- the application will be created with the name that we provide in the last step
6- Here we just created a new project
then select
Hello World
thats in the middle of the screen and then press
Delete
3 simple Hello Egypt Android Application
3-Our first Android Application will be - Hello Egypt
Hello Egypt :)
Hello Egypt :)
<> the application will be a basic application that contains a textview that just view "Hello Egypt" when pressing a button
---------
you should have :
Eclipse
and the Android SDK also and its connected with Eclipse IDE
and the Android SDK also and its connected with Eclipse IDE
note : if you want to download them please refer to the last articles
of Android prerequisites
1 - The first step is to open Eclipse IDE like the image :
Eclipse
2- it should look like that - if its open in another view its ok
it should be based on the user that uses it
Learn Android |
3 - then we create a new project follow that in order :
File > New Project >Android Application Project
Learn Android |
and then press:
Next
4- then do like the following Image :
Learn Android |
and follow :
Next> Next > Next > Finish
Learn Android |
and in the next articles will will told you all about these elements
5- the application will be created with the name that we provide in the last step
Learn Android |
6- Here we just created a new project
then select
Hello World
thats in the middle of the screen and then press
Delete
7- Then select :
TextView , Button
and just do like the following image
TextView , Button
and just do like the following image
Learn Android |
8-then press on the like the previous image
activity_main.xml
Learn Android |
i will told you about all that code in the coming articles
the important element is :
Id
thats we will use on the code
9- then select
src > MainActivity.java
and write the code like the following image :
Learn Android |
package com.example.helloegypt;
import android.app.Activity;
import android.os.Bundle;
import com.example.helloegypt.R;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends Activity {
TextView txt;@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn = (Button)findViewById(R.id.button1);
txt = (TextView)findViewById(R.id.textView1);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
txt.setText("Hello Egypt".toCharArray(),0,"Hello Egypt".length());
}
}); }
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}10- after doing the last step and write all the code save the work (you can use the short cut CTRL+S )and run the application using the Emlator like the following image :
Learn Android |
and it should be like that :) and Happy Time
Learn Android
I hope that it was clear for you . if need any questions just leave a comment :)
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar