Tampilkan postingan dengan label sqlite. Tampilkan semua postingan

Membuat Aplikasi CRUD Sederhana dengan database SQLite di Android Studio

Halo sobat blogger sudah lama admin tidak membuat postingan artikel dikarenakan sibuk dengan urusan di dunia nyata. pada kesempatan kali ini admin akan memberikan tutorial cara membuat aplikasi CRUD (Create Read Update Delete) di Android dengan Database SQLite. SQLite ini adalah database yang portable karena data-datanya akan tersimpan pada memori handhone kalian masing-masing, tidak disimpan di server. namun jika di perlukan bisa juga database ini disinkronkan ke server kita akan membahasnya pada kesempatan yang lain. Pada kesempatan kali ini kita akan membuat Aplikasi CRUD yang sederhana kedepanya kita akan bahas membuat CRUD dengan Content Provider.



Ok langsung saja untuk membuatnya kita buat desain tampilanya dulu.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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:theme="@android:style/Theme.NoTitleBar"
   
android:layout_width="match_parent"
   
android:layout_height="match_parent"
   
android:orientation="vertical"
   
android:background="#ddd"
   
android:padding="10dp"
   
tools:context="giviews.id.splash.MainActivity">

    <LinearLayout
       
android:layout_width="match_parent"
       
android:layout_height="wrap_content"
       
android:layout_marginTop="20dp"
       
android:orientation="horizontal">

        <TextView
           
android:layout_width="match_parent"
           
android:layout_height="wrap_content"
           
android:layout_weight="3"
           
android:textColor="#000"
           
android:text="Name"/>

        <EditText
           
android:id="@+id/editText_name"
           
style="@android:style/Widget.Material.Light.EditText"
           
android:layout_width="match_parent"
           
android:layout_height="wrap_content"
           
android:layout_weight="1"
           
android:ems="10"
           
android:hint="Name"
           
android:inputType="textPersonName" />
    </LinearLayout>

    <LinearLayout
       
android:layout_width="match_parent"
       
android:layout_height="wrap_content"
       
android:layout_marginTop="20dp"
       
android:orientation="horizontal">

        <TextView
            
android:layout_width="match_parent"
           
android:layout_height="wrap_content"
           
android:layout_weight="3"
           
android:textColor="#000"
           
android:text="Surname"/>

        <EditText
           
android:id="@+id/editText_surname"
           
style="@android:style/Widget.Material.Light.EditText"
           
android:layout_width="match_parent"
           
android:layout_height="wrap_content"
           
android:layout_weight="1"
           
android:ems="10"
            
android:hint="Surname"
           
android:inputType="textPersonName" />
    </LinearLayout>

    <LinearLayout
       
android:layout_width="match_parent"
       
android:layout_height="wrap_content"
       
android:layout_marginTop="20dp"
       
android:orientation="horizontal">

        <TextView
           
android:layout_width="match_parent"
           
android:layout_height="wrap_content"
           
android:layout_weight="3"
           
android:textColor="#000"
           
android:text="Marks"/>

        <EditText
           
android:id="@+id/editText_marks"
           
style="@android:style/Widget.Material.Light.EditText"
           
android:layout_width="match_parent"
           
android:layout_height="wrap_content"
           
android:layout_weight="1"
           
android:ems="10"
           
android:hint="Marks"
           
android:inputType="textPersonName"/>
    </LinearLayout>

    <LinearLayout
       
android:layout_width="match_parent"
       
android:layout_height="wrap_content"
       
android:layout_marginTop="20dp"
       
android:orientation="horizontal">

        <TextView
           
android:layout_width="match_parent"
           
android:layout_height="wrap_content"
           
android:layout_weight="3"
           
android:textColor="#000"
           
android:text="Id"/>

        <EditText
           
android:id="@+id/editTextId"
           
style="@android:style/Widget.Material.Light.EditText"
           
android:layout_width="match_parent"
           
android:layout_height="wrap_content"
           
android:layout_weight="1"
           
android:ems="10"
           
android:hint="Id"
           
android:inputType="textPersonName" />
    </LinearLayout>

        <LinearLayout
           
android:layout_marginTop="20dp"
            
android:layout_width="match_parent"
           
android:layout_height="wrap_content"
           
android:orientation="horizontal">

            <Button
               
android:id="@+id/button_add"
               
style="@android:style/Widget.Material.Light.Button"
               
android:background="@color/colorAccent"
               
android:textColor="@android:color/background_light"
               
android:layout_width="match_parent"
               
android:layout_height="wrap_content"
                
android:text="Add Data"
               
android:textAppearance="@android:style/TextAppearance.Material.Button"
               
android:layout_weight="1" />

            <Button
               
android:id="@+id/button_view"
               
style="@android:style/Widget.Material.Light.Button"
               
android:layout_width="match_parent"
               
android:layout_height="wrap_content"
               
android:background="@color/colorAccent"
               
android:layout_weight="1"
                
android:text="view all"
               
android:textAppearance="@android:style/TextAppearance.Material.Button"
               
android:textColor="@android:color/background_light" />
        </LinearLayout>

        <LinearLayout
           
android:layout_marginTop="20dp"
           
android:layout_width="match_parent"
           
android:orientation="horizontal"
           
android:layout_height="wrap_content">

            <Button
               
android:id="@+id/button_update"
               
style="@android:style/Widget.Material.Light.Button"
               
android:background="@color/colorAccent"
               
android:textColor="@android:color/background_light"
               
android:layout_width="match_parent"
               
android:layout_height="wrap_content"
               
android:layout_weight="1"
               
android:text="Update"
               
android:textAppearance="@style/TextAppearance.AppCompat.Button" />

            <Button
               
android:id="@+id/button_delete"
                
style="@android:style/Widget.Material.Light.Button"
               
android:background="@color/colorAccent"
               
android:textColor="@android:color/background_light"
               
android:layout_width="match_parent"
               
android:layout_height="wrap_content"
               
android:layout_weight="1"
               
android:text="Delete"
               
android:textAppearance="@style/TextAppearance.AppCompat.Button" />
        </LinearLayout>
    </LinearLayout>

Selanjutnya buat class DatabaseHelper di java, class ini berfungsi untuk membuat database, table, metode untuk menambah, mengupdate, menampilkan dan menghapus data.

package giviews.id.splash;



import android.content.ContentValues;

import android.content.Context;

import android.database.Cursor;

import android.database.sqlite.SQLiteDatabase;

import android.database.sqlite.SQLiteOpenHelper;



/**

 * Created by asus on 02/04/2017.

 */



public class DatabaseHelper extends SQLiteOpenHelper{

    //nama database

    public static final String DATABASE_NAME = "Student.db";

    //nama table

    public static final String TABLE_NAME = "student_table";

    //versi database

    private static final int DATABASE_VERSION = 1;

    //table field

    public static final String COL_1 = "ID";

    public static final String COL_2 = "NAME";

    public static final String COL_3 = "SURNAME";

    public static final String COL_4 = "MARKS";



    public DatabaseHelper(Context context) {

        super(context, DATABASE_NAME, null, DATABASE_VERSION);

        SQLiteDatabase db = this.getWritableDatabase();

    }



    @Override

    public void onCreate(SQLiteDatabase db) {

        db.execSQL("create table student_table(id integer primary key autoincrement," +

                "name text null," +

                "surname text null," +

                "marks integer null);");

    }



    @Override

    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

        db.execSQL("DROP TABLE IF EXISTS "+ TABLE_NAME);

        onCreate(db);

    }



    //metode untuk tambah data

    public boolean insertData(String name, String surname, String marks) {

        SQLiteDatabase db = this.getWritableDatabase();

        ContentValues contentValues = new ContentValues();

        contentValues.put(COL_2,name);

        contentValues.put(COL_3,surname);

        contentValues.put(COL_4,marks);

        long result = db.insert(TABLE_NAME, null, contentValues);

        if(result == -1)

            return false;

        else

            return true;

    }



    //metode untuk mengambil data

    public Cursor getAllData() {

        SQLiteDatabase db = this.getWritableDatabase();

        Cursor res = db.rawQuery("select * from student_table", null);

        return res;

    }



    //metode untuk merubah data

    public boolean updateData(String id,String name,String surname,String marks) {

        SQLiteDatabase db = this.getWritableDatabase();

        ContentValues contentValues = new ContentValues();

        contentValues.put(COL_1,id);

        contentValues.put(COL_2,name);

        contentValues.put(COL_3,surname);

        contentValues.put(COL_4,marks);

        db.update(TABLE_NAME,contentValues,"ID = ?",new String[] {id});

        return true;

    }



    //metode untuk menghapus data

    public int deleteData (String id) {

        SQLiteDatabase db = this.getWritableDatabase();

        return db.delete(TABLE_NAME, "ID = ?", new String[] {id});

    }

}
Terakhir kita buat script untuk memfungsikan tombol add, edit, view dan delete yang telah kita desain tadi, kodenya seperti berikut:

package giviews.id.splash;



import android.database.Cursor;

import android.os.Bundle;

import android.support.v7.app.AlertDialog;

import android.support.v7.app.AppCompatActivity;

import android.view.Menu;

import android.view.MenuItem;

import android.view.View;

import android.widget.Button;

import android.widget.EditText;

import android.widget.Toast;



public class MainActivity extends AppCompatActivity {

    DatabaseHelper myDb;

    EditText editName,editSurname,editMarks,editTextId;

    Button btnAddData;

    Button btnViewAll;

    Button btnUpdate;

    Button btnDelete;



    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        myDb = new DatabaseHelper(this);

        editName = (EditText)findViewById(R.id.editText_name);

        editSurname = (EditText)findViewById(R.id.editText_surname);

        editMarks = (EditText)findViewById(R.id.editText_marks);

        editTextId = (EditText)findViewById(R.id.editTextId);

        btnAddData = (Button)findViewById(R.id.button_add);

        btnViewAll = (Button)findViewById(R.id.button_view);

        btnUpdate = (Button)findViewById(R.id.button_update);

        btnDelete = (Button)findViewById(R.id.button_delete);

        AddData();

        viewAll();

        UpdateData();

        deleteData();

    }



    //fungsi hapus

    public void deleteData() {

        btnDelete.setOnClickListener(

                new View.OnClickListener() {

                    @Override

                    public void onClick(View v) {

                        Integer deletedRows = myDb.deleteData(editTextId.getText().toString());

                        if (deletedRows > 0)

                            Toast.makeText(MainActivity.this,"Data Deleted",Toast.LENGTH_LONG).show();

                        else

                            Toast.makeText(MainActivity.this,"Data Failed to Deleted!",Toast.LENGTH_LONG).show();

                    }

                }

        );

    }



    //fungsi update

    public void UpdateData() {

        btnUpdate.setOnClickListener(

                new View.OnClickListener() {

                    @Override

                    public void onClick(View v) {

                        boolean isUpdate = myDb.updateData(editTextId.getText().toString(),

                                editName.getText().toString(),

                                editSurname.getText().toString(),

                                editMarks.getText().toString());

                        if(isUpdate == true)

                            Toast.makeText(MainActivity.this,"Data Updated",Toast.LENGTH_LONG).show();

                        else

                            Toast.makeText(MainActivity.this,"Data Failed to Update",Toast.LENGTH_LONG).show();

                    }

                }

        );

    }



    //fungsi tambah

    public void AddData() {

        btnAddData.setOnClickListener(

                new View.OnClickListener() {

                    @Override

                    public void onClick(View v) {

                        boolean isInserted = myDb.insertData(editName.getText().toString(),

                                editSurname.getText().toString(),

                                editMarks.getText().toString() );

                        if(isInserted == true)

                            Toast.makeText(MainActivity.this,"Data Iserted",Toast.LENGTH_LONG).show();

                        else

                            Toast.makeText(MainActivity.this,"Data Not Iserted",Toast.LENGTH_LONG).show();

                    }

                }

        );

    }



    //fungsi menampilkan data

    public void viewAll() {

        btnViewAll.setOnClickListener(

            new View.OnClickListener(){

                 @Override

                     public void onClick(View v) {

                     Cursor res = myDb.getAllData();

                     if(res.getCount() == 0) {

                     // show message

                         showMessage("Error","Noting Found");

                     return;

                 }



                 StringBuffer buffer = new StringBuffer();

                     while (res.moveToNext() ) {

                         buffer.append("Id :"+ res.getString(0)+"\n");

                         buffer.append("Name :"+ res.getString(1)+"\n");

                         buffer.append("Surname :"+ res.getString(2)+"\n");

                         buffer.append("Marks :"+ res.getString(3)+"\n\n");

                     }



                     // show all data

                     showMessage("Data",buffer.toString());

                }

            }

        );

    }



    //membuat alert dialog

    public void showMessage(String title, String Message){

        AlertDialog.Builder builder = new AlertDialog.Builder(this);

        builder.setCancelable(true);

        builder.setTitle(title);

        builder.setMessage(Message);

        builder.show();

    }

}





Sekarang jalankan program crud anda, selamat mencoba semoga berhasil. jika ada yang kurang jelas bisa ditanyakan pada komentar dibawah, jika artikel ini bermanfaat silakan share. pada postingan selanjutnya kita akan membuat Aplikasi CRUD dengan menggunakan Content Provider dan Circular Reveal Animation

Membuat Aplikasi CRUD SQLite dengan Content Provider dan Circular Reveal Animation di Android Part4



di part ke3 kita sudah membuat beberapa class untuk menambahkan data, menampilkan data menampilkan details data dan mengedit data. sekarang kita akan menambahkan class Searchable activity untuk fungsi pencarian data CRUD kita

pertama buat class SearchableActivity dan masukan kode berikut:
package com.giviews.employee;

import
android.app.ListActivity;
import
android.app.SearchManager;
import
android.content.Intent;
import
android.database.Cursor;
import
android.net.Uri;
import
android.os.Bundle;
import
android.support.annotation.Nullable;
import
android.support.v7.widget.SearchView;
import
android.view.Menu;
import
android.view.MenuItem;
import
android.view.View;
import
android.widget.ListAdapter;
import
android.widget.ListView;
import
android.widget.SimpleCursorAdapter;
import
android.widget.Toast;

import
com.giviews.employee.data.EmployeeContract;

import
java.util.Timer;
import
java.util.TimerTask;

/**
 * Created by asus on 29/10/2017.
 */

public class SearchableActivity extends ListActivity implements SearchView.OnQueryTextListener{

   
@Override
   
protected void onCreate(Bundle savedInstanceState) {
       
super.onCreate(savedInstanceState);

       
Intent intent = getIntent();
       
checkIntent(intent);
   
}

   
@Override
   
protected void onNewIntent(Intent newIntent) {
        setIntent(newIntent)
;

       
checkIntent(newIntent);
   
}

   
private void checkIntent(Intent intent) {
        String query =
"";
       
String intentAction = intent.getAction();
        if
(Intent.ACTION_SEARCH.equals(intentAction)) {
            query = intent.getStringExtra(SearchManager.
QUERY);
       
} else if (Intent.ACTION_VIEW.equals(intentAction)) {
            Uri details = intent.getData()
;
           
Intent detailsIntent = new Intent(Intent.ACTION_VIEW, details);
           
startActivity(detailsIntent);
       
}
        fillList(query)
;
   
}

   
private void fillList(String query) {
        String wildcardQuery =
"%" + query + "%";

       
Cursor cursor = getContentResolver().query(
                EmployeeContract.EmployeeEntry.
CONTENT_URI,
                null,
               
EmployeeContract.EmployeeEntry.COLUMN_FIRSTNAME + " LIKE ? OR " + EmployeeContract.EmployeeEntry.COLUMN_LASTNAME + " LIKE ? OR ",
                new
String[]{ wildcardQuery, wildcardQuery },
                null
);

        if
(cursor.getCount() == 0) {
            Toast.makeText(
this, " NO SEARCH RESULT ", Toast.LENGTH_SHORT).show();
            int
timeout = 3000;

           
Timer timer = new Timer();
           
timer.schedule(new TimerTask() {
                
@Override
               
public void run() {
                    finish()
;
                   
Intent intent = new Intent(SearchableActivity.this, EmployeeActivity.class);
                   
startActivity(intent);
               
}
            }
, timeout);

       
}

        ListAdapter adapter =
new SimpleCursorAdapter(
               
this,
               
android.R.layout.simple_list_item_2,
               
cursor,
                new
String[]{ EmployeeContract.EmployeeEntry.COLUMN_FIRSTNAME, EmployeeContract.EmployeeEntry.COLUMN_LASTNAME },
                new int
[]{android.R.id.text1, android.R.id.text2},
               
0);
       
setListAdapter(adapter);
   
}

   
@Override
   
protected void onListItemClick(ListView l, View view, int position, long id) {
        Intent intent =
new Intent(SearchableActivity.this, EmployeeActivity.class);

       
Uri details = Uri.withAppendedPath(EmployeeContract.EmployeeEntry.CONTENT_URI, "" + id);
       
intent.setData(details);
       
startActivity(intent);
   
}

   
@Override
   
public boolean onOptionsItemSelected(MenuItem item) {
       
if (item.getItemId() == android.R.id.home) {

            Intent parentActivityIntent =
new Intent(this, EmployeeActivity.class);
           
parentActivityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
           
startActivity(parentActivityIntent);
           
finish();
            return true;
       
}
       
return super.onOptionsItemSelected(item);
   
}

   
@Override
    
public boolean onQueryTextSubmit(String query) {
       
return false;
   
}

   
@Override
   
public boolean onQueryTextChange(String newText) {
       
return false;
   
}
}

kemudian buat class SettingsActivity untuk menggati warna thema aplikasi kita, dengan kode seperti berikut:
package com.giviews.employee;



import android.annotation.TargetApi;

import android.content.Intent;

import android.content.SharedPreferences;

import android.graphics.Paint;

import android.graphics.drawable.ShapeDrawable;

import android.graphics.drawable.shapes.OvalShape;

import android.os.Build;

import android.preference.PreferenceManager;

import android.support.annotation.RequiresApi;

import android.support.v7.app.AppCompatActivity;

import android.os.Bundle;

import android.support.v7.widget.Toolbar;

import android.view.View;

import android.widget.Button;





import com.turkialkhateeb.materialcolorpicker.ColorChooserDialog;

import com.turkialkhateeb.materialcolorpicker.ColorListener;



public class SettingsActivity extends AppCompatActivity {



    SharedPreferences sharedPreferences, app_preperences;

    SharedPreferences.Editor editor;

    Button button;

    Methods methods;



    int appTheme;

    int themeColor;

    int appColor;

    Constant constant;



    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)

    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);



        app_preperences = PreferenceManager.getDefaultSharedPreferences(this);

        appColor = app_preperences.getInt("color", 0);

        appTheme = app_preperences.getInt("theme", 0);

        themeColor = appColor;

        constant.color = appColor;



        if (themeColor == 0) {

            setTheme(Constant.theme);

        } else if (appTheme == 0) {

            setTheme(Constant.theme);

        } else {

            setTheme(appTheme);

        }

        setContentView(R.layout.activity_settings);



        final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_setting);

        toolbar.setTitle("Settings");

        toolbar.setBackgroundColor(Constant.color);



        methods = new Methods();



        button = (Button) findViewById(R.id.button_color);



        sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);



        editor = sharedPreferences.edit();



        colorize();



        button.setOnClickListener(new View.OnClickListener() {

            @Override

            public void onClick(View view) {

                ColorChooserDialog dialog = new ColorChooserDialog(SettingsActivity.this);

                dialog.setTitle("Select");

                dialog.setColorListener(new ColorListener() {

                    @Override

                    public void OnColorClick(View v, int color) {

                        colorize();

                        Constant.color = color;



                        methods.setColorTheme();

                        editor.putInt("color", color);

                        editor.putInt("theme", Constant.theme);

                        editor.commit();



                        Intent intent = new Intent(getApplicationContext(), EmployeeActivity.class);

                        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

                        startActivity(intent);

                    }

                });



                dialog.show();

            }



        });

    }



    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)

    private void colorize(){

        ShapeDrawable d = new ShapeDrawable(new OvalShape());

        d.setBounds(58, 58, 58, 58);



        d.getPaint().setStyle(Paint.Style.FILL);

        d.getPaint().setColor(Constant.color);



        button.setBackground(d);

    }



}

kemudian kita buat class Constant untuk mengganti warna thema aplikasi kita:
package com.giviews.employee;



import java.io.Serializable;



/**

 * Created by asus on 05/11/2017.

 */



public class Constant implements Serializable {



    public static int nav_clicked = 0;

    public static Boolean isNavClicked = false;



    public static Boolean isToggle = true;

    public static  int color = 0xfff67f21;

    public static  int theme = R.style.AppTheme;

}

selanjutnya buat class Methods untuk mengubah warna theme, dengan kode seperti berikut:
package com.giviews.employee;



/**

 * Created by asus on 05/11/2017.

 */



public class Methods {



    public void setColorTheme() {



        switch (Constant.color){

            case 0xffF44336:

                Constant.theme = R.style.AppTheme_red;

                break;

            case 0xffE91E63:

                Constant.theme = R.style.AppTheme_pink;

                break;

            case 0xff9C27B0:

                Constant.theme = R.style.AppTheme_darpink;

                break;

            case 0xff673AB7:

                Constant.theme = R.style.AppTheme_violet;

                break;

            case 0xff3F51B5:

                Constant.theme = R.style.AppTheme_blue;

                break;

            case 0xff03A9F4:

                Constant.theme = R.style.AppTheme_skyblue;

                break;

            case 0xff4CAF50:

                Constant.theme = R.style.AppTheme_green;

                break;

            case 0xffFF9800:

                Constant.theme = R.style.AppTheme;

                break;

            case 0xff9E9E9E:

                Constant.theme = R.style.AppTheme_grey;

                break;

            case 0xff795548:

                Constant.theme = R.style.AppTheme_brown;

                break;

            default:

                    Constant.theme = R.style.AppTheme;

        }

    }

}

Terakhir sesuaikan AndroidManifest anda seperti berikut:
<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="com.giviews.employee">



    <uses-feature android:name="android.hardware.camera2"/>

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>



    <application

        android:allowBackup="true"

        android:icon="@mipmap/ic_launcher"

        android:label="@string/app_name"

        android:roundIcon="@mipmap/ic_launcher_round"

        android:supportsRtl="true"

        android:theme="@style/AppTheme">

        <activity android:name=".EmployeeActivity">

            <intent-filter>

                <action android:name="android.intent.action.MAIN" />



                <category android:name="android.intent.category.LAUNCHER" />

            </intent-filter>

        </activity>

        <activity

            android:name=".EmployeeEditor"

            android:parentActivityName=".EmployeeActivity">

            <meta-data

                android:name="android.support.PARENT_ACTIVITY"

                android:value=".EmployeeActivity" />

        </activity>



        <!-- Employee Details -->

        <activity

            android:name=".EmployeeDetailsActivity"

            android:parentActivityName=".EmployeeActivity">

            <meta-data

                android:name="android.support.PARENT_ACTIVITY"

                android:value=".EmployeeActivity" />

        </activity>



        <provider

            android:name=".data.EmployeeProvider"

            android:authorities="com.giviews.employee"

            android:exported="false" />



        <!-- searchable -->

        <activity

            android:name=".SearchableActivity"

            android:launchMode="singleTop">

            <intent-filter>

                <action android:name="android.intent.action.SEARCH" />

            </intent-filter>

            <intent-filter>

                <action android:name="android.intent.action.VIEW" />

            </intent-filter>



            <meta-data

                android:name="android.app.searchable"

                android:resource="@xml/searchable" />

        </activity>



        <meta-data

            android:name="android.app.default_searchable"

            android:value="com.giview.employee.SearchableActivity" />



        <activity android:name=".SettingsActivity"></activity>

    </application>



</manifest>


Sekarang jalankan aplikasi anda, jika ada yang kurang jelas silakan ditanyakan pada komentar dibawah. jika anda ingin melihat sourcode versi full silakan download disini. jika artikel ini bermanfaat silakan di share, selamat mencoba semoga bermanfaat kdepanya kita akan membuat CRUD SQLite dengan model dan adapter, CRUD dengan database firebase, dan CRUD dengan MySQL database