3- simple Hello Egypt Android Application :)

Thursday, October 11, 2012

   3-Our first Android Application will be  - 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
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

learn Android





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
Learn Android



3 - then  we create a new project follow that in order :

File > New Project >Android Application Project




learn Android
Learn Android
 
 
 
 
 
 
 
 
 
 
 
 

and then press:
Next
4-   then  do like the following Image :

learn Android
Learn Android
 
 
 
 
 
 
 
 
 
 
 
 


and follow :

Next> Next > Next > Finish


learn Android
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
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



learn Android
Learn Android




8-then   press  on  the like the previous image
activity_main.xml

learn Android
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
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
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 :)



 



learn Android

Monday, October 8, 2012


Here we will provide you with  free and effective courses  for  mobile applications development  and we will start this  with  Android course  so  follow  us and be a mobile application developer  :D