Skip to main content

Posts

Showing posts with the label Android Examples

Creating a List using List View in Android Studio

Hello Everyone, In this blog we are using the concept of List View. ListView is a view which groups several items and display them in vertical scrollable list. The list items are automatically inserted to the list using an Adapter that pulls content from a source such as an array or database. Here we are using a array of string to store the list items. Follow the steps given below to create an android project with the ListView      1) Open Android Studio and select New Project. Select an Empty Activity.   2) Click on Project -- Res -- Layout -- (Right Click on Layout) -- New -- Layout Resource File. Rename this file as "activity_listview". This file will display the contents in textbox. Here we require two xml files, one to define the structure of list view and other to display the content of list view. The activity_main.xml file contains the ListView structure. Thus all the files necessary for this project are created. Now ju...

Creating Two Activities in Android Studio

Hello Everyone, In this blog, we are creating an android application which will allow the user to go from one activity to another using a simple button widget. Here we are going to use android components like activity, button widgets and intents. In this application we will use two activities- MainActivity and SecondActivity.  Follow the steps given below to create an android project with two activities.   1) Open Android Studio and select New Project. Select an Empty Activity. Thus your first activity (MainActivity) is created.   2) Once the new project is created, go to File -- New -- Activity -- Empty Activity.   3) Rename the activity as "SecondActivity". Also select the option to generate a Layout file. Do not change the other settings. Now, your second activity is also created.   4) Copy-paste the code given below in the respective files. Then build and run the application. MainActivity.java ...