Skip to content

Instantly share code, notes, and snippets.

View leoshak's full-sized avatar
🏠
Working from home

shakshared leoshak

🏠
Working from home
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/list_item"
android:padding="10dp">
</TextView>
//not included in model but to prepare for exam,
public List<String> viewSearchedUser(String id) {
SQLiteDatabase db = getReadableDatabase();
//retrieve the user using primary key
String[] selectionArgs = {id+"%"};
String query = "SELECT * FROM " + TABLE_NAME + " WHERE "+ _ID + " = ? ";
Cursor cursor = db.rawQuery(query, selectionArgs);
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
tools:context=".activity.ViewUserActivity">
<Spinner
package com.bla.androidsqlitebasics.activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Spinner;
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="labels_size">18sp</dimen>
<dimen name="label_width">130dp</dimen>
<dimen name="label_height">30dp</dimen>
<dimen name="layout_margin_horizontal">16dp</dimen>
<dimen name="username_label_margin_top">164dp</dimen>
<dimen name="username_et_margin_start">8dp</dimen>
<dimen name="username_et_margin_top">156dp</dimen>
<dimen name="password_label_margin_top">32dp</dimen>
<resources>
<string name="app_name">AndroidSQLiteBasics</string>
<string name="username_tv">Username:</string>
<string name="password_label_tv">Password:</string>
<string name="login_bt_label">Login</string>
<string name="register_bt_label">Register</string>
<string name="updadte_profile_label">Update Profile</string>
<string name="birth_label_tv">Date of Birth</string>
<string name="birth_label">Date Of Birth</string>
<string name="gender_label">Gender</string>
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="@dimen/layout_margin_horizontal"
tools:context="com.bla.androidsqlitebasics.activity.ProfileManagementActivity">
<TextView
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="@dimen/layout_margin_horizontal"
tools:context="com.bla.androidsqlitebasics.activity.HomeActivity">
<TextView
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="@dimen/layout_margin_horizontal"
tools:context="com.bla.androidsqlitebasics.activity.EditProfileActivity">
<TextView