English Subtitles for Android Application Development Tutorial - 58 - More with Preferences



Subtitles / Closed Captions - English

<font color="#CCCCCC">what's</font><font color="#E5E5E5"> up guys welcome</font><font color="#CCCCCC"> you're 58</font><font color="#E5E5E5"> android</font>

tutorial believe it is<font color="#E5E5E5"> and we're going</font> to<font color="#CCCCCC"> win this</font><font color="#E5E5E5"> tutorials accesses edit text</font> and also our<font color="#E5E5E5"> list preference</font><font color="#CCCCCC"> so what</font><font color="#E5E5E5"> I</font> want you guys to do now is open up our data<font color="#CCCCCC"> leave no open classes</font><font color="#E5E5E5"> activity</font><font color="#CCCCCC"> this</font> <font color="#E5E5E5">again is where we kind of</font><font color="#CCCCCC"> set</font><font color="#E5E5E5"> up a</font>

question for the most part and we commented out some stuff so we're going to add some additional information from our preferences in this class since we <font color="#CCCCCC">have to kind of you know</font><font color="#E5E5E5"> edit comment</font> out some of these other lines from

previous<font color="#CCCCCC"> tutorial so we're going to do</font> is basically set up again or are shared preference<font color="#E5E5E5"> little object for the most</font> prep for the most part we're going to <font color="#CCCCCC">say shared preferences are</font><font color="#E5E5E5"> going to call</font> <font color="#E5E5E5">this get data as well just like the last</font>

tutorial<font color="#E5E5E5"> to equal the same thing again</font> we're just going to access the reference manager dot<font color="#E5E5E5"> get default shared and</font> caught again<font color="#CCCCCC"> bait</font><font color="#E5E5E5"> get</font><font color="#CCCCCC"> base context the</font> <font color="#E5E5E5">software application and now we're going</font> to get some information as well from

<font color="#E5E5E5">from our preferences</font><font color="#CCCCCC"> can</font><font color="#E5E5E5"> we have to</font> import that<font color="#E5E5E5"> and we're going to</font><font color="#CCCCCC"> set up</font> <font color="#CCCCCC">and edit text wraps</font><font color="#E5E5E5"> are going to set up</font> a string<font color="#E5E5E5"> basically</font><font color="#CCCCCC"> to string variables</font> <font color="#CCCCCC">to</font><font color="#E5E5E5"> call</font><font color="#CCCCCC"> first string</font><font color="#E5E5E5"> edit text</font><font color="#CCCCCC"> et phone</font> home<font color="#E5E5E5"> and we're going to do with with ET</font>

here is we're going against it say get data dot<font color="#E5E5E5"> get string this time and again</font> we need to access our key reference so let's open up our preference<font color="#CCCCCC"> xml here</font> <font color="#E5E5E5">and as for edit text we use name but</font> that's what we're going to use<font color="#CCCCCC"> a guess</font>

basically<font color="#E5E5E5"> ran change your question from</font> our preferences and also for the default default value we're going to say <font color="#CCCCCC">Travis's</font> <font color="#E5E5E5">again</font><font color="#CCCCCC"> that was</font><font color="#E5E5E5"> our default question for</font> the most part<font color="#CCCCCC"> i so now what we need to</font>

also do is<font color="#E5E5E5"> set up our values which will</font> forget our values<font color="#E5E5E5"> for the most part is a</font> string values because again even though we have the<font color="#CCCCCC"> values equal to 1 2 3 and</font><font color="#E5E5E5"> 4</font> <font color="#E5E5E5">which seem like they're integers we set</font> it up with as a string array within<font color="#E5E5E5"> our</font>

a<font color="#CCCCCC"> xml</font><font color="#E5E5E5"> so again it's going to be string</font> for the most part so<font color="#E5E5E5"> we're</font><font color="#CCCCCC"> gonna</font><font color="#E5E5E5"> set</font><font color="#CCCCCC"> of</font> <font color="#E5E5E5">values equal to get data dot get string</font> because we're looking for a string as well and then let's check out what<font color="#CCCCCC"> are</font> key was<font color="#CCCCCC"> our cue is called lists</font><font color="#E5E5E5"> so we're</font>

going to say<font color="#CCCCCC"> list shut</font><font color="#E5E5E5"> off and then</font> <font color="#E5E5E5">default value</font><font color="#CCCCCC"> we're</font><font color="#E5E5E5"> going to set</font><font color="#CCCCCC"> up as</font> <font color="#E5E5E5">us because if you look at this basically</font> <font color="#CCCCCC">our default value we're going to</font><font color="#E5E5E5"> say for</font> something like that again<font color="#E5E5E5"> because it</font> takes<font color="#E5E5E5"> two strings within its parameters</font>

for the most part<font color="#E5E5E5"> a key string and a</font> default value again<font color="#CCCCCC"> at case if our</font> preferences doesn't have anything set <font color="#CCCCCC">its</font><font color="#E5E5E5"> gonna have a default value of</font><font color="#CCCCCC"> for</font> now<font color="#E5E5E5"> we're going to do is we're</font><font color="#CCCCCC"> gonna</font><font color="#E5E5E5"> set</font> up<font color="#CCCCCC"> our if we're going to say values</font>

<font color="#CCCCCC">again you can't compare strings like</font> string called values equals one even <font color="#CCCCCC">though basically our string reference</font> could equal the value<font color="#CCCCCC"> I mean the string</font> value of<font color="#E5E5E5"> one we have to use methods such</font> as content equals and then we can say

equals within<font color="#CCCCCC"> parentheses 1 i'm so</font> basically<font color="#CCCCCC"> for option</font><font color="#E5E5E5"> one has been</font> selected<font color="#E5E5E5"> our string will value equal</font><font color="#CCCCCC"> one</font> <font color="#CCCCCC">and we compare</font><font color="#E5E5E5"> that string value to the</font> string value of one right here<font color="#CCCCCC"> if that's</font> <font color="#CCCCCC">the</font><font color="#E5E5E5"> case we can set up something within</font>

these<font color="#E5E5E5"> parentheses so what we're going to</font> do is we're going to say<font color="#CCCCCC"> our question</font> which is<font color="#E5E5E5"> the</font><font color="#CCCCCC"> text view that acts</font><font color="#E5E5E5"> ask the</font> question within this activity<font color="#CCCCCC"> is a</font> question <font color="#CCCCCC">equals</font><font color="#E5E5E5"> or set text to</font><font color="#CCCCCC"> dt</font><font color="#E5E5E5"> which will</font>

again be our edit text from our preferences<font color="#CCCCCC"> so let's test this out make</font> sure it works but again that's<font color="#E5E5E5"> kind of</font> how<font color="#E5E5E5"> we can pull from our our preferences</font> <font color="#E5E5E5">kind of just an overview or review of</font> our last tutorial but let's just make

sure it works <font color="#E5E5E5">alright so let's open up our menu go to</font> preferences set<font color="#E5E5E5"> the edit text to</font> something like<font color="#E5E5E5"> preferences are</font> that's<font color="#CCCCCC"> what I set it up</font><font color="#E5E5E5"> to so we're just</font> gonna say preferences<font color="#CCCCCC"> or that's</font>

<font color="#E5E5E5">basically</font><font color="#CCCCCC"> going to be a question</font><font color="#E5E5E5"> if our</font> <font color="#E5E5E5">list activity has the first option</font> selected which does at the moment but just to make sure it works<font color="#E5E5E5"> we're going</font> to say option<font color="#CCCCCC"> 2 is selected so basically that</font>

question will be asked let's go into our data hit start <font color="#CCCCCC">Travis's</font><font color="#E5E5E5"> and now let's go back</font> menu preferences change your list<font color="#E5E5E5"> to</font> option<font color="#CCCCCC"> one which</font><font color="#E5E5E5"> will set our value</font> equal to<font color="#E5E5E5"> 1 which again is a string so we</font>

have to use<font color="#CCCCCC"> a contains r is equal to or</font> whatever method we use cotton content equals<font color="#CCCCCC"> 1</font><font color="#E5E5E5"> so that's</font><font color="#CCCCCC"> going to</font><font color="#E5E5E5"> be the</font><font color="#CCCCCC"> case</font> because<font color="#E5E5E5"> their value is set to one right</font> now<font color="#E5E5E5"> let's open up</font><font color="#CCCCCC"> your data it start</font> activity<font color="#E5E5E5"> as you can see now it says</font>

preferences are because that again <font color="#CCCCCC">r-value is equal to one</font><font color="#E5E5E5"> so it's going to</font> allow us to use that edit text which we converted into a string for the most part and we use that string to set the text of this question<font color="#E5E5E5"> so</font><font color="#CCCCCC"> hopefully that</font>

<font color="#E5E5E5">kind of makes sense again using the</font> preferences and how to access them <font color="#E5E5E5">I'm if again we</font><font color="#CCCCCC"> close activity</font> <font color="#E5E5E5">everything is going to be set for the</font> most part<font color="#E5E5E5"> and it's going to save and</font> then kind of open up that saved data<font color="#E5E5E5"> the</font>

next time we run our application<font color="#E5E5E5"> and so</font> again<font color="#CCCCCC"> our values set it to one and so</font> it's going to be preferences are so<font color="#E5E5E5"> hope</font> you guys<font color="#CCCCCC"> kind of enjoyed that understand</font> preferences and <font color="#E5E5E5">how they can be useful for the most part</font>

<font color="#E5E5E5">and</font><font color="#CCCCCC"> I'll catch</font><font color="#E5E5E5"> you guys in the next</font> tutorial



Video Description

Facebook - https://www.facebook.com/TheNewBoston-464114846956315/
GitHub - https://github.com/buckyroberts
Google+ - https://plus.google.com/+BuckyRoberts
LinkedIn - https://www.linkedin.com/in/buckyroberts
reddit - https://www.reddit.com/r/thenewboston/
Support - https://www.patreon.com/thenewboston
thenewboston - https://thenewboston.com/
Twitter - https://twitter.com/bucky_roberts