<<  The 28 th of February Kharkov National Medical University  >>
The evolution of a Activity
The evolution of a Activity
Programming the Android

: kmicinski. , . , Programming the Android.ppt zip- 611 .

Programming the Android

Programming the Android.ppt
1Programming the Android. Kristopher 12your Views actions: Set an onClick
Micinski, Secretary, ACM Chapter, MSU ACM handler for some button? Find out what
Fall Activity Series, 2010 October 21st, other Activities you want to talk to: When
2010. do you want to change screens? For
2Welcome! Welcome to the first talk in example, go to PassportBrowser from
the ACM Activity series for Fall 2010: DocumentDisplay. Then use an Intent
Okay, so this one is more of a lecture. 13Intents. BrowseContents Running. How
But theres pizza over there. The goal of does an Activity (or any other runnable
the Activity series is to cover topics Android object) get started? We use the
that you might be interested in, but wont Intent class to ask the Android OS to
cover in class because they take too much start some Activity, Service, etc Then
time or dont directly relate to the the OS schedules that Activity to run, and
material. So any of your ideas would that Activity has its onCreate (or
really help for future events: LaTeX? onResume, etc) method called. Intents are
Linux kernel internals. How does your used to represent most inter-process
toolchain really work? An introduction to requests in Android: Dialing a number
F#. Believe it or not, when you search Sending a text Starting a new Activity
Google for LaTeX, you dont get the within your application So the system will
software package generate Intents, and so will your app!
3Outline of the talk. Today were EditContent running. Notice! Here the red
talking about how to write applications on transitions are the events initiated by
the Android operating system. First: What the Android OS, and the green transitions
makes mobile application development are created by your application!
different? A broad overview of the Android 14Services. Services provide a way for
approach. Android programming: Covering your application to handle events in the
the three basic classes: Activities background, without being explicitly
Services Content providers Example associated with a View. However, services
application: MSU Cafeteria menus What dont reside in their own thread! So dont
should I take out of the talk? Hopefully perform things like network connections in
you get a broad overview of the system, a service, you will block the main thread!
but youll have to go read about / play However, what can you do? Use your Service
around with the sample code and experiment class to provide an interface to a
to understand more. background thread Can call back to main
4Section I. Introduction, Mobile activity using a Handler class. Main
Programming, Android overview. Activity. Service. Downloading Threads
5Why is mobile programming different? (maybe thread pool?). New worker thread.
So why cant we just put our desktop code Worker Thread (downloading). User selects
on a mobile device verbatim? Easy answer: item to download.
mobile devices have different types of 15Storing long term data. Eventually
resources (RAM, long term storage, etc) youll want to store long term data in
than your laptop. Slightly more difficult your program. You can use the
answer: The field is moving quickly, SharedPreferences class to store simple
driven by industry, companies are driven key-value pairs Simple interface, call
by time to market. Consequence: APIs are getSharedPreferences and then use call
specific to devices. Mobile devices have getString, getBoolean, etc However,
increased RAM daily, so why dont we wait youll probably want to use more
until we have enough? Easy answer, we complicated storage. Android provides an
never will Harder answer: Other SQLite interface Also ContentProviders
differences too. Device manufacturers or provide inter process data storage. The
other big companies give you the tool best solution is to use the Android
chain. The API is restricted: Dont want a interface to SQLite: Lightweight database
program to send data or text without your based on SQL Fairly powerful, cant notice
knowledge! User interaction is different the difference between SQLite and SQL
on a mobile device (small screen?). unless you have a large database You make
6Practical Matters Youll write your queries to the database in standard SQL:
code in Java, and using the android API. SELECT ID, CITY, STATE FROM STATION WHERE
It might not do everything you want! I had LAT_N > 39.7; Then your application
to write my own class to output DOM based provides a handler to interface the SQL
XML. Also, it changes, your app might database to other applications via a
require the newer APIs. The SDK, emulator, content provider: Look at an example!
etc... Is all free! Uses Eclipse for the 16Content Providers. Content providers
IDE, you might be able to get VS to work? abstract data storage to other
A few basic classes, then lots of smaller applications, activities, services, etc
utility classes: Some classes are Android Again, fairly SQL based. You will
specific I strongly encourage you to do construct a ContentProvider class that
the following: Go through the slides in will override methods such as insert(),
this talk first, and then the sample delete(), and update(). Then you register
application. Go to the Android developer your content provider with a URI to handle
documentation, and read through the main different types of objects. Unique
pages / classes. Start working on your own Resource Identifier (kind of like a URL).
applications, and then when you get stuck, For example, lets say we want our content
read the documentation. provider to allow other applications to
7Installing the SDK. access our database of bicycles and also
http://developer.android.com/sdk/installin customers. We define methods for
.html Describes in lengthy detail how to inserting, deleting, updating, etc
do this, but Ill give a quick overview. bicycles and customers. Then we publish
First download Eclipse: two URIs: BICYCLES_URI CUSTOMERS_URI Maybe
http://www.eclipse.org/ Next, download the more URIs for accessing bicycles indexed
Android SDK: by serial number?
http://developer.android.com/sdk/index.htm 17So, how do I design my program? The
Unzip the SDK and run the SDK manager in way the system architecture is set up if
the directory you unzip, then install all fairly open: Program design is somewhat up
of the extra required packages, etc Be to you, but you still have to live with
sure to poke around in the SDK directory, the Android execution model. Start with
there are lots of samples, documentation, the different screens that the user will
and more! Create a new virtual device so see. These are the different Activities
that you can run an emulator. Then go into that will comprise your system. Think
eclipse and download the Android developer about the transitions between the screens,
tools: Go to Help->Install new these will be the Intents passed between
software and add the following URL the Activities. Think about what
https://dl-ssl.google.com/android/eclipse/ background Services you need to
Now add a new name (just make one up?) and incorporate. Exchanging data Listening for
download You should be good to go from connections? Periodically downloading
here! Try doing a New->Project and network information from a server? Think
selecting a sample application! about what information must be stored in
8Section II. Basic Android programming long term memory and design a content
overview. provider around it. Now connect the
9The Android Approach. Based on the Activities, services, etc with Intents!
Model View Controller design pattern. Dont forget good OOP ?
Dont think of your program as a linear 18Section III. Sample Application: MSU
execution model: Think of your program as Cafeteria Menu Browser.
existing in logical blocks, each of which 19Designing our first Android App. We
performs some actions. The blocks want to design an application to view the
communicate back and forth via message menus for the MSU cafeterias. What is
passing, etc Added advantage, physical involved with this? What objects do we
user interaction (screen clicks) and inter have to deal with? A menu A cafeteria An
process interaction can have the same internet connection? For this application,
programming interface Also the scheduler Im going to use the ListActivity: This is
can bring different pieces of the app to an Activity with a top level container to
life depending on memory needs and program display a list with which the user can
use. For each distinct logical piece of interact. What background services are we
program behavior youll write a Java class going to need here? Im just going to use
(derived from a base class). Activities: a thread here, not enough work to set up
Things the user can see on the screen. an activity.
Basically, each different screen in your 20What type of input do we have? Lets
program. Services: Code that isnt visit http://www.eatatsate.com to find
associated with a screen (background, out! We can see that we can select a
fairly common) Content providers: Provides number of different cafeterias: Probably
an interface to exchange data between going to stick with this interface, so the
programs (usually SQL based) Kind of main Activity of our application will let
vague, but well given an example. us select cafeterias. With each of those
10Activities. Activities describe cafeterias we see that we can have a
individual screens with which a user could number of different stations: So down in
be interacting. Your program specifies a the hierarchy the user will select the
top level screen that runs upon station in which they are interested. For
application startup. Each Activity each cafeteria we have an RSS feed
performs its own actions, to execute a describing the current cafeteria menu. So
method in another Activity use an Intent. well need to keep track of what
The Activity base class already provides cafeterias go with what RSS feeds (URLS).
you with enough functionality to have a 21Our program design. Android Browser.
screen which does nothing Provides you MainScreen (Activity).
with an empty canvas! No pun intended The MenuDownloadingThread. New().
activity allows you to set the top level CafeteriasContentProvider.
GUI container. Then you instantiate some CafeteriaMenuDownloader.
Views (widgets), put them in a container 22What next? What should you do now? Go
View, and set the container as the download the Android SDK, even if you
Activitys top level View: This is what dont have an android phone this can still
gets displayed on the screen when the be fun! Then download the sample
Activity is running. We wont go too in application and go through. Set
depth on GUI programming here, lots of breakpoints at onCreate() and onResume()
documentation. The Activity is loaded by on the main activities. Nice debugger. You
the Android OS, then the appropriate can even debug two devices communicating
methods are called based on user to each other at the same time over
interaction (back button?). Bluetooth on the same computer! Dig around
11The evolution of a Activity. The in the documentation and read the docs on
Activity has a number of predefined the classes I mentioned. Be careful,
functions that you override to handle pressing next in the debugger doesnt
events from the system. If you dont always mean you will go to the next line.
specify what should be done the system Sometimes you will fall into an Android
will perform the default actions to handle binary class, so set lots of breakpoints.
events. Why would you want to handle Now try to modify the demo application:
events such as onPause(), etc ? You will Add caching! Create a add new cafeteria
probably want to do things like release Activity that allows you to enter a title
resources, stop network connections, etc and URL of the RSS feed for cafeterias and
12Steps to developing an Activity. add new ones to the database. Add a way to
Create a new class in your project, using delete cafeterias from the database, maybe
Activity as a base class. Then override automatically delete them after the
onCreate(), onResume(), etc as you need! connection does not work for a while?
Put your Activity in the android manifest: 23Thanks! Thanks for coming to the first
This is a file that specifies the in the ACM Activity series! Maybe some
different classes in your app, what they still free pizza, grab some. Be sure to
do, and how they interact. Easiest to see talk to me and tell me if you had any
examples of this, or you can use Eclipse comments or questions Also, were going to
to fill this out for you. Specify a use the ACM Listserv to support answers to
default View for the Activity. In the questions for these events. Send your
onCreate (usually) you set up handlers for questions there. Join the MSU ACM Chapter!
Programming the Android.ppt

Programming the Android

Programming the Android

the woman - The wife is the key to the house. A womans tongue wags like a lambs tail. . 9 , : A good wife makes a good husband. Un homme- . A man - . . .

The english-speaking countries - Great Britain. The English-speaking countries. Scotland. Disneyland. Australia. USA.

The green movement - The countries in which there are offices Greenpeace. One of the largest victories in the given campaign can name refusal of flooding of an oil platform brent spar as it contained many toxic substances. Green color which is used by participants of movement as the general emblem, serves as a symbol of the nature, hope and updating.

The animals - WHALE. KOALA. LIZARD. LION. PARROT. GORILLA. PENGUIN. BOBCAT. The animals which live in the rainforest and tropics. SNAKE. GRIFFIN. SEAL. The animals which live in the forest. REINDEER. TIGER. EMU. The animals which live in the polar regions. ZEBRA. KANGAROO. The animals which live in the desert. WOMBAT.

Dreamers - But dead mau5 pretty much shrugged it off. What failures they experienced? His first Business venture failed. What were some of the obstacles they faced? BILL GATES. What did they achieve? To a business that would create a software system to run on all computers (Windows). What was their dream? Dreamers.

Pointillism - Complete the sentences. 5. The beach Heist is painted by French artist. Choose the right variant. A still life with a book. and. In creation of his first paintings he was influenced by Monet. transparent paints. Pictures, belonging to this style are painted in. A Sunday afternoon on La Grande Jatte.


900igr.net > > > Programming the Android