Sie sind auf Seite 1von 15

(/) let's make Explore(/tag/typeid/) Login(/account/login/) | SignUp(/account/gopro)

Contests(/contest/) Classes(/classes/)

Publish(/about/create.jsp)
(http://www.autodesk.com/)
Featured: RobotsClass(/class/RobotsClass/) Gardening(/howto/gardening/) ForTeachers(/teachers/)

Mother'sDay(/howto/mothers+day+gifts+breakfast+flowers/) advertisement

HowtoCreateanAndroidAppWithAndroidStudio by
TheZachBales(/member/TheZachBales/)insoftware(/tag/typeid/categorytechnology/channelsoftware/)

Download h(/id/HowToCreateAnAndroidAppWithAndroidStudio/) 8Steps .

Collection IMadeit! Favorite Share


advertisement

AboutThisInstructable

License:
8 1,171,454 views
1,759 favorites

TheZachBales
(/member/TheZachBales/)
(/file/F6G6BVPI7MXHO7C/)
Follow 123

(/member/TheZachBales/)
ThistutorialwillteachyouthebasicsofhowtobuildanAndroidappusingthe
MorebyTheZachBales:
AndroidStudiodevelopmentenvironment.AsAndroiddevicesbecome
increasinglymorecommon,demandfornewappswillonlyincrease.Android
Studioisaneasytouse(andfree)developmentenvironmenttolearnon.It's
bestifonehasaworkingknowledgeoftheJavaprogramminglanguageforthis (/id/HowToCreate
tutorialbecauseitisthelanguageusedbyAndroid.Therewon'tbemuchcode
usedinthistutorial,soIwillassumethatyouknowenoughJavatounderstand
orarewillingtolookupwhatyoudon'tknow.Thiswilltakeroughly3060 AnAndroidAppWithAndroidStudio/)
minutes,dependingonhowquicklyyouareabletodownloadandinstallAndroid
Studio.AfterusingthistutorialtocreateyourfirstAndroidapp,you'llbewellon
yourwaytoafunnewhobbyorpossiblyevenapromisingcareerinmobile Related
development.
EnablingDeveloperOptions
onAndroidPhone
Step1:InstallAndroidStudio (/id/EnablingDeveloper
OptionsonAndroidPhone/)
(/id/Enabling byNaveenG15
HowToSetupEclipsefor
AndroidAppDevelopment
(/id/HowToSetupEclipse
forAndroidApp
(/id/HowTo Development/)
YourfirstAndroid
Application(/id/Yourfirst
AndroidApplication/)
byComputothought
HowToRootAnAndroid
Device(/id/HowToRootAn
AndroidDevice/)
byAshishA5
(/id/HowTo (/member/AshishA5/)
CreatinganAndroidappto
communicatethroughAWS
(/id/CreatinganAndroidApp
toCommunicateThrough
(/id/Creating AWS/)

advertisement

(/file/FEBX9MXI7MXG4I1/)

(/file/F4P571QI7MXG4I4/)

1.Gotohttp://developer.android.com/sdk/index.html
(http://developer.android.com/sdk/index.html)todownloadAndroidStudio.
2.UsetheinstallertoinstallAndroidStudiofollowingitsinstructions.

advertisement

Step2:OpenaNewProject
(/file/FIA90KGI7MXG4IA/)

(/file/F1ZVMKJI7MXG4HX/) (/file/F71O9LTI7MXG4NN/)

(/file/FYGIC6BI7MXG4HW/) (/file/FC03WKLI7MXG4I0/)

1.OpenAndroidStudio.
2.Underthe"QuickStart"menu,select"StartanewAndroidStudioproject."
3.Onthe"CreateNewProject"windowthatopens,nameyourproject
"HelloWorld".
4.Ifyouchooseto,setthecompanynameasdesired*.
5.Notewheretheprojectfilelocationisandchangeitifdesired.
6.Click"Next."
7.Makesureonthat"PhoneandTablet"istheonlyboxthatischecked.
8.Ifyouareplanningtotesttheapponyourphone,makesuretheminimum
SDKisbelowyourphone'soperatingsystemlevel.
9.Click"Next."
10.Select"BlankActivity."
11.Click"Next."
12.LeavealloftheActivitynamefieldsastheyare.
13.Click"Finish."
*Note:ItistypicalnamingconventioninAndroidprojectstosetthecompany
nameassomeformof"example.name.here.com".

Step3:EdittheWelcomeMessageintheMainActivity
(/file/FLHQ3QMI7MXG4HY/)

(/file/FG53NYVI7MXG4NP/)

1.Navigatetotheactivity_main.xmltabifitisnotalreadyopen.
2.MakesurethattheDesigntabisopenontheactivity_main.xmldisplay.
3.Clickanddragthe"Hello,world!"fromtheupperleftcornerofthephone
displaytothecenterofthescreen.
4.Intheprojectfilesystemontheleftsideofthewindow,openthevalues
folder.
5.Inthevaluesfolder,doubleclickthestrings.xmlfile.
6.Inthisfile,findtheline"Helloworld!".
7.Afterthe"Helloworld!"message,add"Welcometomyapp!"
8.Navigatebacktotheactivity_main.xmltab.
9.Makesurethatyourcenteredtextnowreads"Helloworld!Welcometomy
app!"

Step4:AddaButtontotheMainActivity
(/file/FE60OS4I7MXG4NQ/)

(/file/FFQTVSVI7MXG4I7/)

1.NavigatetotheDesigntaboftheactivity_main.xmldisplay.
2.InthePalettemenutotheleftofthephonedisplay,findButton(underthe
headingWidgets).
3.ClickanddragButtontobecenteredunderneathyourwelcomemessage.
4.Makesureyourbuttonisstillselected.
5.InthePropertiesmenu(ontherightsideofthewindow),scrolldowntofind
thefieldfor"text."
6.Changethetextfrom"NewButton"to"NextPage."

Step5:CreateaSecondActivity
(/file/F65D7O2I7MXG4I6/)

(/file/FAOI00QI7MXG4K4/) (/file/F9YOCNXI7MXG4ID/)

1.Atthetopoftheproject'sfilesystemtree,rightclickon"app."
2.NavigatethroughtoNew>Activity>BlankActivity.
3.Changethenameofthisactivityto"SecondActivity".
4.Click"Finish."
5.MakesureyouareintheDesignviewofactivity_second.xml.
6.Dragthetextboxintheupperleftofthephonedisplaydowntothecenteras
youdidontheMainActivity.
7.Withthetextboxstillselected,findthe"id"fieldinthePropertiesmenuon
theright,andsetitto"text2".
8.Openstrings.xmlagain.
9.Addanewlineunder"Helloworld!Welcometomyapp!"thatreads
"Welcometothesecondpage!".
10.Navigatebacktoactivity_second.xml.
11.Selectthetextboxagain.
12.InthePropertiespane,setthe"text"fieldto"@string/second_page".
13.Makesurethatthetextboxnowreads"Welcometothesecondpage!"andis
inthecenterofthescreeninthephonedisplay.

Step6:WritetheButton's"onClick"Method

(/file/FGSOB2UI7MXG4I8/)

(/file/FV8RGT0I7MXG4I2/) (/file/F32T387I7MXG4I3/)

1.SelecttheMainActivity.javatabalongthetopoftheworkenvironment.
2.AddthefollowinglinesofcodeattheendoftheonCreatemethod:

Buttonbutton=(Button)findViewById(R.id.button)
button.setOnClickListener(newView.onClickListener(){
@Override
publicvoidonClick(Viewv){
goToSecondActivity()
}
})
3.AddthefollowingmethodtothebottomoftheMainActivityclass:
privatevoidgoToSecondActivity(){
Intentintent=newIntent(this,SecondActivity.class)
startActivity(intent)
}

4.Clickthe+nexttoimportatthethirdlineofMainActivity.javatoexpandthe
importstatements.
5.Addthefollowingtotheendoftheimportstatementsiftheyarenotalready
there:
importandroid.content.Intent
importandroid.view.View
importandroid.widget.TextView

Step7:TesttheApplication

(/file/FKWKMGCI7MXG4I9/)

(/file/FX9AJOJI7MXG4HZ/)

1.ClickthegreenplaysymbolfromthetoolbaratthetopoftheAndroidStudio
window.
2.Whenthe"ChooseDevice"dialogapperas(thismaytakeafewmoments),
selectthe"Lauchemulator"option.
3.ClickOK.
4.Whentheemulatoropens(thistoocouldtakeawhile),theappwill
automaticallylaunchtheappuponthevirtualphonebeingunlocked.
5.Makesurethatallofyourtextdisplayscorrectlyandthatthebuttontakes
youtothenextpage.

Step8:Up,Up,andAway!

(/file/FYRRF0HI7MXG4IB/)

(/file/F2ZDSY1I7MXG4IC/)

Congrats!You'venowcompletedyourfirstAndroidapplicationwithsomebasic
functionality.Yourfinishedappshouldhaveapagegreetingtheuseranda
buttonthattakestheusertoasecondpage.
Fromhereyouhavethecursoryknowledgeyouneedtogoontolearnallthere
istoknowaboutAndroidapplicationdevelopment.
advertisement
Ad
CallCenterSoftware
forthebestCustomerJourneyExperience
XCALLY

Wehaveabenicecommentpolicy.
Pleasebepositiveandconstructive. wIMadeit! AddImages PostComment

pravalive(/member/pravalive) 23daysago Reply

withoutthecompanydetails.can'twecreatetheapp??

kushalk24(/member/kushalk24) amonthago Reply

GuysIhaveagreatideaforanappbutIdon'tknowhowtobuildit.Help
anyone?
mymailkumarkushal71@gmail.com

nnoya(/member/nnoya) amonthago Reply

Hi!Ihaveanidea.aGreatappthatwillbehelpful.butIdon'tknowhowtomake
it(stillthinkinghow).thisapplicationmaybehelpfultothosewhoownmedium
businesses.Idon'tknowwho'stherightpersontodiscussthis.

pleasehelpme.
thankyou:)

pleasesendemail.Thankyou.

n.rey_noya@yahoo.com(mailto:n.rey_noya@yahoo.com)

huz25144(/member/huz25144) 2monthsago Reply

Iwantappmakeaapformywebsitehttp://www.mloot.com,anyadvise?

huz25144(/member/huz25144) . huz25144(/member/huz25144) Reply

2monthsago
Http:www.mloot.com

huz25144(/member/huz25144) . huz25144(/member/huz25144) Reply

2monthsago
Http://mloot.com

phillearnsolutions(/member/phillearnsolutions) . huz25144
(/member/huz25144) amonthago Reply
Hello,wecanmakeanappforyourwebsite.Letmetakethisopportunity
tointroduceourcompanyPhillearnSolutions,asoftwareandtraining
solutionscompanyatanaffordablecost.Youcancontactusat
9030973722orphillearnsolutions@gmail.com.Kindlyforwardyour
contactyourdetails,sothatwecangetintouchwithyou.

huz25144(/member/huz25144) 2monthsago Reply

tricksandhacks987(/member/tricksandhacks987) 2monthsago Reply

CreateanAndroidAppWithAndroidStudio
http://www.tricksandhacks.com/createandroidappw...
(http://www.tricksandhacks.com/createandroidappwithappstudio/)

buki1959(/member/buki1959) 2monthsago Reply

wheniruntheappiamgettingstringtypesnotallowed(at'id'withvalue
'@+id/')errorhelpmefixit

(https://cdn.instructables.com/FSB/CYD1/IZT6T49N/FSBCYD1IZT6T49N.LARGE.jpg)

AmeyaK(/member/AmeyaK) 2monthsago Reply

veryhelpfulforbeginner...!!Thanks

moontechnolabs(/member/moontechnolabs) 2monthsago Reply

ThankyouforposthelpfultutorialforNewcomersuserforAndroiddevelopment
andlearninguser.

AbdulRazzaqB(/member/AbdulRazzaqB) 2monthsago Reply

Error:Failedtofindtargetwithhashstring'android24'in:C:\Android\sdk1

<ahref="install.android.platform">Installmissingplatform(s)andsync
project</a>

howtoresolve

TricksH28(/member/TricksH28) 3monthsago Reply

HowToCreateAnAndroidAppWithAndroidStudio

http://www.tricksandhacks.com/createandroidappw...
(http://www.tricksandhacks.com/createandroidappwithappstudio/)

AshwinA18(/member/AshwinA18) 3monthsago Reply

ithinkyouhavetoupdateyourinstructions,asthelatestversionshavehalfthe
stuffchangedbutotherthanthat,thiswasbrilliant

JonesS5(/member/JonesS5)
AclearguidetodevelopourownAndroidApp 3monthsago Reply

(http://www.credosystemz.com/traininginchennai/best
androidtraininginchennai/)withAndroidStudio.

PavithraM4(/member/PavithraM4) 3monthsago Reply

Thnaksforyourinformativearticle.itsveryuseful.<a
href="http://www.bestandroidtrainingchennai.in/(http://www.google.com/url?
q=http%3A%2F%2Fwww.bestandroidtrainingchennai.in%2F&sa=D&sntz=1&usg=AFQjCNFIq7D_HTwFckyei_ZkSH3BBN
kAQ)">AndroidTraininginChennai</a>

SeanG103(/member/SeanG103) 3monthsago Reply

HiGuys,

Icantseethisbitunderstrings:

Addanewlineunder"Helloworld!Welcometomyapp!"thatreads"Welcome
tothesecondpage!".
Seebelow:

Whatamidoingwrong?

(https://cdn.instructables.com/F55/NX04/IZ6CB3IC/F55NX04IZ6CB3IC.LARGE.jpg)

SUMANTK(/member/SUMANTK) 3monthsago Reply

Itisverygoodwayforappdevelopment

3monthsago Reply
tejaswiTeju(/member/tejaswiTeju)madeit!

Unabletodowmloadthefoolowing.Helpmeout

(https://cdn.instructables.com/FU0/8M49/IYNLN9CG/FU08M49IYNLN9CG.LARGE.jpg)

jasim12(/member/jasim12) 4monthsago Reply

Ialreadyandroidstudioinstalled

jasim12(/member/jasim12) 4monthsago Reply

idont'tknowhowtodevolepapppleaseteachme

Mandy_K(/member/Mandy_K) 4monthsago Reply


MyProjectinRunningEvenAndroidVirtualDeviceispopupbutmyhelloworld
screenisnotshown.....itisshowingjustdefault"android"overthescreen...
pleasehelpmeputhowicanrunmyownprojectscreen...Thanksinadvance

TricksH25(/member/TricksH25) 4monthsago Reply

HowToCreateAnAndroidAppWithAndroidStudio

http://www.tricksandhacks.com/setupeclipseforan...
(http://www.tricksandhacks.com/setupeclipseforandroidappdevelopment/)

ChayH1(/member/ChayH1) 5monthsago Reply

OK,soundacoolwhenIreadaboutstep4:clickanddragbuttons?

ChayH1(/member/ChayH1) 5monthsago Reply

1,674MBfordownloadingtheAndroidStudio...

shahdhruvi(/member/shahdhruvi) 5monthsago Reply

Iamnotabletoseemyappinandroidemulator

VideozS(/member/VideozS) 5monthsago Reply

myemulatordoesn'topen...andafteropenanerrorisVTxandBIOS.blah!
blah!blah!pleasetellmesolutiontoopenmyemulator.

vishalv52(/member/vishalv52) . VideozS(/member/VideozS) Reply

5monthsago
Hey!.

OnWindows,gotoBIOS>advancedsettings>

Thereshouldbeanoptiontoenablevirtualization

Saveandrestartyoursystem

HarshulS(/member/HarshulS) 11monthsago Reply

ididnotunderstandhowtoopenthestrings.xmlpage

MichaelC628(/member/MichaelC628) . HarshulS(/member/HarshulS) Reply

11monthsago
HarshulSthestrings.xmlpagecanbefoundinthefollowing
area:

"project_name"\app\src\main\res\values\strings.xml

Toopenit,justdoubleclickitintheleftpaneofAndroidStudio.

Hopethishelps.

OjoeMDC(/member/OjoeMDC) . MichaelC628(/member/MichaelC628) Reply

10monthsago
Openingthatdoesnotchangecenteredtextforme

Ionlyhadonelineofcodeinthere(otherthan<resources></resources>
anditwas<stringname="app_name">HelloWorld!</string>

DoIhavetoaddtheothers?BecauseItriedthatanditstilldidn'tchange
thecenteredtext.
BinditaJ(/member/BinditaJ) . OjoeMDC(/member/OjoeMDC) Reply

6monthsago
youneedtochangethetextpropertyofthistextboxto
@string/hello_world.Intheproperties,youmightsee2"text"s.Change
theonethathasasmallspannerlikeicon.

stackpop(/member/stackpop) . OjoeMDC(/member/OjoeMDC) Reply

6monthsago
Iamalsoexperiencingthisproblem.IthinkthatAndroid
StudioProjectshasbeenupdatedsincethistutorialwasmade.An
excellenttutorial,justcan'tfollowitexactalystepbystepanymore.

OjoeMDC(/member/OjoeMDC) . stackpop(/member/stackpop) Reply

6monthsago
Yep,imgladtoknowimnottheonlyonewiththisproblem.

MichaelC628(/member/MichaelC628) . stackpop(/member/stackpop) Reply

6monthsago
ThatistrueweareuptoAPI25nowandthisthiswas
writtenwhen21wasthelatestAPI.TruthbetoldtheONLYtimeIbother
withstrings.xml(whichstillisinthesamestructureImentionedabove)is
forthingslikeappnameorstaticmenubartitles.Studiowillcomplain
whenyoubuildtheprojectandsuggestthatyouusethestrings.xmlfile
butwhenyoustartgettingintothreadedappsanddynamiclabelsthe
stringsfileloosesitsusefullnes.

dlcomm(/member/dlcomm) 6monthsago Reply

NotsurewhatversionofAndriodstudioyouareusingbutIhave2.2.2forlinux
installedandhadtoprettymuchusemyownprogrammingskillstomakeanyof
thiswork.:(

MuhammadM197(/member/MuhammadM197) 6monthsago Reply

Iamjustgettingtoknowhowtoprogram,Ineedasamplebuttoncodethat
openinputtedURLonadefaultbrowserandalsoacodethatdisplaywritten
textinanewwindow

TricksH17(/member/TricksH17) 6monthsago Reply

HowToCreateAnAndroidAppWithAndroidStudio

http://www.tricksandhacks.com/createandroidappw...
(http://www.tricksandhacks.com/createandroidappwithappstudio/)

teiladnam(/member/teiladnam) 8monthsago Reply

Ithinkthisisoutofdate.IntheversionofAndroidStudioIdownloadedand
installedtoday,there'sno"BlankActivity"option.Also,thestrings.xmlfileisnot
readilyavailableIhadtolookatanothercommenttoseewhereitwas.Plusthe
"helloworld"stringisn'tinthere.
WhenItrytorunthis,I'mtoldthatandroid.support.design.widgetdoesn'texist...
whichisbewildering,becauseitautomaticallyaddedthatimporttomyJavafile!
Whywoulditdothatifitdoesn'texist?Apparentlythesolutionistoeditthe
Gradlefile,butIdon'tknowwhatthatisanddon'tfeellikefiguringitoutnow.I'm
notsureifthisisrelevanttothetutorialbutIthoughtI'dbringitupjustincase.
LeviJacobC(/member/LeviJacobC) . teiladnam(/member/teiladnam) Reply

7monthsago
DidyoufindamoreuptodatestepbystepguideasI'm
havingthesameissue.

stackpop(/member/stackpop) . LeviJacobC(/member/LeviJacobC) Reply

6monthsago
Iamhavingasimilarissuefollowingthestepbystepguide,I
thinkthey'veswitchedthingsaroundwiththenewestupdate.Exactsame
issuesasteiladnam(https://www.instructables.com/member/teiladnam)is
describing.

DouglasH1(/member/DouglasH1) 2yearsago Reply

Firsttimetrying,IthinktheonlythingIhadtroublewithwasthefactthatIhadto
capitalisetheOinonClickListener.Otherthanthat,perfectfirsttutorial.

setOnClickListener

onClickListenershouldbeOnClickListener

Fomenkof(/member/Fomenkof) . DouglasH1(/member/DouglasH1) Reply

ayearago
Thankyou,somuch!!!

RohanSharmag(/member/RohanSharmag) . Fomenkof(/member/Fomenkof)
6monthsago Reply
https://mcent.com/app/?
mcode=Q08W5K&tcx=WAPP

JimS179(/member/JimS179) . Fomenkof(/member/Fomenkof) Reply

11monthsago
yupyupYup!,,,metoo.Thistookmeacouplehoursto
identifyuntil
Ireadthiscommentthenitfixedmerightandremovedtheredonthis.
ThanksforbuttoningitupDouglasH1

Overallgreatinstructable.Ilearned!

sharadkapil(/member/sharadkapil) 7monthsago Reply

Thanksforthisarticle,

Ihavefollowedallsteps...

oncompilationIgetfollowingerrors...

error:cannotfindsymbolclassonClickListner.
pleasehelp

Thanks

RohanSharmag(/member/RohanSharmag) . sharadkapil(/member/sharadkapil)
6monthsago Reply
https://mcent.com/app/?
mcode=Q08W5K&tcx=WAPP

apple99t(/member/apple99t) 7monthsago Reply

Hithere,iamtryingtodoasimplepictureappbutikeepgettingtangleup.
Pleasehelp.
RohanSharmag(/member/RohanSharmag) . apple99t(/member/apple99t)
6monthsago Reply
https://mcent.com/app/?
mcode=Q08W5K&tcx=WAPP

I MoreComments
advertisement

Ad
CallCenterSoftware
forthebestCustomerJourneyExperience
XCALLY

FEATURED CHANNELS

Woodworking Paper KitchenHacks Puzzles LaserCutting Space Homesteading 3DPrinting Sewing


(/tag/type (/tag/type (/tag/type (/tag/type (/tag/type (/tag/type (/tag/type (/tag/type (/tag/type
id/category id/category id/keyword id/category id/category id/keyword id/category id/category id/category
workshop/channelcraft/channel kitchen%20hacks/?play/channel workshop/channel astronomy/? home/channel technology/channel
craft/channel
woodworking/) paper/) sort=FAVORITES) puzzles/) lasercutting/) sort=FAVORITES)homesteading/) 3DPrinting/) sewing/)
Newsletter AboutUs
Letyourinboxhelpyoudiscover WhoWeAre(/about/)
ourbestprojects,classes,and Advertise(/advertise/)
contests.Instructableswillhelp Contact(/about/contact.jsp)
youlearnhowtomakeanything!
Jobs(/community/PositionsavailableatInstructables/)

enteremail I'min! Help(/id/howtowriteagreatinstructable/)

FindUs Resources
Facebook(http://www.facebook.com/instructables) ForTeachers(/teachers/)
Youtube(http://www.youtube.com/user/instructablestv) ResidencyProgram(/pier9residency)
Twitter(http://www.twitter.com/instructables) GiftPremiumAccount(/account/give?sourcea=footer)
Forums(/community/)
Pinterest(http://www.pinterest.com/instructables)
Answers(/tag/typequestion/?sort=RECENT)
Google+(https://plus.google.com/+instructables)
Sitemap(/sitemap/)

TermsofService(http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21959721) |
PrivacyStatement(http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21292079) |
LegalNotices&Trademarks(http://usa.autodesk.com/legalnoticestrademarks/) | MobileSite(https://www.instructables.com)
(http://usa.autodesk.com/adsk/servlet/pc/index?id=20781545&siteID=123112)
2016Autodesk,Inc.