Changes

Jump to: navigation, search

MAP524/DPS924 Lecture 5

516 bytes added, 15:44, 18 July 2015
no edit summary
= More complex views === Adapters ==
We'll finish the '''Spinner''' example from last week's lecture. Unlike the other Views we looked at last week it requires the use of an Adapter. See the [http://developer.android.com/guide/topics/ui/controls/spinner.html official documentation here]. Note that in the setup you have:
Here's a [https://github.com/codepath/android_guides/wiki/Using-an-ArrayAdapter-with-ListView nice tutorial on Adapters] generally with a ListView as a specific example.
== ListView ==
This should be as simple as a spinner, it appears to do essentially the same thing, but it's more complicated to build. Follow these steps:
* You should see a Toast with the selected colour name pop up.
== Context Menu ==
Add a Context Menu to the Scrollable List in the ListView example above. [http://developer.android.com/reference/android/view/ContextMenu.html Official documentation here].
}</pre>
* You can now run your app and test the context menu.
 
= Threads =
 
You shouldn't (and Android often enforces it) run long operations on the UI thread. That would result in a blocked user interface which is annoying on the desktop but extremely annoying on a slow mobile device. See the [http://developer.android.com/guide/components/processes-and-threads.html official documentation] for an overview.
 
We'll look at one means of doing hard processing work in the background without affecting the user interface: AsyncTask.
 
== AsyncTask ==

Navigation menu