Week 5 - Assets, Menus, Tween Animation, Logging, Generic Data Structures, Handler Flashcards
How is the assets folder organised?
However the user wishes.
What is the purpose of the assets folder?
The assets folder contains user supplied files which are used in the app.
How are assets in the assets folder accessed?
By using the Android-supplied AssetManager class.
How are the contents of an image asset loaded into the program using the AssetManager?
One example (this is not the only way to do it):
AssetManager assets = getAssets(); try { InputStream is = assets.open("path/to/the_image_file.png"); // Do something with the input stream
} catch (Exception e) { // Handle error
} finally {
if (is != null) is.close();
}
How are items added to the options menu?
By overriding the onCreateOptionsMenu(Menu) method. there are two options at this point:
- Call the menu.add(…) method to add items to the meny programatically.
- Use the menu inflater to inflate an XML layout file containing the menu.
Then return true to display the menu, and return false to not display the menu.
How are option menu times made to react when selected?
By overriding the onOptionsSelected(MenuItem) method, checking which menu item was selected, and reacting accordingly.
What are Adroid animations used for?
To visually manipulate a view in a predetermined manner over time.
Where are Android animations defined?
User created animations are defined in XML files stored in res/anim/.
How is an android animation loaded from an XML file?
Animation anim = AnimationUtils.loadAnimation(this, R.anim.my_animation);
How is a loaded Android animation applied to a view?
myView.startAnimation(loadedAnimation);
How are log messages usually issued?
By using the Log class.
Example:
Log.d(“Tag”, “Message”);
What different type of messages can be issued via the Log class?
In order of priority:
- Error
- Warning
- Info
- Debug
- Verbose
How are log messages issued via the Log class viewed in Eclipse?
By looking at the LogCat panel.
What is the tag used for in log messages issued via the Log class?
It is used to distinguish between different types of log messages, allowing the user to search for specific messages.
What are generic data types in Java used for?
They are used to hold different types of data without having to create a container for each contained type.