Learning and development Android--eclipse basic configuration and examples
Source: Internet
Author: User
<span id="Label3"></p><p><p>Today we are going to complete a small program of our OWN.</p></p><p><p>first, open Eclipse for a basic Configuration.</p></p><p><p>Open the eclipse-->window-->preferences to configure common Helpers.</p></p><p><p></p></p><p><p>The first is the font, now write the program when the font size, in order to protect the Eyes.</p></p><p><p></p></p><p><p>Then we show the line Number.</p></p><p><p></p></p><p><p>Next is the Java entry, which, according to personal habits, configures the format to Become.</p></p><p><p></p></p><p><p>My personal habits, such as Curly braces, another line, one row for each statement, and so On.</p></p><p><p></p></p><p><p>then, the label to line wrapping, set the inside of the Maximun line width, This property is: if the current width of each row entered a preset value is automatically wrapped, adjust the width according to personal habits. I'm used to it.</p></p><p><p>A method or statement writes a line, so the settings are Larger.</p></p><p><p></p></p><p><p>Once modified, rename the profile NEMA and click Apply,ok to complete the SETUP.</p></p><p><p>The next setup is more Practical.</p></p><p><p></p></p><p><p>In auto activation triggers for java, The default value is ".", in which we add the English letter Abcdefg......xyz. From A to z, we all need to be comfortable, and that's the role</p></p><p><p>When we write the program, each time you type the first English letter, you will be prompted to enter the keyword, very useful.</p></p><p><p>When the above basic configuration is complete, we start the first Applet.</p></p><p><p>first, Create a new Android application, which we named 1. Buttondemo.</p></p><p><p>Package name, We create a self-contained packages, so the name is to be separated from other packages, go to a name, my keywords are joker.</p></p><p><p>Then select the SDK minimum version, the program SDK and other information, then the next .... Until Finished.</p></p><p><p></p></p><p><p>After the creation is complete, we select the Android version in the upper right corner of the WINDOW.</p></p><p><p></p></p><p><p>Then choose the style of the Screen.</p></p><p><p></p></p><p><p>Clicking on the preview all Screens will show all the screen styles and choose a development that you like.</p></p><p><p>next, We drag a button control to come IN.</p></p><p><p>Then click on the XML tag below.</p></p><p><p></p></p><p><p>This is the generated tag Code. We see a wavy hint under text, which is because the current button displays the name "button" that was written here to Die.</p></p><p><p>We can also write the contents of this display in the values folder, convenient for later development, such as different language version of the program, change it is very convenient.</p></p><p><p>We will write the contents of this display in the String.xml file.</p></p><p><p></p></p><p><p>I named this new string btn_1, with the value "point me". then, go back to the Activity_main.xml interface and change the value of text to "@string/btn_1".</p></p><p><p>On the back of the display screen, the name of the button becomes "point me".</p></p><p><p></p></p><p><p>next, we add an event for the Button.</p></p><p><p>first, define a button in mainactivity.java, private button BTN1 = null;</p></p><p><p>Then register this button in the OnCreate event, the OnCreate event is the first event that runs when the program runs, and we can change the first running. Java file in Androidmainfest.xml.</p></p><p><p></p></p><p><p>In the activity tab, which is the first run of the registered file, we can copy it out and give the NEW. Java name, then remove the <intent-filter> tag from the previous label, which means</p></p><p><p><intent-filter> tags in which activity, which. Java files are the first to be Run.</p></p><p><p>The Continue button Event.</p></p><p><p>OnCreate Event Registration found button: BTN1 = (button) Findviewbyid (r.id.btn1);</p></p><p><p>Bind event for Button: Btn1.setonclicklistener (listener);</p></p><p><p>Our named event name is listener, which implements the following methods:</p></p><p><p>Private Onclicklistener listener = new Onclicklistener ()<br>{<br>@Override<br>public void OnClick (View V)<br>{<br>Toast.maketext (mainactivity.this, "you ordered button 1", toast.length_long). show ();<br>}</p></p><p><p>In this way, we have completed a click button that pops up a hint of such a program.</p></p><p><p>Today first recorded here, the next development process I will slowly record, I hope and share with you can progress Together.</p></p><p><p></p></p><p><p>Learning and development Android--eclipse basic configuration and examples</p></p></span>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service