CP470 Exam Questions With 100% Correct
Answers
What are parcelables? - answer-Uses putExtra with parcelable as the object
-Class has to implement parcelable
What two methods do you need for Parcelables? - answerdescribeContents() and
WriteToParcel() - called when startActivity is executed, tak...
What are parcelables? - answer✔-Uses putExtra with parcelable as the object
-Class has to implement parcelable
What two methods do you need for Parcelables? - answer✔describeContents() and
WriteToParcel() - called when startActivity is executed, takes parcel as input parameter
How do you retrieve a Parcelable from another activity? - answer✔getParcelableExtra()
How can you store files? - answer✔-SharedPreferences
-Internal/External
-SQL Databases
-Content Providers
External Storage - answer✔-could be SD Card
-World-readable
-Permissions set on AM
Internal Storage - answer✔-Always available
-Device's file system
-Only app can access files
-System removes all upon uninstall
-getFilesDir() for permanent
-getCacheDir() for temporary
C - when transaction has completed, all data is in consistent state
I - mods made by concurrent transactions must be isolated
D - effects are permanent
SQLiteOpenHelper - answer✔-Used for creating and opening DB
-Need to override constructor, onCreate, onUpgrade
-SQLiteOpenHelper(context, dbName, null, version)
How do you create an SQL DB? - answer✔Must call super
super(context, DB_NAME, NULL, VER)
SQLiteDB - onCreate - answer✔-if DB doesn't exist, this will be called
-Creating tables should occur here
-execSQL used to execute SQL statements
SQLiteDB - onUpgrade() - answer✔-if DB exists but ver number is newer, then this is called
-used to drop tables, add tables, do anything else to update new schema
How do you open a read/write database? - answer✔Database = dbHelper.getWritableDatabase()
Content values - answer✔-Class used for inserting rows into DB
-put(columnName, value)
rawQuery - answer✔-allows for arguments in queries
Cursor - answer✔-queries always return a cursor object
-storage object that contains rows from a query
-pointer to table rows
-getCount - num rows
-moveToFirst, moveToNext
-getXXX for column data
-getColumnIndex(name) with matching name
-isAfterLast() - if cursor after last row
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller sirjoel. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $10.49. You're not tied to anything after your purchase.