Week 5 - Assets, Menus, Tween Animation, Logging, Generic Data Structures, Handler Flashcards

0
Q

How is the assets folder organised?

A

However the user wishes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

What is the purpose of the assets folder?

A

The assets folder contains user supplied files which are used in the app.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How are assets in the assets folder accessed?

A

By using the Android-supplied AssetManager class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How are the contents of an image asset loaded into the program using the AssetManager?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How are items added to the options menu?

A

By overriding the onCreateOptionsMenu(Menu) method. there are two options at this point:

  1. Call the menu.add(…) method to add items to the meny programatically.
  2. 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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How are option menu times made to react when selected?

A

By overriding the onOptionsSelected(MenuItem) method, checking which menu item was selected, and reacting accordingly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are Adroid animations used for?

A

To visually manipulate a view in a predetermined manner over time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Where are Android animations defined?

A

User created animations are defined in XML files stored in res/anim/.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How is an android animation loaded from an XML file?

A

Animation anim = AnimationUtils.loadAnimation(this, R.anim.my_animation);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How is a loaded Android animation applied to a view?

A

myView.startAnimation(loadedAnimation);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How are log messages usually issued?

A

By using the Log class.

Example:

Log.d(“Tag”, “Message”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What different type of messages can be issued via the Log class?

A

In order of priority:

  1. Error
  2. Warning
  3. Info
  4. Debug
  5. Verbose
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How are log messages issued via the Log class viewed in Eclipse?

A

By looking at the LogCat panel.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the tag used for in log messages issued via the Log class?

A

It is used to distinguish between different types of log messages, allowing the user to search for specific messages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are generic data types in Java used for?

A

They are used to hold different types of data without having to create a container for each contained type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the purpose of a thread Handler?

A

It receives and processes messages sent to it as a means a of thread-safe inter-thread communication.

16
Q

How is a thread created in Java?

A

This can be done a number of ways. The two most common ways is to either subclass the Thread class then override its run() method, or to implement Runnable and override its run() method.