Lecture 2 Flashcards

1
Q

What is a Layout concerned with?

A

Organising component views in rectangular areas

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

Each rectangular area in a layout may be fixed or scrollable

T or F

A

T

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

Each rectangular area normally overlaps with another in a layout

T or F

A

F

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

What are the challenges of Layouts?

A

Must work on multiple resolutions and orientations without losing functionality

Should look good and be usable (right text size etc.)

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

What is the difference between screen resolution and screen density?

A

Resolution: Total number of pixels in a display

Density: Number of pixels that fit into an inch

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

What is density independence?

A

The uniform display of UI elements on screens with different densities

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

How many millimeters per inch on android?

A

25.4

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

How many points per physical inch on android?

A

72

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

Are points density independent?

A

Yes

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

What do dp and sp stand for on android?

A

Density independent pixels

Scale independent pixels

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

Are dp and sp density independent?

A

Yes

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

How many dp and sp per physical inch?

A

160

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

What are density buckets? How many are there and what are they?

A

Categories of densities for which images must be optimised on android

6 - Low, medium, TV, high, extra high, extra extra high

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

Difference between margin and padding?

A

Margin on outside

Padding on inside

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

What are fill_parent/match_parent and wrap_content layout properties?

A

wrap_content wants to be just big enough to enclose its contents

fill_parent and match_parent try to be the same size as the parent

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

What are all layouts a subclass of?

A

GroupView

17
Q

What is LinearLayout?

A

all children aligned in a single direction vertically or horizontally

18
Q

What is RelativeLayout?

A

All child views are displayed in relative positions

19
Q

What is a WebView?

A

Displays web pages

20
Q

In LinearLayout, what properties does each child view have?

A

Width and Height - either wrap_content or match_parent, OR specified in px or dp

Gravity - which side of the screen it is attracted to (left, centre, right)

Margin

21
Q

How do you make a vertical layout work in device landscape mode?

A

Place layout file of the same name in the res/layout_land directory

Swap all heights for widths

22
Q

Why is switching layouts at runtime problematic?

A

Threads

23
Q

Which thread calls the onCreate of the main activity?

A

UI thread

24
Q

What is the best way to switch content views?

A

AsyncTask

25
Q

What two methods do you usually override in AsyncTasks?

A

doInBackground()

onPostExecute()

26
Q

What method might you override to show progress on progress bars with AsyncTasks?

A

publishProgress()

27
Q

What does using an AsyncTask guarantee?

A

All callback calls are synchronized in such a way that:

member fields set in constructor or onPreExecute can be accessed from doInBackground

member fields set in doInBackground can be accessed in onProgressUpdate and onPostExecute

28
Q

How can an AsyncTask be cancelled?

A

Invoke cancel(boolean)

29
Q

What should you do in doInBackground to ensure tasks can be cancelled?

A

Check isCancelled() regularly

30
Q

What is the main limit of AsyncTask?

A

Execution is bound to calling activity so rotating screen stops it