Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Tutorial Android Programming


1 reply to this topic

#1 retry56

    Newbie [Level 2]

  • Kontributors
  • PipPip
  • 30 posts
  • Gender:Male
  • Location:Pontianak
  • myCENT:87.73

Posted 02 March 2011 - 06:28 AM

Level: Easy
Material: - Using EditText, Button, TextView, String to Integer conversion with parseInt, conversion String with toString.

Posted Image


1. Open Eclipse [/ b], create a new project adjusted as shown below:
Spoiler

2. Click Finish, on the left hand side go into the folder layout select main.xml [/ b]
Spoiler

3. That we will create is to make 2 widgets EditText [/ i] as input integer, 4 Button [/ i] for the +, -, *, / and a TextView [/ i] for displays the results of the calculation.
Spoiler

4. After setting the display main.xml , now set the code to hook Main.java with main.xml . Open Main.java .

5. The first do is create a variable of each widget that we have created is [i] Button
, [i] EditText
and [i] Textview
. Create a variable like the following code:
Spoiler

7. After adding [b] setOnClickListener
do not forget to implement [b] OnClickListener [/ b].
Spoiler

8. Then create the function [b] onClick
for the button can be clicked.
Spoiler

In the above code we first create an integer variable one and two. Because the input of [i] EditText [/ i] form of String so it must be converted to integer with parseInt. Use the switch to set any button to be clicked in accordance +,-,*,/. button Before showing the results of the calculations, it should change back the results of the calculations in the form of an integer to a string by toString ();.

Posted Image


Edited by retry56, 02 March 2011 - 06:35 AM.


#2 darko100

    Advanced Member

  • Kontributors
  • PipPipPipPipPipPipPip
  • 117 posts
  • Gender:Male
  • myCENT:31.51

Posted 11 August 2011 - 11:44 PM

First advice that you need Android SDK installed , Java installed , Eclipse installed , Android SDK platforms downloaded.

Also you will need to set up where is your Android SDK located , to make PATH=Java location , to select a Android SDK (for example 2.3) platform.

http://www.makeuseof...id-application/ I would suggest this tutorial which explains everything which can be pain-in-the-*bottom* if you don't follow tutorials and just view the android.com one :D

PS. Why DiskusAndroid.com isn't working? The one advertised on your signature :)




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users