Docsity

Android Programming Mid Term | CS 2114 - Softw Des & Data Structures, Quizzes of Computer Science

Toggle sidebar
bg1
TERM 1
Standard Hardware
DEFINITION 1
menu
home
back
and sometimes search
TERM 2
Folders of the program
DEFINITION 2
src/ - java source files anything you writegen/ - java files
created during compilation (do not modify)libs/ - compiled
code used for application 3rd partres/ - resources images and
GUI layoutsassets/ - similar to res
TERM 3
Package Structure
DEFINITION 3
requires that parts of your code be in a named package
Packages use reverse domain name scheme which must
be 2 names deep
TERM 4
Android Manifest XML
DEFINITION 4
specifies version and features, you can also change the
iconIncludes libraries as well "runtime configuration"Also
includes your permissions, anything that can be seen as a
security risk must be listed. If the permission isn't requested
then an exception was thrown.
TERM 5
Drawable Resources
DEFINITION 5
res/drawable-*/ this is where shapes, gradients and images
are here. Has subfolders for different screen resolutions
which can scale images or use different images for various
screens.
pf3
pf4
pf5

Partial preview of the text

Download Android Programming Mid Term | CS 2114 - Softw Des & Data Structures and more Quizzes Computer Science in PDF only on Docsity!

Standard Hardware

menu home back and sometimes search TERM 2

Folders of the program

DEFINITION 2 src/ - java source files anything you writegen/ - java files created during compilation (do not modify)libs/ - compiled code used for application 3rd partres/ - resources images and GUI layoutsassets/ - similar to res TERM 3

Package Structure

DEFINITION 3 requires that parts of your code be in a named package Packages use reverse domain name scheme which must be 2 names deep TERM 4

Android Manifest XML

DEFINITION 4 specifies version and features, you can also change the iconIncludes libraries as well "runtime configuration"Also includes your permissions, anything that can be seen as a security risk must be listed. If the permission isn't requested then an exception was thrown. TERM 5

Drawable Resources

DEFINITION 5 res/drawable-*/ this is where shapes, gradients and images are here. Has subfolders for different screen resolutions which can scale images or use different images for various screens.

Other Resources

res/layout - defines the GUI xml layoutres/menu - descriptions of menus for appsres/values - strings used in the app which makes translations easier and cleaner TERM 7

Resource Ids

DEFINITION 7 every widget and resource gets an id so that it can be referenced in the layout.res/layout/main.xml = > R.layout.mainfor the widgets etc. R.id.widgetLabel TERM 8

Types of App components

DEFINITION 8 Activities - a single screen with user interfaceServices - runs in the background, it calls an activity but it does not have it's own user interface.Content Providers - manage shared sets of application dataBroadcast Receivers - respond to system wide notifications such as low power TERM 9

Activities

DEFINITION 9 Each app has 1 activitythe activity class contains a model instance and a view instance it is the controller in the Android programs.They do not have a constructor instead the onCreate is used to initialize it.It sets up GUI initializes data and connects the views and controllers.It must call super.onCreate(SavedInstanceState) and then setContentView(R.layout.activity.main) all within the onCreate method. TERM 10

Advanced onCreate

Usage

DEFINITION 10 you can override onSaveInstanceState that way activities can write their state to that bundle in case they are terminated.

Custom Views

a subclass of ViewThey must have a constructor which takes a Context and an AttributeSet. This constructor must call super(Context, AttributeSet). You must also override the onDraw method which takes a canvas as a parameter.Your update method within your observer class should call postInvalidate() or invalidate which will tell the program to redraw itself. TERM 17

Handling Touch events

DEFINITION 17 override public boolean onTouchEvent(MotionEvent e) this use logical operations to decide what to do, MotionEvent.ACTION_DOWN and MotionEvent.ACTION_MOVE andMotionEvent.ACTION_UP is what we have used. to test thes use touchDown(x, y); touchUp(); touchMove(x, y); drag(x1, y1, x2, y2); and click for any necessary buttons that need to be clicked.You test you view by thoroughly testing your activity. There is not a test class specifically for your view. TERM 18

Graphical Coordinates

DEFINITION 18 they use float type because it uses less memory, float is good for fractional scaling to different screens. There is not reason to use double because the screen cannot show the precision. how to convert int to float, float x = 50;how to convert double to float, float x = 50.7f; TERM 19

Paint

DEFINITION 19 this lets the user control the color, fill type (style), stroke width, TypeFace and text style and size for font as well. You use this to describe the objects to be drawn except for the shape. TERM 20

Colors

DEFINITION 20 The colors are represented by numbers from 0-255 because each color is 8 bits and 2 raised to the 8th is 256 so there are 256 spaces for binary when describing the specific color.To create a color use the static methodsColor.argb(int alpha, int red, int green, int blue) andColor.rgb(int red, int green, int blue)alpha is the transparency.for common colors you can use static fields

Paint.setAntiAlias(true);

Makes curves smoother by fading out the color on edges a bit.