CRUD method

github: T0904- Insert ,  T0905-QueryAllTasks , T0906- Delete , T0907-SwipeToDelete * The screenshots in the blog are from the Udacity Nanodegree Program: Become an Android Developer * Insert (Create) Query (Read) Query for all table data What Does the CustomCursorAdapter do? The CustomCursorAdapter will inflate views using the xml layout file task_layout, and create ViewHolders that will fill the main RecyclerView. Each ViewHolder includes data about a single task: it’s text description … Continue reading CRUD method

URIMatcher

github: T0901-SetupContentProvider , T0902-AddURLsToContract , T0903- UriMatcher , uriMatcher for TASKS_ID  * The screenshots in the blog are from the Udacity Nanodegree Program: Become an Android Developer * URI - Identify your provider Identify different types of data that the provider can work with URI Structure - When we want to check a URI tasks, we may have the below statement. But that … Continue reading URIMatcher

QuizExample App (Content Provider + SQLite)

github: T0801-AddTheContentProviderPermission , T0802- AddAsyncTaskToRetrieveCursor, T0803-FinishQuizExample * The screenshots in the blog are from the Udacity Nanodegree Program: Become an Android Developer * General Steps for ContentProvider Get permission to use the ContentProvider. Get the ContentResolver Pick one of four basic actions on the data: query, insert, update, delete Identify the data you are reading or manipulating to create a URI … Continue reading QuizExample App (Content Provider + SQLite)

Sunshine app: Create a SQLite database for Sunshine

github: S7.01-DatabaseCreation, S07.02-PreventInvaildInserts , S07.03-ConflictResolutionPolicy Create a WeatherContract, in the class to create an inner class called WeatherEntry class, which implements BaseColumns, which implate, that defines the table contents of the weather table. Create a DBHelper extends SQLiteOpenHelper and implement with onCreate and onUpgrade. Prevent invalid inserts into the Weather DB. To Change each column's type declaration to append NOT … Continue reading Sunshine app: Create a SQLite database for Sunshine

Add/ Delete/ Update Data –> SQLite Database

github: T07.03-GetAllTheData , T07.04-UpdateTheAdapter , T07.05-AddGuests , T7.06-RemoveGuests   Delete Guest: deleteDatabase ItemTouchHelper.SimpleCallback // TODO (1) Create a new function called removeGuest that takes long id as input and returns a boolean public boolean removeGuest(Long id){ // TODO (2) Inside, call mDb.delete to pass in the TABLE_NAME and the condition that WaitlistEntry._ID equals id return mDb.delete(WaitlistContract.WaitlistEntry.TABLE_NAME, WaitlistContract.WaitlistEntry._ID+" = " +id, null) … Continue reading Add/ Delete/ Update Data –> SQLite Database

SQLite Exercise- Contract and Database

github: T07.01-CreateAContract  and T07.02- Create The Database Step 1: // TODO (1) Create an inner class named WaitlistEntry class that implements the BaseColumns interface public static final class WaitlisEntry implements BaseColumns{ // TODO (2) Inside create a static final members for the table name and each of the db columns public static final String TABLE_NAME= "waitlist"; public static … Continue reading SQLite Exercise- Contract and Database

Sunshine app: Launch Setting Activity for SunShine app

github: S06.01-LaunchSettingsActivity , S06.02-SettingsFragment ,  S06.03-PolishingPreferences Settings for Sunshine: Unit Setting- Fahrenheit   Celsius Location Setting  * Reference: Udacity Nanodegree Program- Become an Android Developer * public class SettingsActivity extends AppCompatActivity { // TODO (1) Add new Activity called SettingsActivity using Android Studio wizard <!--TODO (2) Add a Settings option to the main menu--> <item android:id= "@+id/action_settings" android:orderInCategory="2" android:title="@string/action_setting" app:showAsAction="never"/> … Continue reading Sunshine app: Launch Setting Activity for SunShine app

Edit Text Preference Constraints

github: T06.10- EditTextPreferenceConstraints * The below material is from Udacity Nanodegree Program- Become an Android Developer * Setting an acceptable range To limit the acceptable values between 0 (non inclusive) and 3 (inclusive) we opted to use a PreferenceChangeListener - this is not the same as a SharedPreferenceChangeListener. The differences are: SharedPreferenceChangeListener is triggered after any value is saved to the SharedPreferences … Continue reading Edit Text Preference Constraints