{"id":2388,"date":"2020-02-12T13:21:49","date_gmt":"2020-02-12T12:21:49","guid":{"rendered":"https:\/\/home.et.utwente.nl\/slootenvanf\/?p=2388"},"modified":"2026-02-03T10:26:24","modified_gmt":"2026-02-03T09:26:24","slug":"android-studio-first-interactive-userinterface","status":"publish","type":"post","link":"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/","title":{"rendered":"Android Studio: create a first interactive userinterface"},"content":{"rendered":"\n<p><em>This article has been updated to reflect the 2025 version of Android Studio (<em>\u2018Otter\u2019<\/em>).<\/em><\/p>\n\n\n\n<p>In this tutorial you will create an app with Android Studio with a simple userinterface which provides an input field (textfield) in which you can enter text, a button and a textview which displays a message. It can be used as a first project if you are starting to create Apps using Android Studio. It will show the basics of creating a userinterface and adding an eventhandler to a button. If you did not install &amp; setup Android Studio yet, <a aria-label=\"do that first. (opens in a new tab)\" href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/01\/20\/android-studio-intro\/\" target=\"_blank\" rel=\"noreferrer noopener\">do that first.<\/a><\/p>\n\n\n\n<p>Start a new Android Studio Project (either from the Welcome screen or via <em>File > New > New project<\/em>).<br>Choose &#8220;Basic Views Activity&#8221;. Click <em>Next<\/em>.<br>Type a name: eg. &#8220;Hello World&#8221;. Check the language, it should be set to &#8216;Java&#8217;. Set the API Level to 28: API 28: Android 9.0 (Pie). But if you want, you may also choose different. Make sure if you would like to run on your Phone, that you choose an Android version your phone supports.<br>Changing the Package name and the Location is optional.<br>Press <em>Finish<\/em>.<\/p>\n\n\n\n<p>Wait until Android Studio sets up the project.<\/p>\n\n\n\n<p>Consider exploring\/setting some of the settings, via the settings icon at the right side of the title bar:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"621\" height=\"41\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image.png\" alt=\"\" class=\"wp-image-6723\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image.png 621w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-300x20.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-604x41.png 604w\" sizes=\"auto, (max-width: 621px) 100vw, 621px\" \/><\/a><\/figure>\n\n\n\n<p>For instance, I have changed the theme to &#8220;Light with Light Header&#8221;, via <em>Settings > Theme<\/em>&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1030\" height=\"571\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-1-1030x571.png\" alt=\"\" class=\"wp-image-6724\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-1-1030x571.png 1030w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-1-300x166.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-1-768x426.png 768w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-1.png 1386w\" sizes=\"auto, (max-width: 1030px) 100vw, 1030px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Create the userinterface<\/h2>\n\n\n\n<p>The example project Basic Views Activity consists of two fragments, which can be seen as pages in the App. You can navigate between them using the next and previous buttons. We will extend the userinterface of the first fragment.<\/p>\n\n\n\n<p>The layout of the first page of the userinterface is defined in <strong>fragment_first.xml<\/strong>, which you can find under <em>res, layout<\/em> in the folder structure, so open that by double clicking the file:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1030\" height=\"564\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-2-1030x564.png\" alt=\"\" class=\"wp-image-6725\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-2-1030x564.png 1030w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-2-300x164.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-2-768x421.png 768w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-2.png 1495w\" sizes=\"auto, (max-width: 1030px) 100vw, 1030px\" \/><\/a><\/figure>\n\n\n\n<p>The userinterface already contains a button and a TextView with a large Lorem Ipsum text. You might need to use the Zoom button in the lower right corner of the view to get the same view as above.<\/p>\n\n\n\n<p>We will shorten the Lorem ipsum text. In the explorer, find the <strong>strings.xml<\/strong> file and open it:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-8.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1030\" height=\"571\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-8-1030x571.png\" alt=\"\" class=\"wp-image-6735\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-8-1030x571.png 1030w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-8-300x166.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-8-768x426.png 768w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-8.png 1386w\" sizes=\"auto, (max-width: 1030px) 100vw, 1030px\" \/><\/a><\/figure>\n\n\n\n<p>Replace the Lorem ipsum text in the code, and change it to &#8220;Hello&#8230;&#8221;:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-9.png\"><img loading=\"lazy\" decoding=\"async\" width=\"533\" height=\"286\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-9.png\" alt=\"\" class=\"wp-image-6736\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-9.png 533w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-9-300x161.png 300w\" sizes=\"auto, (max-width: 533px) 100vw, 533px\" \/><\/a><\/figure>\n\n\n\n<p>Change the text &#8220;First Fragment&#8221; of the first_fragment_label to &#8220;Hello world&#8221;.  Close <strong>strings.xml<\/strong>.<\/p>\n\n\n\n<p>Next, set the <strong>NestedScrollView <\/strong>to take up the whole screen by setting &#8220;fillViewport&#8221; to <em>true<\/em>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-10.png\"><img loading=\"lazy\" decoding=\"async\" width=\"911\" height=\"562\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-10.png\" alt=\"\" class=\"wp-image-6737\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-10.png 911w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-10-300x185.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-10-768x474.png 768w\" sizes=\"auto, (max-width: 911px) 100vw, 911px\" \/><\/a><\/figure>\n\n\n\n<p>Then, remove the top and bottom constraints. Select the element (eg. the button), then at the right, in the Attributes section, select the contraint and press Delete:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-13.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1030\" height=\"673\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-13-1030x673.png\" alt=\"\" class=\"wp-image-6744\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-13-1030x673.png 1030w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-13-300x196.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-13-768x502.png 768w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-13.png 1057w\" sizes=\"auto, (max-width: 1030px) 100vw, 1030px\" \/><\/a><\/figure>\n\n\n\n<p>Drag the Button and the text downward so it looks like:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-14.png\"><img loading=\"lazy\" decoding=\"async\" width=\"306\" height=\"537\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-14.png\" alt=\"\" class=\"wp-image-6745\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-14.png 306w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-14-171x300.png 171w\" sizes=\"auto, (max-width: 306px) 100vw, 306px\" \/><\/a><\/figure>\n\n\n\n<p>Now add an input field in which the user can type his\/her name. When the user presses the Ok-button, a welcome text will be shown with the name read from the input.<\/p>\n\n\n\n<p>Select <em>Text, PlainText<\/em> in the Palette and drag it to the editor:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-12.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1030\" height=\"564\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-12-1030x564.png\" alt=\"\" class=\"wp-image-6739\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-12-1030x564.png 1030w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-12-300x164.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-12-768x421.png 768w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-12.png 1077w\" sizes=\"auto, (max-width: 1030px) 100vw, 1030px\" \/><\/a><\/figure>\n\n\n\n<p>Drop it somewhere in the center.<\/p>\n\n\n\n<p>Now we will constrain the text element to the top and left. <a href=\"https:\/\/www.youtube.com\/watch?v=nKForMnT0Cs\" target=\"_blank\" rel=\"noreferrer noopener\">Learn how to apply constraints here<\/a>. When you hover over the circles, you can see you can interact with them. Click the circle at the top side and drag it upwards to the top. Then drag the element itself down again to the old position. The element will now be constraint to the top:<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1030\" height=\"594\" data-id=\"4694\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_top-2-1030x594.png\" alt=\"\" class=\"wp-image-4694\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_top-2-1030x594.png 1030w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_top-2-300x173.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_top-2-768x443.png 768w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_top-2-100x58.png 100w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_top-2.png 1304w\" sizes=\"auto, (max-width: 1030px) 100vw, 1030px\" \/><\/figure>\n<\/figure>\n\n\n\n<p>Do the same with the left side to center the element:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_left.png\"><img loading=\"lazy\" decoding=\"async\" width=\"439\" height=\"285\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_left.png\" alt=\"\" class=\"wp-image-4697\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_left.png 439w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_left-300x195.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_left-100x65.png 100w\" sizes=\"auto, (max-width: 439px) 100vw, 439px\" \/><\/a><\/figure>\n\n\n\n<p>Also align the &#8216;Hello&#8230;&#8217; text to the left side of the textfield (drag its left-constraint circle to the left of the textfield above it):<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_textview.png\"><img loading=\"lazy\" decoding=\"async\" width=\"420\" height=\"742\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_textview.png\" alt=\"\" class=\"wp-image-4701\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_textview.png 420w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_textview-170x300.png 170w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_textview-57x100.png 57w\" sizes=\"auto, (max-width: 420px) 100vw, 420px\" \/><\/a><\/figure>\n\n\n\n<p>Select the textfield. In the Attributes panel, change its ID to &#8220;textField1&#8221; (click &#8216;Refactor&#8217; in the popup that appears):<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_textfield_set_id.png\"><img loading=\"lazy\" decoding=\"async\" width=\"759\" height=\"574\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_textfield_set_id.png\" alt=\"\" class=\"wp-image-4705\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_textfield_set_id.png 759w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_textfield_set_id-300x227.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_textfield_set_id-100x76.png 100w\" sizes=\"auto, (max-width: 759px) 100vw, 759px\" \/><\/a><\/figure>\n\n\n\n<p>From the Palette, add a Button and constrain it to the textfield by clicking the small circle: do this for the left (start to textField1 end) and top-constraints.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_button.png\"><img loading=\"lazy\" decoding=\"async\" width=\"341\" height=\"113\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_button.png\" alt=\"\" class=\"wp-image-4702\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_button.png 341w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_button-300x99.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_constrain_button-100x33.png 100w\" sizes=\"auto, (max-width: 341px) 100vw, 341px\" \/><\/a><\/figure>\n\n\n\n<p>Set it&#8217;s text to &#8220;Ok&#8221;. In the Attributes panel, open the &#8216;Declared Attributes&#8217;, then at &#8216;text&#8217; enter &#8220;Ok&#8221;:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_set_button_text-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"275\" height=\"308\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_set_button_text-1.png\" alt=\"\" class=\"wp-image-4704\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_set_button_text-1.png 275w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_set_button_text-1-268x300.png 268w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/ui_set_button_text-1-89x100.png 89w\" sizes=\"auto, (max-width: 275px) 100vw, 275px\" \/><\/a><\/figure>\n\n\n\n<p>Run the App and verify everything is positioned well:<br>(if you do not have a Virtual Device yet, create one)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-15.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1030\" height=\"554\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-15-1030x554.png\" alt=\"\" class=\"wp-image-6749\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-15-1030x554.png 1030w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-15-300x161.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-15-768x413.png 768w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-15-1536x826.png 1536w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-15.png 1920w\" sizes=\"auto, (max-width: 1030px) 100vw, 1030px\" \/><\/a><\/figure>\n\n\n\n<p>(Do not close the emulator)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Add an eventlistener<\/h2>\n\n\n\n<p>Add an eventlistener for the Ok button:<\/p>\n\n\n\n<p>Open <strong>FirstFragment.java<\/strong>. You can also find it in the <a aria-label=\"Project Structure (opens in a new tab)\" href=\"https:\/\/developer.android.com\/studio\/intro\/\" target=\"_blank\" rel=\"noreferrer noopener\">Project Structure<\/a> under app, kotlin+java, com.example.helloworld (your package name might be different):<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-16.png\"><img loading=\"lazy\" decoding=\"async\" width=\"922\" height=\"310\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-16.png\" alt=\"\" class=\"wp-image-6751\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-16.png 922w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-16-300x101.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-16-768x258.png 768w\" sizes=\"auto, (max-width: 922px) 100vw, 922px\" \/><\/a><\/figure>\n\n\n\n<p>Add the code below to the <em>onViewCreated()<\/em> method:<br>(make sure to add it at the end)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>binding.button.setOnClickListener(new View.OnClickListener() {\n@Override\npublic void onClick(View view) {\n    System.out.println(\"Ok pressed\");\n}\n});<\/code><\/pre>\n\n\n\n<p>Inside the eventlistener, we can add the line below to the <em>onClick()<\/em> method, right after the line with <em>System.out.println()<\/em>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>binding.textviewFirst.setText(\"Hello, \"+binding.textField1.getText());<\/code><\/pre>\n\n\n\n<p>Via the binding object, we can access the userinterface elements, like the input textfield (textField1), in which the name will be typed. We can also access textviewFirst, which is the textview which is empty at start (we removed its original text). To get the text which was typed in the textField1, we can call its <em>getText()<\/em> method.<\/p>\n\n\n\n<p>Now it is time to test the App! ((Re)Run the App).<\/p>\n\n\n\n<p>If you type your name and hit the Ok button, result should look like:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-17.png\"><img loading=\"lazy\" decoding=\"async\" width=\"411\" height=\"990\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-17.png\" alt=\"\" class=\"wp-image-6752\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-17.png 411w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-17-125x300.png 125w\" sizes=\"auto, (max-width: 411px) 100vw, 411px\" \/><\/a><\/figure>\n\n\n\n<p>You can also review the code in case you need it:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1005\" height=\"867\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-2.png\" alt=\"\" class=\"wp-image-4714\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-2.png 1005w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-2-300x259.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-2-768x663.png 768w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-2-100x86.png 100w\" sizes=\"auto, (max-width: 1005px) 100vw, 1005px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Things to fix:<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\">Use hint instead of placeholder<\/h4>\n\n\n\n<p>When you test the App, you might notice that it is rather annoying that, when you start typing, you first have to <strong>remove the placeholder text<\/strong> &#8216;Name&#8217;.<br>Instead of having this text in the text-attribute of the text field, it is better to put it in the hint-attribute: In the Attributes of textField1, at <strong>text <\/strong>remove the value (attribute should be empty), then scroll down until <strong>hint<\/strong> and enter &#8216;Name&#8217; there. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Use resources instead of hard-coded strings<\/h4>\n\n\n\n<p>You might encounter <strong>warnings about strings<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-3.png\"><img loading=\"lazy\" decoding=\"async\" width=\"402\" height=\"210\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-3.png\" alt=\"\" class=\"wp-image-4716\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-3.png 402w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-3-300x157.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-3-100x52.png 100w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/a><\/figure>\n\n\n\n<p>Your app will work fine, it is just a warning. But if you want to build larger apps and for instance support multiple languages, you should fix this. We show how to do this for the <em>hint <\/em>value for <em>textField1<\/em>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-5.png\"><img loading=\"lazy\" decoding=\"async\" width=\"819\" height=\"410\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-5.png\" alt=\"\" class=\"wp-image-4719\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-5.png 819w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-5-300x150.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-5-768x384.png 768w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-5-100x50.png 100w\" sizes=\"auto, (max-width: 819px) 100vw, 819px\" \/><\/a><\/figure>\n\n\n\n<p>Select <em>textField1<\/em> and in the list of attributes scroll down to the <em>hint <\/em>value and make this value empty. Then click the small button &#8216;Pick a Resource&#8217;:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-4.png\"><img loading=\"lazy\" decoding=\"async\" width=\"312\" height=\"71\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-4.png\" alt=\"\" class=\"wp-image-4718\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-4.png 312w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-4-300x68.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-4-100x23.png 100w\" sizes=\"auto, (max-width: 312px) 100vw, 312px\" \/><\/a><\/figure>\n\n\n\n<p>The dialog to define resources appears. Click the + to add a resource. Ehen enter the Resource name and value and press Ok, then select that resource and press Ok again:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-6.png\"><img loading=\"lazy\" decoding=\"async\" width=\"626\" height=\"593\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-6.png\" alt=\"\" class=\"wp-image-4720\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-6.png 626w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-6-300x284.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-6-100x95.png 100w\" sizes=\"auto, (max-width: 626px) 100vw, 626px\" \/><\/a><\/figure>\n\n\n\n<p>The value will now be <code>@string\/hint_for_name<\/code>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-7.png\"><img loading=\"lazy\" decoding=\"async\" width=\"385\" height=\"77\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-7.png\" alt=\"\" class=\"wp-image-4721\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-7.png 385w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-7-300x60.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-7-100x20.png 100w\" sizes=\"auto, (max-width: 385px) 100vw, 385px\" \/><\/a><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Prevent errors<\/h4>\n\n\n\n<p>If nothing is typed, and the Ok button is pressed, a brief warning should be displayed, eg.: &#8220;Please enter your name, then press Ok&#8221;. We can use the class <a href=\"https:\/\/developer.android.com\/reference\/com\/google\/android\/material\/snackbar\/Snackbar\" target=\"_blank\" rel=\"noreferrer noopener\">Snackbar<\/a> for that. Add this to the eventlistener:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if (binding.textField1.getText().length()&lt;1) {\n    Snackbar.make(view, \"Please enter your name, then press Ok\", Snackbar.LENGTH_LONG).setAction(\"Action\", null).show();\n}<\/code><\/pre>\n\n\n\n<p>The Class Snackbar might be unknown, then it will turn red. This means you have to import it, hover over it and click &#8216;Import Class&#8217;:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-8.png\"><img loading=\"lazy\" decoding=\"async\" width=\"880\" height=\"227\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-8.png\" alt=\"\" class=\"wp-image-4723\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-8.png 880w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-8-300x77.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-8-768x198.png 768w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-8-100x26.png 100w\" sizes=\"auto, (max-width: 880px) 100vw, 880px\" \/><\/a><\/figure>\n\n\n\n<p>Now move the code which displays the &#8220;Hello, &#8221; message in the &#8216;else&#8217; part of this if-statement. (Add the &#8216;else&#8217; yourself).<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Make the share button work<\/strong><\/h4>\n\n\n\n<p>In <strong>MainActivity.java<\/strong>, find the code which adds an eventhandler to the Floating Action Button (fab):<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-9.png\"><img loading=\"lazy\" decoding=\"async\" width=\"701\" height=\"160\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-9.png\" alt=\"\" class=\"wp-image-4726\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-9.png 701w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-9-300x68.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-9-100x23.png 100w\" sizes=\"auto, (max-width: 701px) 100vw, 701px\" \/><\/a><\/figure>\n\n\n\n<p>In the eventhandler, remove the line with <code>Snackbar.make...<\/code> and add your own code to handle press of that button. You can find plenty of examples of how to handle the share button. For instance this example shows <a aria-label=\"how to send an e-mail with it (opens in a new tab)\" href=\"https:\/\/www.javatpoint.com\/how-to-send-email-in-android-using-intent\" target=\"_blank\" rel=\"noreferrer noopener\">how to send an e-mail with it<\/a>. The code below can be used to accomplish this.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ get reference to textField1:\nEditText textField1 = findViewById(R.id.textField1);\n\n\/\/ send e-mail by using the 'Send to' Intent:\nIntent email = new Intent(Intent.ACTION_SENDTO);\nemail.setType(\"message\/rfc822\");\nemail.setData(Uri.parse(\"mailto:\"));\nemail.putExtra(Intent.EXTRA_SUBJECT, \"my first app\"); \/\/ subject of the email\nemail.putExtra(Intent.EXTRA_TEXT, \"Hello, I just created an 'hello world' app to greet \" + textField1.getText()+\"\\n\\n\"); \/\/ the body of the email\ntry {\n    startActivity(Intent.createChooser(email, \"Send mail...\"));\n} catch (android.content.ActivityNotFoundException ex) {\n    Toast.makeText(MainActivity.this, \"There are no email clients installed.\", Toast.LENGTH_SHORT).show();\n}<\/code><\/pre>\n\n\n\n<p>Please note that in order for this to work, you must have a working &amp; configured e-mail app on the device running this app.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Make use of Enter key possible<\/h4>\n\n\n\n<p>When you hit the Enter key on the keyboard while entering the name, the same eventhandler should be invoked. <a aria-label=\"How to do this is explained here. (opens in a new tab)\" href=\"https:\/\/stackoverflow.com\/questions\/4451374\/use-enter-key-on-softkeyboard-instead-of-clicking-button\" target=\"_blank\" rel=\"noreferrer noopener\">How to do this is explained here.<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Get AI assistance<\/h3>\n\n\n\n<p>Android Studio supports Gemini for AI assisted coding. Clck the Gemini Chat icon in the toolbar to the right, and start chatting:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-18.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1030\" height=\"374\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-18-1030x374.png\" alt=\"\" class=\"wp-image-6755\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-18-1030x374.png 1030w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-18-300x109.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-18-768x279.png 768w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-18-1536x557.png 1536w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-18.png 1918w\" sizes=\"auto, (max-width: 1030px) 100vw, 1030px\" \/><\/a><\/figure>\n\n\n\n<p>Let it apply changes suggested:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-19.png\"><img loading=\"lazy\" decoding=\"async\" width=\"477\" height=\"618\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-19.png\" alt=\"\" class=\"wp-image-6756\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-19.png 477w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/image-19-232x300.png 232w\" sizes=\"auto, (max-width: 477px) 100vw, 477px\" \/><\/a><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Change strings<\/h4>\n\n\n\n<p>You might want to change some other texts, like the heading of the fragment which is in the toolbar. For instance &#8220;First Fragment&#8221;. These can be found in the resource file <strong>Strings.xml<\/strong> (in the folder <em>res, values<\/em>):<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-10.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1030\" height=\"305\" src=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-10-1030x305.png\" alt=\"\" class=\"wp-image-4731\" srcset=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-10-1030x305.png 1030w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-10-300x89.png 300w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-10-768x228.png 768w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-10-100x30.png 100w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-10-1536x455.png 1536w, https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2022\/04\/image-10.png 1573w\" sizes=\"auto, (max-width: 1030px) 100vw, 1030px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">More information<\/h2>\n\n\n\n<p><a href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/tag\/android\/\">Continue to the series of articles on Android App Development.<\/a><\/p>\n\n\n\n<p>Or, learn more from these tutorials and free courses:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a aria-label=\"Tutorialspoint: Android Tutorial (opens in a new tab)\" href=\"https:\/\/www.tutorialspoint.com\/android\/\" target=\"_blank\" rel=\"noreferrer noopener\">Tutorialspoint: Android Tutorial<\/a><\/li>\n\n\n\n<li><a aria-label=\"Udemy: Learn Android Application Development - A beginner course on Android Application development  (opens in a new tab)\" href=\"https:\/\/www.udemy.com\/course\/learn-android-application-development-y\/\" target=\"_blank\" rel=\"noreferrer noopener\">Udemy: Learn Android Application Development &#8211; A beginner course on Android Application development <\/a><\/li>\n\n\n\n<li><a aria-label=\"Udacity: Developing Android Apps (opens in a new tab)\" href=\"https:\/\/www.udacity.com\/course\/new-android-fundamentals--ud851\" target=\"_blank\" rel=\"noreferrer noopener\">Udacity: Developing Android Apps<\/a><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Part of series about Android App Development. This is the second article, in which you will learn to create a first interactive userinterface.<\/p>\n","protected":false},"author":1,"featured_media":4733,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"categories":[3],"tags":[196,247,108,248,128,107,113,95],"class_list":["post-2388","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-education","tag-android","tag-android-studio","tag-app","tag-dev","tag-development","tag-java","tag-phone","tag-programming"],"blocksy_meta":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android Studio: create a first interactive userinterface - vanslooten.com<\/title>\n<meta name=\"description\" content=\"Android Studio: create a first interactive userinterface Learn how to create an interactive app with a basic userinterface providing text input and output and use of fragments.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Studio: create a first interactive userinterface - vanslooten.com\" \/>\n<meta property=\"og:description\" content=\"Android Studio: create a first interactive userinterface Learn how to create an interactive app with a basic userinterface providing text input and output and use of fragments.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/\" \/>\n<meta property=\"og:site_name\" content=\"vanslooten.com\" \/>\n<meta property=\"article:published_time\" content=\"2020-02-12T12:21:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-03T09:26:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/featured.png\" \/>\n\t<meta property=\"og:image:width\" content=\"527\" \/>\n\t<meta property=\"og:image:height\" content=\"411\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Fjodor van Slooten\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fjodorvs\" \/>\n<meta name=\"twitter:site\" content=\"@fjodorvs\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fjodor van Slooten\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2020\\\/02\\\/12\\\/android-studio-first-interactive-userinterface\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2020\\\/02\\\/12\\\/android-studio-first-interactive-userinterface\\\/\"},\"author\":{\"name\":\"Fjodor van Slooten\",\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/#\\\/schema\\\/person\\\/e62ff2d6beaa937dc9345a023eeb05dd\"},\"headline\":\"Android Studio: create a first interactive userinterface\",\"datePublished\":\"2020-02-12T12:21:49+00:00\",\"dateModified\":\"2026-02-03T09:26:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2020\\\/02\\\/12\\\/android-studio-first-interactive-userinterface\\\/\"},\"wordCount\":1371,\"publisher\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/#\\\/schema\\\/person\\\/e62ff2d6beaa937dc9345a023eeb05dd\"},\"image\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2020\\\/02\\\/12\\\/android-studio-first-interactive-userinterface\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/featured.png\",\"keywords\":[\"android\",\"android studio\",\"app\",\"dev\",\"development\",\"java\",\"phone\",\"programming\"],\"articleSection\":[\"Education\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2020\\\/02\\\/12\\\/android-studio-first-interactive-userinterface\\\/\",\"url\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2020\\\/02\\\/12\\\/android-studio-first-interactive-userinterface\\\/\",\"name\":\"Android Studio: create a first interactive userinterface - vanslooten.com\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2020\\\/02\\\/12\\\/android-studio-first-interactive-userinterface\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2020\\\/02\\\/12\\\/android-studio-first-interactive-userinterface\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/featured.png\",\"datePublished\":\"2020-02-12T12:21:49+00:00\",\"dateModified\":\"2026-02-03T09:26:24+00:00\",\"description\":\"Android Studio: create a first interactive userinterface Learn how to create an interactive app with a basic userinterface providing text input and output and use of fragments.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2020\\\/02\\\/12\\\/android-studio-first-interactive-userinterface\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2020\\\/02\\\/12\\\/android-studio-first-interactive-userinterface\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2020\\\/02\\\/12\\\/android-studio-first-interactive-userinterface\\\/#primaryimage\",\"url\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/featured.png\",\"contentUrl\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/featured.png\",\"width\":527,\"height\":411},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/2020\\\/02\\\/12\\\/android-studio-first-interactive-userinterface\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android Studio: create a first interactive userinterface\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/#website\",\"url\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/\",\"name\":\"vanslooten.com\",\"description\":\"Personal website of Fjodor van Slooten\",\"publisher\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/#\\\/schema\\\/person\\\/e62ff2d6beaa937dc9345a023eeb05dd\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/#\\\/schema\\\/person\\\/e62ff2d6beaa937dc9345a023eeb05dd\",\"name\":\"Fjodor van Slooten\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/2018-08-24-13.33.38_small.jpg\",\"url\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/2018-08-24-13.33.38_small.jpg\",\"contentUrl\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/2018-08-24-13.33.38_small.jpg\",\"width\":300,\"height\":214,\"caption\":\"Fjodor van Slooten\"},\"logo\":{\"@id\":\"https:\\\/\\\/home.et.utwente.nl\\\/slootenvanf\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/2018-08-24-13.33.38_small.jpg\"},\"sameAs\":[\"http:\\\/\\\/vanslooten.com\",\"https:\\\/\\\/x.com\\\/fjodorvs\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Studio: create a first interactive userinterface - vanslooten.com","description":"Android Studio: create a first interactive userinterface Learn how to create an interactive app with a basic userinterface providing text input and output and use of fragments.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/","og_locale":"en_US","og_type":"article","og_title":"Android Studio: create a first interactive userinterface - vanslooten.com","og_description":"Android Studio: create a first interactive userinterface Learn how to create an interactive app with a basic userinterface providing text input and output and use of fragments.","og_url":"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/","og_site_name":"vanslooten.com","article_published_time":"2020-02-12T12:21:49+00:00","article_modified_time":"2026-02-03T09:26:24+00:00","og_image":[{"width":527,"height":411,"url":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/featured.png","type":"image\/png"}],"author":"Fjodor van Slooten","twitter_card":"summary_large_image","twitter_creator":"@fjodorvs","twitter_site":"@fjodorvs","twitter_misc":{"Written by":"Fjodor van Slooten","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/#article","isPartOf":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/"},"author":{"name":"Fjodor van Slooten","@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/#\/schema\/person\/e62ff2d6beaa937dc9345a023eeb05dd"},"headline":"Android Studio: create a first interactive userinterface","datePublished":"2020-02-12T12:21:49+00:00","dateModified":"2026-02-03T09:26:24+00:00","mainEntityOfPage":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/"},"wordCount":1371,"publisher":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/#\/schema\/person\/e62ff2d6beaa937dc9345a023eeb05dd"},"image":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/#primaryimage"},"thumbnailUrl":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/featured.png","keywords":["android","android studio","app","dev","development","java","phone","programming"],"articleSection":["Education"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/","url":"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/","name":"Android Studio: create a first interactive userinterface - vanslooten.com","isPartOf":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/#website"},"primaryImageOfPage":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/#primaryimage"},"image":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/#primaryimage"},"thumbnailUrl":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/featured.png","datePublished":"2020-02-12T12:21:49+00:00","dateModified":"2026-02-03T09:26:24+00:00","description":"Android Studio: create a first interactive userinterface Learn how to create an interactive app with a basic userinterface providing text input and output and use of fragments.","breadcrumb":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/#primaryimage","url":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/featured.png","contentUrl":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2020\/02\/featured.png","width":527,"height":411},{"@type":"BreadcrumbList","@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/2020\/02\/12\/android-studio-first-interactive-userinterface\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/home.et.utwente.nl\/slootenvanf\/"},{"@type":"ListItem","position":2,"name":"Android Studio: create a first interactive userinterface"}]},{"@type":"WebSite","@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/#website","url":"https:\/\/home.et.utwente.nl\/slootenvanf\/","name":"vanslooten.com","description":"Personal website of Fjodor van Slooten","publisher":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/#\/schema\/person\/e62ff2d6beaa937dc9345a023eeb05dd"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/home.et.utwente.nl\/slootenvanf\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/#\/schema\/person\/e62ff2d6beaa937dc9345a023eeb05dd","name":"Fjodor van Slooten","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2019\/06\/2018-08-24-13.33.38_small.jpg","url":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2019\/06\/2018-08-24-13.33.38_small.jpg","contentUrl":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2019\/06\/2018-08-24-13.33.38_small.jpg","width":300,"height":214,"caption":"Fjodor van Slooten"},"logo":{"@id":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-content\/uploads\/2019\/06\/2018-08-24-13.33.38_small.jpg"},"sameAs":["http:\/\/vanslooten.com","https:\/\/x.com\/fjodorvs"]}]}},"_links":{"self":[{"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/posts\/2388","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/comments?post=2388"}],"version-history":[{"count":51,"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/posts\/2388\/revisions"}],"predecessor-version":[{"id":6759,"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/posts\/2388\/revisions\/6759"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/media\/4733"}],"wp:attachment":[{"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/media?parent=2388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/categories?post=2388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/home.et.utwente.nl\/slootenvanf\/wp-json\/wp\/v2\/tags?post=2388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}