Exam Content Flashcards
What are the Android Emulator limitations?
No USB support No Bluetooth support No Headphone support No SD support No NFC support
What is a task?
A task is a stack of activities
How do you get intent data from an intent
Use the getIntent(), getData(), getExtra() methods
How do you get a result from another activity?
Create an intent going from one intent to another Add any required data/extras to intent Call startActivityForResult(intent) Do whatever processing is required in Activity B Call setResult(code, inent) in Activity B Call finish() in Activity B Implement onActivityResult() in Activity A
What is the Activity lifecycle?
onCreate() onStart() onResume() onPause() onStop() onDestroy()
What is the task backstack?
The task backstack is the stack containing all active Activities, activities are pushed to it when startActivity() is called and popped when the user goes back - i.e. finish() is called.
How do you send and receive an implicit intent?
(Make sure activity has an intent filter)
Create an intent object with an action parameter
Add data/extra info to the intent
Resolve intent activity - otherwise will crash
Send the intent with startActivity()
Use the getIntent(), getData() and getExtras() methods to receieve an intent
What are the differences between SavedInstanceState and SharedPreferences?
SavedInstanceState does not persist across user sessions, SharedPreferences does
SharedPreferences stores user preferences, SavedInstanceState recreates the state after a screen rotation
Both save small amounts of private data
What are the main features of an SQLite database?
Lightweight, local, no config., no server, easily backedup, store any-type of value
What are retreival queries?
Essentially an SQL select statement, can be achieved via a rawQuery() or just a simple query()
What are action queries?
Queries that manage the database, eg. table creation, column insertion etc. Use execSQL() for this task
What parameter do simple queries take?
Tablename, Columns, WHERE, WHERE_ARGS, groupBy, Having, Order_by)
How do you implement a drag gesture?
Implement view.onDragListener Implement onDrag(view, event)
What are the phases of a drag?
Started, Continuing, Dropped and Ended
How do you implement an AsyncTaskLoader?
Initialise loader ID
In onCreate() initialise a loader with (id, null, this)
Create a loader manager and get the loader with specific loaderID
Implement all required methods for interface: onCreateLoader(), onLoadFinished(), onLoaderReset()
Why Content Providers?
They provide a standard interface for multiple apps to read, modify and write data without affecting UI code securely
Why Content Resolvers?
System needs mechanism to distinguish content providers in order to route the URI to the correct place
How do you start a service?
- Register the service in the manifest
- Create an intent which whatever data, extras you want
- Call startService(intent) which will call onCreate and other callbacks
- Passes the intent to the onStartCommand()
- Stops itself with stopSelf() or manually via stopService()
- Handle the service’s lifecycle
What are examples of system Broadcast Intents?
- ACTION_POWER_CONNECTED, ACTION_DEVICE_STORAGE_LOW
How is a custom Broadcast Intent sent?
- Create an intent
- Set custom action
- sendBroadcast(intent)
What are the design principles of a notification?
- Timely
- Concise
- Relevant
- Manageable by the user
How do you test a view using Espresso?
- Find the view: onView(withId(R.id.view))
- Perform the action: perform(ViewAction)
- Check it has behaved correctly: check(ViewAssertion)
How do you test an AdapterView using Espresso?
- The onView() method doesn’t work, so use the onData() method instead
- onData(Object).DataOptions.perfrom(ViewAction).check(ViewAssertion)
What steps should you take when preparing for release?
- Choose a good package name
- Turn off logging and debugging
- Clean up directories
- Check manifest settings
- Update URLs for servers
Explain how codesigning works.
- App must be signed by the developer’s private key in order to be released
- Debugging builds are signed with special debug key
- Only release key will suffice for release builds