Android Application Development Tutorial for Beginners – #7 | 2017 | XML & Java – Explained [w/ subs]



00:00:00 – ♫MUSIC PLAYING♪
00:00:13 – what's going on guys welcome back to
00:00:15 – another brand new Android studio
00:00:17 – tutorial and today I want me show you
00:00:18 – that how to use string in Android studio
00:00:21 – so without wasting any time let's go to
00:00:24 – the android studio we have the last
00:00:25 – project and from the last project I have
00:00:28 – removed the second activity and its
00:00:30 – corresponding xml file so we have a
00:00:33 – blank main activity how completely clean
00:00:37 – it the file and now it's a brand new
00:00:39 – project so now i'm going to that main
00:00:41 – activity and simply adding some of the
00:00:43 – things that can show a text view or text
00:00:47 – from the string so string is nothing but
00:00:49 – a group of text that is that can be
00:00:52 – registered by your single name just like
00:00:55 – a variable that we have written that we
00:00:58 – have given for the balance so first of
00:01:00 – all i'm adding a text view into the
00:01:02 – sender i'm adding at the button so the
00:01:07 – reason why add the text view and the
00:01:09 – button is that both of these item can
00:01:11 – show text inside that so once i have
00:01:14 – done this one i'm going to the rest
00:01:18 – folder and inside that going to the
00:01:20 – values opening it and go into the string
00:01:23 – through xml and you can see here is
00:01:25 – actually a string it's already added
00:01:28 – that is the string name is app
00:01:30 – underscore name that is the application
00:01:32 – name first application so i want to add
00:01:36 – another or new string into read so let's
00:01:39 – go and type a new string so for that we
00:01:42 – how to add less than symbol than spring
00:01:45 – so when you type string and press enter
00:01:48 – it automatically complete all the other
00:01:50 – things require so now you can give the
00:01:52 – name for the string and just giving my
00:01:54 – string as text view message you can give
00:02:01 – any names including the numbers also so
00:02:04 – like ways and now i'm closing with the
00:02:08 – greater than symbol and it automatically
00:02:10 – added the closing tag off that screen
00:02:12 – now in
00:02:13 – between this less than and greater than
00:02:16 – symbol you how to type your message so
00:02:19 – well typing the message there is some of
00:02:21 – the best trick that you can use let me
00:02:23 – show you so for and the photo text view
00:02:26 – i'm typing this is my first so i have
00:02:30 – tied word this is my first application
00:02:32 – and if i want to show the first or the
00:02:34 – application in the second line or a new
00:02:38 – line we have a method that we can use
00:02:41 – that is backward slash then yen now when
00:02:45 – i type backward slash with including en
00:02:48 – without in these cases between these two
00:02:50 – you can see now when we are moving to
00:02:53 – the I'm QED underscore main we have the
00:02:55 – text view over into the text view text
00:02:58 – in the same changing the text into
00:03:00 – string value so we have simply type for
00:03:03 – each string and when i type ii yes you
00:03:06 – can see here it is a string textview
00:03:09 – underscore message we definitely just
00:03:11 – gonna select that one and well we can
00:03:14 – see if you're in show that takes you
00:03:16 – within two lines that this is my first
00:03:19 – application and in the second line you
00:03:23 – can see this a fast this is my first in
00:03:26 – the first line and the application in
00:03:28 – the second line so like ways you can use
00:03:30 – backward backward slash and the end to
00:03:34 – together to make a new line and there so
00:03:37 – okay so now you know how to create a new
00:03:40 – string and give a sample message for the
00:03:43 – strings now create the second string for
00:03:45 – the button text so I'm tapping against
00:03:48 – ring then and now typing the string
00:03:51 – value so now i have read you the second
00:03:53 – string that is that the string name is
00:03:55 – but an underscore methods with the value
00:03:58 – of click me than symbol we now let's
00:04:00 – move to that I'm activity underscore
00:04:02 – middle xml add the string same as that
00:04:06 – we have done in the text view ID string
00:04:10 – selecting the button underscore message
00:04:12 – and you can see instantly change the
00:04:16 – text of this button into click me so
00:04:19 – that's it now i will show you is that
00:04:21 – how to set the value of string using the
00:04:24 – main activity that is java programming
00:04:27 – so we have declared that text view
00:04:29 – buttons and many other things using the
00:04:32 – strain inside the combat activity or the
00:04:35 – activity so lightweight I'm typing the
00:04:38 – string so when I type string can see if
00:04:41 – you to automatically came up now i'm
00:04:43 – selecting that one now as as we have
00:04:45 – done before i'm giving the name for the
00:04:47 – string that is a variable name for the
00:04:49 – screen i want to name the variable as my
00:04:53 – screen ok so my string equal to now you
00:04:58 – how to enter the value of the thing that
00:05:01 – we have been famous that we have done in
00:05:03 – the strings or XML so I'm typing with
00:05:06 – something else here this is my message
00:05:12 – wow you can see the short arrows between
00:05:16 – that we have type work so in order to
00:05:18 – type a message in the Gamma thoughts you
00:05:21 – have to use double quotes and in in
00:05:24 – between that double calls you how to
00:05:25 – type your message so let me show you
00:05:27 – that i'm using a double coat and inside
00:05:31 – that i'm typing the same message now
00:05:33 – finally we are closing with a semicolon
00:05:35 – and that's it so there is no any arrests
00:05:38 – till now now i'm a new button or the
00:05:40 – textview in your ear so here is my third
00:05:45 – vid chat and you can see the ID for the
00:05:48 – widget is text view 3 and changing the
00:05:51 – ID into text view swing now more into
00:05:56 – the main activity i'm showing the text
00:05:57 – view here
00:06:02 – now I have shown that takes you in
00:06:05 – between de oncreate method so finally be
00:06:08 – how to display the message of the string
00:06:11 – in the textview so for that I tell you
00:06:13 – how to do is simply type my text view
00:06:16 – that's the variable name that I have
00:06:18 – given for the text view with the ID text
00:06:21 – you string now you have to type dot text
00:06:25 – and ask you how to simply give the name
00:06:27 – of the variable name of the string so
00:06:30 – that the variable name is my string and
00:06:32 – selecting that one and there is not any
00:06:36 – others till this time and now let's move
00:06:39 – to the activity under scroll main dot
00:06:41 – XML and you can see here it shows text
00:06:45 – view but if you're running it on your
00:06:47 – live device you can always see the text
00:06:49 – view will be replaced with this message
00:06:52 – that is this is my message so I hope you
00:06:56 – guys enjoyed watching this tutorial and
00:06:58 – if you like this video definitely give
00:06:59 – it a big thumbs up and if you want
00:07:01 – tutorials like this in the future you
00:07:02 – can probably go and subscribe to my
00:07:04 – channel thanks for watching I don't hope
00:07:06 – to see in my next tutorial
00:07:14 – you


Video Url:
http://youtu.be/XfxeEtGB-8M

Comments

comments