More Effective Layouts
|
|
- Aldous Glenn
- 5 years ago
- Views:
Transcription
1 More Effective Layouts In past weeks, we've looked at ways to make more effective use of the presented display (e.g. elastic layouts, and separate layouts for portrait and landscape), as well as autogenerating custom widgets for selections. Problems Both of these are slightly lacking. So far, creating a separate landscape layout has required repeating the entire user interface (with potential pitfalls for major errors). This would be even worse if we wanted to take the same approach to the phone vs tablet problem (likely including significantly different code as well). Additionally, our generated widgets have been fine for list-oriented entries, but still ignores a basic design question: what if we want to present a popup, just to get some input (or inputs) from the user? We wouldn't necessarily want to combine such questions with the larger interface, right? (For example, suppose you want to send a message to someone. It isn't unheard of for an application to present you with a contact list that then entirely disappears) Solutions Basically, the two topics we want to discuss are fragments and dialogs; albeit in the opposite order. If we have time, we'll also get our first taste of minimal (organized) persistence. Dialogs We'll be using dialogs in cases where we theoretically could have just made a new Activity, but where that would be overkill (or where we don't really want to completely leave the current context). Though we can create our own custom dialogs, Android also provides several handy base types. Let's start off simple. AlertDialogs Make a new project, and let's get the skeleton of a basic layout down: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" xmlns:app=" tools:context="ca.brocku.efoxwell.a2017_fifthstage.mainactivity" android:orientation="vertical" > <Button android:text="simple" android:id="@+id/lerta" android:onclick="pushy"
2 <Button android:text="interesting" android:onclick="pushy" <Button android:text="feedback" android:onclick="pushy" <TextView <Button android:text="next!" android:onclick="pushy" I figured I'd probably want four buttons, but we can change that. Also, yours doesn't need to look like mine. The AlertDialog is used to either present a notification, or to get minimal feedback. In all cases, it acts as a sort of a popup, as an alternative to the current Activity/mode (for this reason, you might want to use them sparingly. More often than not, you don't want your application to interrupt itself). Of course, we'll be using a switch statement to handle the button presses, so I'll focus on what's inside. Let's start simple. To simplify the creation of a new Dialog, we'll use a builder: AlertDialog.Builder firstdialog=new AlertDialog.Builder(this); firstdialog.settitle("attention!"); firstdialog.seticon(r.mipmap.ic_launcher); firstdialog.setmessage("note: this is a dialog. That is all."); firstdialog.show(); Well, that's... boring. Also, note that you have to press the 'back' button or click somewhere else to get out of it. You wouldn't commonly want an AlertDialog this simplistic. At the very least, you'd want some sort of acknowledgement button on it, and possibly a negative/cancel (e.g. if asking to proceed). We have up to three buttons available to us (positive, neutral, and negative), so let's use them all:
3 AlertDialog.Builder seconddialog=new AlertDialog.Builder(this); seconddialog.settitle("attention!"); //I no longer care about the icon seconddialog.setmessage("i'm Mr. Dialog! Look at me!"); seconddialog.setpositivebutton("ok", new DialogInterface.OnClickListener() { public void onclick(dialoginterface dialog, int buttonid) { Toast.makeText(MainActivity.this,"Caaan dooo!",toast.length_short).show(); ); seconddialog.setnegativebutton("cancel", new DialogInterface.OnClickListener() { public void onclick(dialoginterface dialog, int buttonid) { Toast.makeText(MainActivity.this, "Well, which is it? Square my shoulders or keep my head down?", Toast.LENGTH_SHORT).show(); ); seconddialog.setneutralbutton("(other)", new DialogInterface.OnClickListener() { public void onclick(dialoginterface dialog, int buttonid) { Toast.makeText(MainActivity.this, "We talked about this! It's both!", Toast.LENGTH_SHORT).show(); ); seconddialog.show(); Of course, your text would presumably be different. Or not. Up to you. Note that it'd probably be more appropriate to use a single listener for all three (the buttonid will tell you which was pressed). Okay, so now we can show, for example, a disclaimer, or a permission/confirmation form. What else? Well, the dialog is already designed to contain a View. If we wanted anything more complicated than a single data entry, then we'd probably be best off just creating an entire custom dialog. Let's just programmatically create a single EditText to put into it, and retrieve the data (only) upon pressing OK. AlertDialog.Builder thirddialog=new AlertDialog.Builder(this); thirddialog.settitle("attention!"); thirddialog.seticon(r.mipmap.ic_launcher); thirddialog.setmessage("what's your favourite number?"); final EditText query=new EditText(this); query.sethint("like... 42?"); query.setinputtype(inputtype.type_class_number); thirddialog.setview(query); thirddialog.setpositivebutton("ok", new DialogInterface.OnClickListener() { public void onclick(dialoginterface dialog, int buttonid) { ((TextView)findViewById(R.id.feedback)).setText("Yep. "+ query.gettext()+" is neat."); ); thirddialog.setnegativebutton("cancel",
4 new DialogInterface.OnClickListener() { public void onclick(dialoginterface dialog, int buttonid) { return; ); thirddialog.show(); break; So now, we can easily get a bit of information back from the user whenever we want. Other premade dialogs There are plenty of other dialogs already built into Android. Some of the more esoteric ones include CharacterPickerDialog and ProgressDialog. But let's look at a pair of dialogs you might actually semi-commonly need. Time for another Activity. Just give its layout two buttons (one for this demonstration, and one to move on). I'm assuming the demo button is called chronology. Heck, I'll use the same for the Activity, itself. public class Chronology extends AppCompatActivity implements DatePickerDialog.OnDateSetListener, protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_chronology); public void chronology(view v) { java.util.calendar today=java.util.calendar.getinstance(); new DatePickerDialog(Chronology.this, //context this, //listener today.get(java.util.calendar.year), today.get(java.util.calendar.month), today.get(java.util.calendar.day_of_month)).show(); public void ondateset(datepicker view, int year, int monthofyear, int dayofmonth) { java.util.calendar today=java.util.calendar.getinstance(); new TimePickerDialog(this, this, today.get(calendar.hour_of_day), today.get(calendar.minute), true //24-hour display? ).show(); public void ontimeset(timepicker view, int hour, int minute) { android.widget.toast.maketext(this,"neat.", Toast.LENGTH_SHORT).show(); public void nextactivity(view v) { //startactivity
5 Yeah, it doesn't actually do anything. But we can still see roughly how it works. Note that this isn't the same thing as having the user's list of contacts pop up for selecting. Contacts rely on a content provider, and we aren't there just yet. Fragments Okey dokey. No real segue here; just a flat introduction of the problem: as mentioned earlier, if I want to have different layouts according to different screen geometries, my choices (with the tools we've covered thus far) have been pretty limited. Basically, I need to recreate everything from scratch for each different type of view. How much of that is really necessary? Certainly, if we wanted the application to look different between its portrait and landscape orientations, we'd definitely need different XML layouts. But do we need complete copies of the layouts? For example, there is likely to be a great deal of overlap between them. Just for the sake of clarification, let's look at an example (which we won't actually be creating today). Thought experiment Let's say we wanted to make a graphing calculator. In a portrait view, we'd probably have the graphing area at the top, and the buttons at the bottom. In landscape, that would look squished, and borderline useless. Instead, we might prefer the buttons on the right, and the graphing area on the left (or vice versa). However, the graphing area itself is the same, irrespective of where it is, and the same goes for the buttons. So then, what's a Fragment? Well, this is one of those it makes more sense when you see it cases, but, in short, a Fragment is a selfcontained, pseudo-activity, that keeps its own interface to itself. The application can then have one or more Fragments simultaneously, and either display them together, or let you switch between them, or selectively only show some when there's enough room. Fragments have their own separate life cycles, not directly tied to those of the Activities. The Android developer page has a good perspective: You can combine multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple activities. You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own input events, and which you can add or remove while the activity is running (sort of like a "sub activity" that you can reuse in different activities). Read more here:
6 Life cycles A Fragment has its own life cycle, but that life cycle is still closely connected to its Activity's. For example, if you pause an Activity, it would be odd if the pieces within that Activity didn't also pause, right? For the sake of visualizing the connection between the two, consider the following image, stolen shamelessly from the Android developer page: The two major methods to override are oncreate() and oncreateview(). oncreate() should be self-explanatory by now, but oncreateview() might not be. Basically, because Fragments handle UIs a little differently from Activities (when they even have UIs at all), we'll have to build them slightly differently as well. In this case, we'll need to explicitly construct the UI, and then return that 'View' for incorporation into the Activity. If a Fragment doesn't need a UI, just return null. First example Let's start small for our first example, okay? In fact, let's start so small that it's effectively pointless. Let's make a single Fragment to fit within a single Activity, just to confirm that we can, k? You know the drill by now. Let's create a new Activity (I'm calling mine FraggyOne), and load it up from that second button we created for our last layout. For this example, I'm still going to create a layout for the Activity, but it will be pretty trivial, as its sole job will be to hold a Fragment. While I'm at it, I'll also create the new Fragment, FraggyOneFrag, and have Android studio create a layout for that for me. I won't have it create the other extras, though.
7 Our first Fragment: layout <LinearLayout xmlns:android=" tools:context="ca.brocku.efoxwell.a2017_fifthstage.fraggyonefrag" android:orientation="vertical"> <TextView android:text="things!" <TextView android:text="stuff!" <Button android:text="button!" android:onclick="thatsit" Our first Fragment: code public class FraggyOneFrag extends Fragment public View oncreateview(layoutinflater inflater, ViewGroup container, Bundle savedinstancestate) { // Inflate the layout for this fragment return inflater.inflate(r.layout.fragment_fraggy_one, container, false); Corresponding Activity: layout <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:orientation="vertical" > <fragment android:name="ca.brocku.efoxwell.a2017_fifthstage.fraggyonefrag" android:id="@+id/fragonefrag" tools:layout="@layout/fragment_fraggy_one" Corresponding Activity: code public class FraggyOne extends AppCompatActivity protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_fraggyone); public void thatsit(view v) { startactivity(new Intent(this,MainActivity.class));
8 Of course, we'll be wanting to change that MainActivity.class to our actual next Activity later. In this case, we just had the Activity handle the button click because it was easier. But we can always get our Activity's application context, if necessary. Also note that, in the layout file for the Activity, there's an entry explicitly stating which layout to use. That doesn't really mean much, functionality-wise. Rather, it's a hint to Android Studio, so it knows how to preview the final appearance of the total Activity. That example was boring This is true. Let's move on to using two Fragments in the same Activity, but still displaying them both. Let's say we'll want them to be stacked if in portrait, and side-by-side in landscape. Second example For this one, create the new Activity, EfficientLayout, and let the button start it. We'll get to filling it out in a moment. First, some boilerplate. I'll create Fragments of EfficientFruitFrag and EfficientViewFrag, and let Android Studio provide the layout files for them. Let's start by putting both Fragments into the Activity's layout. Activity layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" xmlns:app=" android:name="ca.brocku.efoxwell.a2017_fifthstage.efficientfruitfrag" tools:context="ca.brocku.efoxwell.a2017_fifthstage.efficientlayout" android:orientation="vertical"> <fragment android:layout_height="0dip" android:layout_weight="4" android:id="@+id/effragfruit" tools:layout="@layout/fragment_efficient_fruit" <fragment android:layout_height="0dip" android:layout_weight="2" android:id="@+id/effragview" android:name="ca.brocku.efoxwell.a2017_fifthstage.efficientviewfrag" tools:layout="@layout/fragment_efficient_view" <Button android:layout_height="0dip" android:layout_weight="1" android:onclick="nexteroonie"
9 Activity layout, landscape version: For this one, we just need to create the new version, change the vertical to horizontal, and tweak the width/height properties a bit. Activity code: public class EfficientLayout extends AppCompatActivity protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_efficient_layout); public void nexteroonie(view v) { //start the next activity Fruit list fragment, layout: <LinearLayout xmlns:android=" tools:context=".efficientfruitfrag" android:orientation="vertical"> <ListView android:id="@+id/fruits_list" android:drawselectorontop="false" Fruit view fragment, layout: <LinearLayout xmlns:android=" tools:context=".efficientviewfrag" android:orientation="vertical"> <TextView android:text="what kind of fruit do you like?" android:id="@+id/selectedopt" So far, so good, right? Next, we'll want to populate the list, and have it change the TextView to indicate the selection. But, wait, that's in another Fragment, isn't it? Doesn't that make it difficult? Nope.
10 Fruit view fragment, code: public class EfficientFruitFrag extends Fragment public View oncreateview(layoutinflater inflater, ViewGroup container, Bundle savedinstancestate) { //First, let's get access to the Activity enclosing this Fragment Context c=getactivity().getapplicationcontext(); //Next, we need to build up the layout View vw=inflater.inflate(r.layout.fragment_efficient_fruit,container,false); final String[] fruits={"apple","pear","applepear","pear of Apples","Purple"; ListView flist=(listview)vw.findviewbyid(r.id.fruits_list); ArrayAdapter<String> adapter=new ArrayAdapter<>( c,android.r.layout.simple_list_item_1,fruits ); flist.setadapter(adapter); flist.setonitemclicklistener(new AdapterView.OnItemClickListener(){ public void onitemclick( AdapterView<?> parent, View v, int position, long id ) { TextView selected=(textview)getactivity().findviewbyid(r.id.selectedopt); selected.settext("i also like "+((TextView)v).getText().toString()); ); return vw; Give it a try, and you'll see that it works perfectly!... wait a minute... mostly perfectly? Can you spot the issue? If not, we can just fix it together. I don't like the portrait version Nah, me neither. As mentioned earlier, a big part of the reason to use Fragments is so we can not only reorganize them, but also separate them. Let's try tweaking just the portrait version of the Activity's layout: New Activity layout, portrait version: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" xmlns:app=" tools:context="ca.brocku.efoxwell.a2017_fifthstage.efficientlayout" android:orientation="vertical"> <fragment android:layout_height="0dip" android:layout_weight="4"
11 android:name="ca.brocku.efoxwell.a2017_fifthstage.efficientfruitfrag" <Button android:layout_height="0dip" android:layout_weight="1" android:onclick="nexteroonie" Note: All we did was to remove the second fragment. Fruit list fragment, code change: All we need to do is to change the onitemclick method as follows: public void onitemclick(adapterview<?> parent, View v, int position, long id) { if (getresources().getconfiguration().orientation== Configuration.ORIENTATION_LANDSCAPE) { TextView selected=(textview)getactivity().findviewbyid(r.id.selectedopt); selected.settext("i also like "+((TextView)v).getText().toString()); else { Intent intent=new Intent(getActivity().getApplicationContext(), EfficientItemActivity.class); intent.putextra("item",((textview)v).gettext().tostring()); startactivity(intent); Basically, if we're in a landscape orientation (meaning the other fragment is already there), do the exact same thing as before. However, if we're in portrait, we'll need to start a new Activity. Wait, what new Activity? Guess we'd better make one! However, we do not need to make a new layout for this one! Fruit view activity, code: public class EfficientItemActivity extends AppCompatActivity protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); if (getresources().getconfiguration().orientation== Configuration.ORIENTATION_LANDSCAPE) { finish(); return; setcontentview(r.layout.fragment_efficient_view); Bundle extras=getintent().getextras(); if (extras!=null) { String selected=extras.getstring("item"); TextView tv=(textview)findviewbyid(r.id.selectedopt); tv.settext("i, too, like "+selected);
12 It's worth noting that this topic is actually far larger than this example (big surprise, eh?). For example, we can create Fragments programmatically, pass information between them (e.g. via Bundles or articles), and even save them on a stack (similar to how Activities are pushed onto the Activity stack), so you can retain a fragment's state if you need to switch away for a moment. There's a very good read here: However, what we've seen so far is a decent first endeavour. It's also worth mentioning some of the other types of Fragment provided by Android. For example, there's a DialogFragment, to let you do largely the same thing as dialogs. There's also a PreferenceFragment, which can attach to the Shared Preferences. We'll probably be talking a bit about those in a week or so.
Adapting to Data. Before we get to the fun stuff... Initial setup
Adapting to Data So far, we've mostly been sticking with a recurring theme: visual elements are tied to XML-defined resources, not programmatic creation or management. But that won't always be the case.
More informationListView Containers. Resources. Creating a ListView
ListView Containers Resources https://developer.android.com/guide/topics/ui/layout/listview.html https://developer.android.com/reference/android/widget/listview.html Creating a ListView A ListView is a
More informationFragments were added to the Android API in Honeycomb, API 11. The primary classes related to fragments are: android.app.fragment
FRAGMENTS Fragments An activity is a container for views When you have a larger screen device than a phone like a tablet it can look too simple to use phone interface here. Fragments Mini-activities, each
More informationManaging Data. However, we'll be looking at two other forms of persistence today: (shared) preferences, and databases.
Managing Data This week, we'll be looking at managing information. There are actually many ways to store information for later retrieval. In fact, feel free to take a look at the Android Developer pages:
More informationUI Fragment.
UI Fragment 1 Contents Fragments Overviews Lifecycle of Fragments Creating Fragments Fragment Manager and Transactions Adding Fragment to Activity Fragment-to-Fragment Communication Fragment SubClasses
More informationEventually, you'll be returned to the AVD Manager. From there, you'll see your new device.
Let's get started! Start Studio We might have a bit of work to do here Create new project Let's give it a useful name Note the traditional convention for company/package names We don't need C++ support
More informationCS371m - Mobile Computing. More UI Navigation, Fragments, and App / Action Bars
CS371m - Mobile Computing More UI Navigation, Fragments, and App / Action Bars EFFECTIVE ANDROID NAVIGATION 2 Clicker Question Have you heard of the terms Back and Up in the context of Android Navigation?
More informationFragments. Lecture 11
Fragments Lecture 11 Situational layouts Your app can use different layouts in different situations Different device type (tablet vs. phone vs. watch) Different screen size Different orientation (portrait
More informationCreating a Custom ListView
Creating a Custom ListView References https://developer.android.com/guide/topics/ui/declaring-layout.html#adapterviews Overview The ListView in the previous tutorial creates a TextView object for each
More informationCS371m - Mobile Computing. More UI Action Bar, Navigation, and Fragments
CS371m - Mobile Computing More UI Action Bar, Navigation, and Fragments ACTION BAR 2 Options Menu and Action Bar prior to Android 3.0 / API level 11 Android devices required a dedicated menu button Pressing
More informationUser Interface Development. CSE 5236: Mobile Application Development Instructor: Adam C. Champion Course Coordinator: Dr.
User Interface Development CSE 5236: Mobile Application Development Instructor: Adam C. Champion Course Coordinator: Dr. Rajiv Ramnath 1 Outline UI Support in Android Fragments 2 UI Support in the Android
More informationAndroid Dialogs. Dialogs are simple visual objects that pop up and display a message or prompt for some user input.
Android Dialogs Dialogs are simple visual objects that pop up and display a message or prompt for some user input. Create a new Android project with a suitable name and package. To begin with it will have
More informationCS 4330/5390: Mobile Application Development Exam 1
1 Spring 2017 (Thursday, March 9) Name: CS 4330/5390: Mobile Application Development Exam 1 This test has 8 questions and pages numbered 1 through 7. Reminders This test is closed-notes and closed-book.
More informationMVC Apps Basic Widget Lifecycle Logging Debugging Dialogs
Overview MVC Apps Basic Widget Lifecycle Logging Debugging Dialogs Lecture: MVC Model View Controller What is an App? Android Activity Lifecycle Android Debugging Fixing Rotations & Landscape Layouts Localization
More informationMobile Development Lecture 10: Fragments
Mobile Development Lecture 10: Fragments Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Elgayyar.weebly.com Situational Layouts Your app can use different layout in different situations: different device type
More informationLayout and Containers
Geez, that title is freakin' huge. Layout and Containers This week, we'll mostly just be looking at how to better-arrange elements. That will include our first introduction into managed resources (even
More informationAgenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen
Gill Cleeren Agenda Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen Lists and navigation Navigating from master to detail Optimizing the application Preparing
More informationTablets have larger displays than phones do They can support multiple UI panes / user behaviors at the same time
Tablets have larger displays than phones do They can support multiple UI panes / user behaviors at the same time The 1 activity 1 thing the user can do heuristic may not make sense for larger devices Application
More informationMITOCW ocw f99-lec07_300k
MITOCW ocw-18.06-f99-lec07_300k OK, here's linear algebra lecture seven. I've been talking about vector spaces and specially the null space of a matrix and the column space of a matrix. What's in those
More informationFormal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5
Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5 [talking head] This lecture we study theory design and implementation. Programmers have two roles to play here. In one role, they
More informationMobile Computing Fragments
Fragments APM@FEUP 1 Fragments (1) Activities are used to define a full screen interface and its functionality That s right for small screen devices (smartphones) In bigger devices we can have more interface
More informationAzon Master Class. By Ryan Stevenson Guidebook #5 WordPress Usage
Azon Master Class By Ryan Stevenson https://ryanstevensonplugins.com/ Guidebook #5 WordPress Usage Table of Contents 1. Widget Setup & Usage 2. WordPress Menu System 3. Categories, Posts & Tags 4. WordPress
More informationThe Stack, Free Store, and Global Namespace
Pointers This tutorial is my attempt at clarifying pointers for anyone still confused about them. Pointers are notoriously hard to grasp, so I thought I'd take a shot at explaining them. The more information
More informationANDROID USER INTERFACE
1 ANDROID USER INTERFACE Views FUNDAMENTAL UI DESIGN Visual interface element (controls or widgets) ViewGroup Contains multiple widgets. Layouts inherit the ViewGroup class Activities Screen being displayed
More informationMobile Programming Lecture 3. Resources, Selection, Activities, Intents
Mobile Programming Lecture 3 Resources, Selection, Activities, Intents Lecture 2 Review What widget would you use to allow the user to enter a yes/no value a range of values from 1 to 100 What's the benefit
More informationProduced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology
Mobile Application Development Produced by David Drohan (ddrohan@wit.ie) Department of Computing & Mathematics Waterford Institute of Technology http://www.wit.ie User Interface Design" & Development -
More informationMobile Programming Lecture 7. Dialogs, Menus, and SharedPreferences
Mobile Programming Lecture 7 Dialogs, Menus, and SharedPreferences Agenda Dialogs Menus SharedPreferences Android Application Components 1. Activity 2. Broadcast Receiver 3. Content Provider 4. Service
More informationDeveloping Android Applications Introduction to Software Engineering Fall Updated 1st November 2015
Developing Android Applications Introduction to Software Engineering Fall 2015 Updated 1st November 2015 Android Lab 3 & Midterm Additional Concepts No Class Assignment 2 Class Plan Android : Additional
More informationAndroid Specifics. Jonathan Diehl (Informatik 10) Hendrik Thüs (Informatik 9)
Android Specifics Jonathan Diehl (Informatik 10) Hendrik Thüs (Informatik 9) Android Specifics ArrayAdapter Preferences Widgets Jonathan Diehl, Hendrik Thüs 2 ArrayAdapter Jonathan Diehl, Hendrik Thüs
More informationCMSC436: Fall 2013 Week 3 Lab
CMSC436: Fall 2013 Week 3 Lab Objectives: Familiarize yourself with the Activity class, the Activity lifecycle, and the Android reconfiguration process. Create and monitor a simple application to observe
More information10.1 Introduction. Higher Level Processing. Word Recogniton Model. Text Output. Voice Signals. Spoken Words. Syntax, Semantics, Pragmatics
Chapter 10 Speech Recognition 10.1 Introduction Speech recognition (SR) by machine, which translates spoken words into text has been a goal of research for more than six decades. It is also known as automatic
More informationQ.1 Explain the dialog and also explain the Demonstrate working dialog in android.
Q.1 Explain the dialog and also explain the Demonstrate working dialog in android. - A dialog is a small window that prompts the user to make a decision or enter additional information. - A dialog does
More informationAndroid CardView Tutorial
Android CardView Tutorial by Kapil - Wednesday, April 13, 2016 http://www.androidtutorialpoint.com/material-design/android-cardview-tutorial/ YouTube Video We have already discussed about RecyclerView
More informationAndroid User Interfaces. Hsiao-Lung Chan, Ph.D. Dept Electrical Engineering Chang Gung University, Taiwan
Android User Interfaces Hsiao-Lung Chan, Ph.D. Dept Electrical Engineering Chang Gung University, Taiwan chanhl@maili.cgu.edu.tw Basic control components Text components TextView EditText Button compoents
More informationMultiple devices. Use wrap_content and match_parent Use RelativeLayout/ConstraintLayout Use configuration qualifiers
Multiple devices Multiple devices Use wrap_content and match_parent Use RelativeLayout/ConstraintLayout Use configuration qualifiers Create a new directory in your project's res/ and name it using the
More informationCreating a User Interface
Creating a User Interface Developing for Android devices is a complicated process that requires precision to work with. Android runs on numerous devices from smart-phones to tablets. Instead of using a
More informationBuilding User Interface for Android Mobile Applications II
Building User Interface for Android Mobile Applications II Mobile App Development 1 MVC 2 MVC 1 MVC 2 MVC Android redraw View invalidate Controller tap, key pressed update Model MVC MVC in Android View
More informationPost Experiment Interview Questions
Post Experiment Interview Questions Questions about the Maximum Problem 1. What is this problem statement asking? 2. What is meant by positive integers? 3. What does it mean by the user entering valid
More informationMobile Programming Lecture 2. Layouts, Widgets, Toasts, and Event Handling
Mobile Programming Lecture 2 Layouts, Widgets, Toasts, and Event Handling Lecture 1 Review How to edit XML files in Android Studio? What holds all elements (Views) that appear to the user in an Activity?
More informationFragments. Lecture 10
Fragments Lecture 10 Situa2onal layouts Your app can use different layouts in different situa2ons Different device type (tablet vs. phone vs. watch) Different screen size Different orienta2on (portrait
More informationSolving an Android Threading Problem
Home Java News Brief Archive OCI Educational Services Solving an Android Threading Problem Introduction by Eric M. Burke, Principal Software Engineer Object Computing, Inc. (OCI) By now, you probably know
More informationCS 4518 Mobile and Ubiquitous Computing Lecture 5: Rotating Device, Saving Data, Intents and Fragments Emmanuel Agu
CS 4518 Mobile and Ubiquitous Computing Lecture 5: Rotating Device, Saving Data, Intents and Fragments Emmanuel Agu Administrivia Moved back deadlines for projects 2, 3 and final project See updated schedule
More informationEMBEDDED SYSTEMS PROGRAMMING Application Tip: Managing Screen Orientation
EMBEDDED SYSTEMS PROGRAMMING 2016-17 Application Tip: Managing Screen Orientation ORIENTATIONS Portrait Landscape Reverse portrait Reverse landscape ON REVERSE PORTRAIT Android: all four orientations are
More informationInstructor: Craig Duckett. Lecture 04: Thursday, April 5, Relationships
Instructor: Craig Duckett Lecture 04: Thursday, April 5, 2018 Relationships 1 Assignment 1 is due NEXT LECTURE 5, Tuesday, April 10 th in StudentTracker by MIDNIGHT MID-TERM EXAM is LECTURE 10, Tuesday,
More informationGetting Started. Dr. Miguel A. Labrador Department of Computer Science & Engineering
Getting Started Dr. Miguel A. Labrador Department of Computer Science & Engineering labrador@csee.usf.edu http://www.csee.usf.edu/~labrador 1 Goals Setting up your development environment Android Framework
More informationCS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu
CS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu Android Activity LifeCycle Starting Activities Android applications don't start with a call to main(string[])
More informationAndroid Application Model I
Android Application Model I CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr. Rajiv Ramnath Reading: Big Nerd Ranch Guide, Chapters 3, 5 (Activities);
More informationCSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015
CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015 Comment and Evaluation: This lab introduces us about Android SDK and how to write a program for Android platform. The calculator is pretty easy, everything
More informationResources and Media and Dealies
Resources and Media and Dealies In the second week, we created a new project that came with several files. The layout was kept in a res/layout folder. last week, we looked at a landscape layout, in the
More informationMobile Programming Lecture 5. Composite Views, Activities, Intents and Filters
Mobile Programming Lecture 5 Composite Views, Activities, Intents and Filters Lecture 4 Review How do you get the value of a string in the strings.xml file? What are the steps to populate a Spinner or
More informationVienos veiklos būsena. Theory
Vienos veiklos būsena Theory While application is running, we create new Activities and close old ones, hide the application and open it again and so on, and Activity can process all these events. It is
More informationAccelerating Information Technology Innovation
Accelerating Information Technology Innovation http://aiti.mit.edu India Summer 2012 Review Session Android and Web Working with Views Working with Views Create a new Android project. The app name should
More informationUnderstand applications and their components. activity service broadcast receiver content provider intent AndroidManifest.xml
Understand applications and their components activity service broadcast receiver content provider intent AndroidManifest.xml Android Application Written in Java (it s possible to write native code) Good
More informationActivities and Fragments
Activities and Fragments 21 November 2017 Lecture 5 21 Nov 2017 SE 435: Development in the Android Environment 1 Topics for Today Activities UI Design and handlers Fragments Source: developer.android.com
More informationSkill 1: Multiplying Polynomials
CS103 Spring 2018 Mathematical Prerequisites Although CS103 is primarily a math class, this course does not require any higher math as a prerequisite. The most advanced level of mathematics you'll need
More informationAndroid Application Model I. CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr.
Android Application Model I CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr. Rajiv Ramnath 1 Framework Support (e.g. Android) 2 Framework Capabilities
More informationEMBEDDED SYSTEMS PROGRAMMING UI and Android
EMBEDDED SYSTEMS PROGRAMMING 2016-17 UI and Android STANDARD GESTURES (1/2) UI classes inheriting from View allow to set listeners that respond to basic gestures. Listeners are defined by suitable interfaces.
More informationPractical 1.ListView example
Practical 1.ListView example In this example, we show you how to display a list of fruit name via ListView. Android Layout file File : res/layout/list_fruit.xml
More informationSmart formatting for better compatibility between OpenOffice.org and Microsoft Office
Smart formatting for better compatibility between OpenOffice.org and Microsoft Office I'm going to talk about the backbreaking labor of helping someone move and a seemingly unrelated topic, OpenOffice.org
More informationChapter 1 Getting Started
Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different
More informationNaming Things in Adafruit IO
Naming Things in Adafruit IO Created by Adam Bachman Last updated on 2016-07-27 09:29:53 PM UTC Guide Contents Guide Contents Introduction The Two Feed Identifiers Name Key Aside: Naming things in MQTT
More informationMITOCW watch?v=0jljzrnhwoi
MITOCW watch?v=0jljzrnhwoi The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To
More informationIn our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology.
Guide to and Hi everybody! In our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology. This guide focuses on two of those symbols: and. These symbols represent concepts
More informationCS 4518 Mobile and Ubiquitous Computing Lecture 4: Data-Driven Views, Android Components & Android Activity Lifecycle Emmanuel Agu
CS 4518 Mobile and Ubiquitous Computing Lecture 4: Data-Driven Views, Android Components & Android Activity Lifecycle Emmanuel Agu Announcements Group formation: Projects 2, 3 and final project will be
More informationSouth Africa Version Control.
South Africa 2013 Lecture 7: User Interface (Navigation)+ Version Control http://aiti.mit.edu South Africa 2013 Today s agenda Recap Navigation Version Control 2 Tutorial Recap Activity 1 Activity 2 Text
More informationMITOCW ocw f99-lec12_300k
MITOCW ocw-18.06-f99-lec12_300k This is lecture twelve. OK. We've reached twelve lectures. And this one is more than the others about applications of linear algebra. And I'll confess. When I'm giving you
More informationExternal Services. CSE 5236: Mobile Application Development Course Coordinator: Dr. Rajiv Ramnath Instructor: Adam C. Champion
External Services CSE 5236: Mobile Application Development Course Coordinator: Dr. Rajiv Ramnath Instructor: Adam C. Champion 1 External Services Viewing websites Location- and map-based functionality
More informationAction Bar. (c) 2010 Haim Michael. All Rights Reserv ed.
Action Bar Introduction The Action Bar is a widget that is shown on top of the screen. It includes the application logo on its left side together with items available from the options menu on the right.
More informationEECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University. Overview (Review)
EECS 4443 Mobile User Interfaces More About Layouts Scott MacKenzie York University Overview (Review) A layout defines the visual structure for a user interface, such as the UI for an activity or app widget
More informationCHAPTER 4. Fragments ActionBar Menus
CHAPTER 4 Fragments ActionBar Menus Explore how to build applications that use an ActionBar and Fragments Understand the Fragment lifecycle Learn to configure the ActionBar Implement Fragments with Responsive
More informationINTRODUCTION COS MOBILE DEVELOPMENT WHAT IS ANDROID CORE OS. 6-Android Basics.key - February 21, Linux-based.
1 COS 470 - MOBILE DEVELOPMENT INTRODUCTION 2 WHAT IS ANDROID Linux-based Java/Kotlin Android Runtime (ART) System Apps SMS, Calendar, etc. Platform Architecture 3 CORE OS Linux (64 bit) Each app is a
More informationLinked Lists. What is a Linked List?
Linked Lists Along with arrays, linked lists form the basis for pretty much every other data stucture out there. This makes learning and understand linked lists very important. They are also usually the
More informationFormal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5
Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5 [talking head] Formal Methods of Software Engineering means the use of mathematics as an aid to writing programs. Before we can
More informationCSE143 Notes for Monday, 4/25/11
CSE143 Notes for Monday, 4/25/11 I began a new topic: recursion. We have seen how to write code using loops, which a technique called iteration. Recursion an alternative to iteration that equally powerful.
More informationLab 1 - Setting up the User s Profile UI
Lab 1 - Setting up the User s Profile UI Getting started This is the first in a series of labs that allow you to develop the MyRuns App. The goal of the app is to capture and display (using maps) walks
More informationMobile Computing Professor Pushpedra Singh Indraprasth Institute of Information Technology Delhi Andriod Development Lecture 09
Mobile Computing Professor Pushpedra Singh Indraprasth Institute of Information Technology Delhi Andriod Development Lecture 09 Hello, today we will create another application called a math quiz. This
More informationLesson 3 Transcript: Part 1 of 2 - Tools & Scripting
Lesson 3 Transcript: Part 1 of 2 - Tools & Scripting Slide 1: Cover Welcome to lesson 3 of the db2 on Campus lecture series. Today we're going to talk about tools and scripting, and this is part 1 of 2
More informationHi everyone. Starting this week I'm going to make a couple tweaks to how section is run. The first thing is that I'm going to go over all the slides
Hi everyone. Starting this week I'm going to make a couple tweaks to how section is run. The first thing is that I'm going to go over all the slides for both problems first, and let you guys code them
More informationEMBEDDED SYSTEMS PROGRAMMING Application Basics
EMBEDDED SYSTEMS PROGRAMMING 2015-16 Application Basics APPLICATIONS Application components (e.g., UI elements) are objects instantiated from the platform s frameworks Applications are event driven ( there
More informationIntents. Your first app assignment
Intents Your first app assignment We will make this. Decidedly lackluster. Java Code Java Code XML XML Preview XML Java Code Java Code XML Buttons that work
More informationMost of the class will focus on if/else statements and the logical statements ("conditionals") that are used to build them. Then I'll go over a few
With notes! 1 Most of the class will focus on if/else statements and the logical statements ("conditionals") that are used to build them. Then I'll go over a few useful functions (some built into standard
More informationMobile Computing Practice # 2c Android Applications - Interface
Mobile Computing Practice # 2c Android Applications - Interface One more step in the restaurants application. 1. Design an alternative layout for showing up in landscape mode. Our current layout is not
More informationEECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University
EECS 4443 Mobile User Interfaces More About Layouts Scott MacKenzie York University Overview (Review) A layout defines the visual structure for a user interface, such as the UI for an activity or app widget
More informationAndroid Programming: More User Interface. CS 3: Computer Programming in Java
Android Programming: More User Interface CS 3: Computer Programming in Java Objectives Look at implementation of the UI from our tip calculator example Discuss dialogs Find out about fragments Revisiting
More informationMITOCW watch?v=flgjisf3l78
MITOCW watch?v=flgjisf3l78 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high-quality educational resources for free. To
More informationMITOCW watch?v=yarwp7tntl4
MITOCW watch?v=yarwp7tntl4 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality, educational resources for free.
More informationCreate new Android project in Android Studio Add Button and TextView to layout Learn how to use buttons to call methods. Modify strings.
Hello World Lab Objectives: Create new Android project in Android Studio Add Button and TextView to layout Learn how to use buttons to call methods. Modify strings.xml What to Turn in: The lab evaluation
More informationOur First Android Application
Mobile Application Development Lecture 04 Imran Ihsan Our First Android Application Even though the HelloWorld program is trivial in introduces a wealth of new ideas the framework, activities, manifest,
More informationIntroduction. Using Styles. Word 2010 Styles and Themes. To Select a Style: Page 1
Word 2010 Styles and Themes Introduction Page 1 Styles and themes are powerful tools in Word that can help you easily create professional looking documents. A style is a predefined combination of font
More informationUpon completion of the second part of the lab the students will have:
ETSN05, Fall 2017, Version 2.0 Software Development of Large Systems Lab 2 1. INTRODUCTION The goal of lab 2 is to introduce students to the basics of Android development and help them to create a starting
More information05. SINGLETON PATTERN. One of a Kind Objects
BIM492 DESIGN PATTERNS 05. SINGLETON PATTERN One of a Kind Objects Developer: What use is that? Guru: There are many objects we only need one of: thread pools, caches, dialog boxes, objects that handle
More informationACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi
ACTIVITY, FRAGMENT, NAVIGATION Roberto Beraldi Introduction An application is composed of at least one Activity GUI It is a software component that stays behind a GUI (screen) Activity It runs inside the
More informationMITOCW MIT6_172_F10_lec18_300k-mp4
MITOCW MIT6_172_F10_lec18_300k-mp4 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for
More informationProgramming with Android: Android for Tablets. Dipartimento di Scienze dell Informazione Università di Bologna
Programming with Android: Android for Tablets Luca Bedogni Marco Di Felice Dipartimento di Scienze dell Informazione Università di Bologna Outline Android for Tablets: A Case Study Android for Tablets:
More informationAndroid Basics. Android UI Architecture. Android UI 1
Android Basics Android UI Architecture Android UI 1 Android Design Constraints Limited resources like memory, processing, battery à Android stops your app when not in use Primarily touch interaction à
More informationAndroid Data Binding: This is the DSL you're looking for
Android Data Binding: This is the DSL you're looking for Maksim Lin Freelance Android Developer www.manichord.com The plan Why Data Binding? Brief intro to Data Binding Library Adding Data Binding to an
More informationAdaptation of materials: dr Tomasz Xięski. Based on presentations made available by Victor Matos, Cleveland State University.
Creating dialogs Adaptation of materials: dr Tomasz Xięski. Based on presentations made available by Victor Matos, Cleveland State University. Portions of this page are reproduced from work created and
More informationThe following content is provided under a Creative Commons license. Your support
MITOCW Lecture 10 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high-quality educational resources for free. To make a
More informationMobile Application Development MyRent Settings
Mobile Application Development MyRent Settings Waterford Institute of Technology October 13, 2016 John Fitzgerald Waterford Institute of Technology, Mobile Application Development MyRent Settings 1/19
More information1 Getting used to Python
1 Getting used to Python We assume you know how to program in some language, but are new to Python. We'll use Java as an informal running comparative example. Here are what we think are the most important
More information