Posts

Android studio 8 Radio Group and Radio Buttons

Image
Radio Buttons Radio buttons allow the user to select one option from a set. You should use radio buttons for optional sets that are mutually exclusive if you think that the user needs to see all available options side-by-side. If it's not necessary to show all options side-by-side, use a  spinner  instead. To create each radio button option, create a  RadioButton  in your layout. However, because radio buttons are mutually exclusive, you must group them together inside a  RadioGroup . By grouping them together, the system ensures that only one radio button can be selected at a time. Key classes are the following: RadioButton RadioGroup Responding to Click Events When the user selects one of the radio buttons, the corresponding  RadioButton  object receives an on-click event. To define the click event handler for a button, add the  android:onClick  attribute to the  <RadioButton>  element in your XML layout. ...

Android studio 7. Develop simple quiz app

Just follow the foolowing link for developing a quiz app https://www.youtube.com/watch?v=JA9s_Fntg_4&t=139s The codes corresponding to above video is given below. MainActivity.java ***************************************************************************************************************************************** package com.example.hp_pc.hpluniv; import android.content.DialogInterface; import android.content.Intent; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import java.util.Random; public class MainActivity extends AppCompatActivity {     Button answer1, answer2, answer3, answer4;     TextView score, question;     private Questions mQuestions= new Questions();     private String mAnswer;     private int mScore = 0;     priv...

Android Studio 6 adding link to text

This lesson teaches about adding link to the textview.  Please follow the instructions given in the video of the following link Adding link to text view https://www.youtube.com/watch?v=aQIqQ2-lyO8

Android Studio 5 Start Another Activity

Image
Reference https://developer.android.com/training/basics/firstapp/starting-activity.html Start Another Activity This lesson teaches you to Respond to the send button Build an Intent Create the second activity Add a text view Display the message Add up navigation After completing the previous lesson , you have an app that shows an activity (a single screen) with a text field and a button. In this lesson, you’ll add some code to MainActivity that starts a new activity to display the message when the user taps Send . Note: This lesson expects that you are using Android Studio 3.0 or higher. Respond to the send button Add a method to the MainActivity class that's called by the button as follows: In the file app > java > com.example.myfirstapp > MainActivity , add the sendMessage() method stub as shown below: Kotlin Java More class MainActivity : AppCompatActivity () {     override fun onCreate ( savedInstanceState :...

Android studio 4 Building user Interface in the app

Image
Build a Simple User Interface This lesson teaches you to Open the Layout Editor Add a text box Add a button Change the UI strings Make the text box size flexible In this lesson, you'll use the Android Studio Layout Editor to create a layout that includes a text box and a button. In the next lesson, you'll make the app respond to the button tap by sending the content of the text box to another activity. Figure 1. Screenshot of the final layout The user interface for an Android app is built using a hierarchy of layouts ( ViewGroup objects) and widgets ( View objects). Layouts are invisible containers that control how its child views are positioned on the screen. Widgets are UI components such as buttons and text boxes. Figure 2. Illustration of how ViewGroup objects form branches in the layout and contain View objects Android provides an XML vocabulary for ViewGroup and View classes, so most of your UI is defined in XML files. However, inst...