August 8, 2020
  • 7:26 am Cách chèn nhạc vào ảnh và video trên Facebook
  • 6:59 am Tóm Tắt The Walking Dead (Xác Sống) | Season 4
  • 6:15 am [Mất gốc Hóa – số 16] – HƯỚNG DẪN CÁCH GỌI TÊN OXIT AXIT – OXIT BAZƠ NHANH THUỘC
  • 5:49 am Cách cài Win từ ổ cứng: cả Win 7/8/8.1 và Win10 (làm mẫu với Win 10)
  • 5:12 am Thủ thuật excel: Cách khóa dữ liệu không cho chỉnh sửa trong excel



Welcome to this Android SQLite Database Tutorial video. This video shows How to use SQLite with android on Android Studio. In addition we will be Creating Database and Tables in our SQLite database for use in our android SQLite database tutorial. So I video Android SQLite Database Tutorial How to create a SqLite database and then Select, Insert, Update, Delete which correspond to CRUD functionality in SQLite database. SQLite database management system comes bundled with the Android OS.

00:01 # Introduction + Creating Database and Tables
24:30 # Insert values to SQLite Database table using Android
38:19 # Show SQLite Database table Values using Android
52:46 # Update values in SQLite Database table using Android
01:07:32 # Delete values in SQLite Database table using Android

SQLite is an open-source social database i.e. used to perform database operations on android gadgets, for example, putting away, controlling or recovering relentless information from the database.

#SQLite #Android #ProgrammingKnowledge
★★★Top Online Courses From ProgrammingKnowledge ★★★
Python Programming Course ➡️ ⚫️
Java Programming Course ➡️ ⚫️
Bash Shell Scripting Course ➡️ ⚫️
Linux Command Line Tutorials ➡️ ⚫️
C Programming Course ➡️ ⚫️
C++ Programming Course ➡️ ⚫️
PHP Programming Course ➡️ ⚫️
Android Development Course ➡️ ⚫️
C# Programming Course ➡️ ⚫️
JavaFx Programming Course ➡️ ⚫️
NodeJs Programming Course ➡️ ⚫️
Jenkins Course For Developers and DevOps ➡️ ⚫️
Scala Programming Tutorial Course ➡️ ⚫️
Bootstrap Responsive Web Design Tutorial ➡️ ⚫️
MongoDB Tutorial Course ➡️ ⚫️
QT C++ GUI Tutorial For Beginners ➡️

★★★ Online Courses to learn ★★★
Get 2 FREE Months of Unlimited Classes from skillshare –
Data Science – |
Machine Learning – |
Artificial Intelligence – |
MERN Stack E-Degree Program – |
DevOps E-degree – |
Data Analytics with R – |
AWS Certification Training – |
Projects in Java – |
Machine Learning With TensorFlow – |
Angular 8 – Complete Essential Guide –
Kotlin Android Development Masterclass –
Learn iOS Programming Building Advance Projects –

★★★ Follow ★★★
My Website –

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!

Nguồn: https://chaoticpharmacology.com/

Xem thêm bài viết khác: https://chaoticpharmacology.com/cong-nghe/

admin

RELATED ARTICLES

43 COMMENTS

  1. Abbas Ali Posted on July 11, 2020 at 3:27 pm

    Love You Bro you are totally lit hahaha😍😜

    Reply
  2. Every Posted on July 11, 2020 at 3:27 pm

    sqlite manager addon mozile not working for me , can anyone help me

    Reply
  3. Marco López Posted on July 11, 2020 at 3:27 pm

    Thanks for the video. How can you implementation with rest api? thanks a lot!

    Reply
  4. Jaqueline Silva Posted on July 11, 2020 at 3:27 pm

    Thank you so much! Very helpful!

    Reply
  5. Biw Piyanut Raunkaew Posted on July 11, 2020 at 3:27 pm

    Thank you

    Reply
  6. Preet Vakharia Posted on July 11, 2020 at 3:27 pm

    if i want to perform or add where clause in Databasehelper's view all (Select statement ) what code should i use because i am confused.

    Reply
  7. telugu reads Posted on July 11, 2020 at 3:27 pm

    Please make a video for getting data from user through edit text like these fields in a row item quantity cost.. when the user entered data in a horizontal row item quantity and cost then the items display in list view….

    Reply
  8. Bakkiya Balakrishnan Posted on July 11, 2020 at 3:27 pm

    Tq so so so much.It was very helpful .The explanation was so clear and understandable .Keep on doing more videos.Tqsm sir

    Reply
  9. TECH AJAY Posted on July 11, 2020 at 3:27 pm

    Sir please make a tutorial send data first to data save in sqlite when Internet is off condition and after I connected to internet all save data in sqlite send to the server and after all sqlite data is empty in your device
    Thaks

    Reply
  10. Sumit KB Posted on July 11, 2020 at 3:27 pm

    Sir how can I backup and restore sqlite database….

    Reply
  11. Muhammad Asfand yar Posted on July 11, 2020 at 3:27 pm

    why my application stopped when i click on view button my is same as your code then why i have the problem like this and how can i fix it?@programmingknowledge

    Reply
  12. Muhammad Hussain Posted on July 11, 2020 at 3:27 pm

    impressive

    Reply
  13. vishal mishra Posted on July 11, 2020 at 3:27 pm

    36:17 marks is stored as integer but passed as string in method

    Reply
  14. Pathum Harshana Posted on July 11, 2020 at 3:27 pm

    Very Good Tutorial,, I Like to know how to set this data to a RecyclerView or a GridView

    Reply
  15. Gaju Gaju Posted on July 11, 2020 at 3:27 pm

    my app terminated everytime i press the ADD DATA button

    Reply
  16. Jamil Ahmed Sukhera Posted on July 11, 2020 at 3:27 pm

    Program worked perfectly for me. Thank you very much!
    Here is the Code Below:-

    /**************
    MainActivity.java
    *****************/

    public class MainActivity extends AppCompatActivity {

    DatabaseHelper myDb;

    EditText editTextId, editTextName, editTextMobile, editTextDescription;

    Button buttonAddData, buttonViewAllData, buttonUpdate, buttonDelete;

    @Override

    protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    init();

    addData();

    viewAllData();

    UpdateData();

    deleteData();

    }

    public void init(){

    myDb = new DatabaseHelper(this);

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

    editTextName = (EditText) findViewById(R.id.edtName);

    editTextMobile = (EditText) findViewById(R.id.edtMobile);

    editTextDescription = (EditText) findViewById(R.id.edtDescription);

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

    buttonViewAllData = (Button) findViewById(R.id.btnViewAllData);

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

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

    }

    public void addData(){

    buttonAddData.setOnClickListener(new View.OnClickListener() {

    @Override

    public void onClick(View view) {

    String name, mobile, description;

    name = editTextName.getText().toString();

    mobile = editTextMobile.getText().toString();

    description = editTextDescription.getText().toString();

    boolean isInserted = myDb.insertData(name, mobile, description);

    if (isInserted = true)

    {

    Toast.makeText(MainActivity.this, "Data Inserted.", Toast.LENGTH_SHORT).show();

    }

    else Toast.makeText(MainActivity.this, "Data Not Inserted.", Toast.LENGTH_SHORT).show();

    }

    });

    }

    public void viewAllData(){

    buttonViewAllData.setOnClickListener(

    new View.OnClickListener() {

    @Override

    public void onClick(View view) {

    Cursor cursor = myDb.getAllData();

    if (cursor.getCount()==0)

    {

    //show message

    showMessage("Error", "No Data Found");

    return;

    }

    StringBuffer buffer = new StringBuffer();

    while (cursor.moveToNext())

    {

    buffer.append("ID: "+ cursor.getString(0) +"n");

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

    buffer.append("Mobile: "+ cursor.getString(2) +"n");

    buffer.append("Description: "+ cursor.getString(3) +"nn");

    }

    //show all data

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

    }

    }

    );

    }

    public void UpdateData(){

    buttonUpdate.setOnClickListener(new View.OnClickListener() {

    @Override

    public void onClick(View view) {

    String id, name, mobile, description;

    id = editTextId.getText().toString();

    name = editTextName.getText().toString();

    mobile = editTextMobile.getText().toString();

    description = editTextDescription.getText().toString();

    boolean isUpdated = myDb.updateData(id, name, mobile, description);

    if (isUpdated==true)

    {

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

    }

    else Toast.makeText(MainActivity.this, "Data Not Updated.", Toast.LENGTH_SHORT).show();

    }

    });

    }

    public void deleteData(){

    buttonDelete.setOnClickListener(new View.OnClickListener() {

    @Override

    public void onClick(View view) {

    String id = editTextId.getText().toString();

    Integer deletedRows = myDb.deleteData(id);

    if (deletedRows > 0)

    {

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

    }

    else Toast.makeText(MainActivity.this, "Data Not Deleted.", Toast.LENGTH_SHORT).show();

    }

    });

    }

    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();

    }

    }

    /******************
    DatabaseHelper.java
    *********************/

    public class DatabaseHelper extends SQLiteOpenHelper {

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

    public static final String TABLE_NAME = "Tailor_Table";

    public static final String COL_1 = "ID";

    public static final String COL_2 = "NAME";

    public static final String COL_3 = "MOBILE";

    public static final String COL_4 = "DESCRIPTION";

    public DatabaseHelper(Context context) {

    super(context, DATABASE_NAME, null, 1);

    }

    @Override

    public void onCreate(SQLiteDatabase db) {

    db.execSQL("create table " + TABLE_NAME +" (ID INTEGER PRIMARY KEY AUTOINCREMENT, " + "NAME TEXT, MOBILE TEXT, DESCRIPTION TEXT)");

    }

    @Override

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

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

    onCreate(db);

    }

    public boolean insertData(String name, String mobile, String description){

    SQLiteDatabase db = this.getWritableDatabase();

    ContentValues contentValues = new ContentValues();

    contentValues.put(COL_2, name);

    contentValues.put(COL_3, mobile);

    contentValues.put(COL_4, description);

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

    if (result == -1)

    return false;

    else

    return true;

    }

    public Cursor getAllData()

    {

    SQLiteDatabase db = this.getWritableDatabase();

    Cursor cursor = db.rawQuery("select * from "+TABLE_NAME,null);

    return cursor;

    }

    public boolean updateData(String id, String name, String mobile, String description){

    SQLiteDatabase db = this.getWritableDatabase();

    ContentValues contentValues = new ContentValues();

    contentValues.put(COL_1, id);

    contentValues.put(COL_2, name);

    contentValues.put(COL_3, mobile);

    contentValues.put(COL_4, description);

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

    return true;

    }

    public Integer deleteData(String id){

    SQLiteDatabase db = this.getWritableDatabase();

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

    }

    }

    /***************
    activity_main.xml
    *****************/

    <?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:layout_width="match_parent"

    android:layout_height="match_parent"

    tools:context=".MainActivity"

    android:orientation="vertical">

    <EditText

    android:id="@+id/edtId"

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:hint="Enter ID"

    android:textSize="18sp"
    />

    <EditText

    android:id="@+id/edtName"

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:hint="Enter Name"

    android:textSize="18sp"
    />

    <EditText

    android:id="@+id/edtMobile"

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:hint="Enter Mobile Numer"

    android:textSize="18sp"/>

    <EditText

    android:id="@+id/edtDescription"

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:hint="Enter Description"

    android:textSize="18sp"/>

    <Button

    android:id="@+id/btnAddData"

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:textAllCaps="false"

    android:text="Add Data"/>

    <Button

    android:id="@+id/btnViewAllData"

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:textAllCaps="false"

    android:text="View All Data"/>

    <Button

    android:id="@+id/btnUpdate"

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:textAllCaps="false"

    android:text="Update"/>

    <Button

    android:id="@+id/btnDelete"

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:textAllCaps="false"

    android:text="Delete"/>

    </LinearLayout>

    Reply
  17. kasun sampath Posted on July 11, 2020 at 3:27 pm

    hello dear.. can u give me this project..

    Reply
  18. BADSHA Posted on July 11, 2020 at 3:27 pm

    Fantastic tutorial!

    Reply
  19. Gilang Adrian Posted on July 11, 2020 at 3:27 pm

    starting minute 18:22 i cant seem to follow, because my app wont run

    Reply
  20. Michael Paraguas Posted on July 11, 2020 at 3:27 pm

    sir, kindly please show also how you created the resource file menu.

    Reply
  21. Seema Parmar Posted on July 11, 2020 at 3:27 pm

    Sir create tabel error aave

    Reply
  22. Manjeet Ahuja Posted on July 11, 2020 at 3:27 pm

    Instead of checking db 19:12 thoroughly we can put toast in our constructor if that constructor will execute then toast will be printed successfully…..

    Reply
  23. Jom Granade Posted on July 11, 2020 at 3:27 pm

    This really helps me a lot. Thank you for this video. ☺️

    Reply
  24. Cube Dev Posted on July 11, 2020 at 3:27 pm

    Thanks a lot!! How to use xampp with android studio?please update your vide

    Reply
  25. SinOfLust.rgyeah Posted on July 11, 2020 at 3:27 pm

    please provide the source code

    Reply
  26. carrie hinson Posted on July 11, 2020 at 3:27 pm

    Can you expand this video (or go from this one) to show how to insert a date using SQLite? This video has been very helpful

    Reply
  27. Jona Tunxxon Posted on July 11, 2020 at 3:27 pm

    Muchas gracias por el tutorial, saludos desde Perú 🇵🇪

    Reply
  28. sameer k Posted on July 11, 2020 at 3:27 pm

    Very excellent tutorial…easy to understand and follow…..appreciated….

    Reply
  29. Robert R Posted on July 11, 2020 at 3:27 pm

    Thank you. How would you write a function to search the database?

    Reply
  30. my playlist Posted on July 11, 2020 at 3:27 pm

    Thank you for this tutorial.

    Reply
  31. Abrar adnan Posted on July 11, 2020 at 3:27 pm

    Very helpful thank you so much

    Reply
  32. Agamurat 301 Posted on July 11, 2020 at 3:27 pm

    what abt more than one table

    Reply
  33. Sidi Med Mahfoud Posted on July 11, 2020 at 3:27 pm

    thanks ….

    Reply
  34. Şəhriyar Cəfər Qulu Posted on July 11, 2020 at 3:27 pm

    Thanks a ton! I learnt many things alongside the topic I came to watch for. Have a great time 🙌

    Reply
  35. SIDDHANT BENAKE Posted on July 11, 2020 at 3:27 pm

    Very helful tutorial. Whoever is new to sqlite, watch this tutorial. Thank you so much!

    Reply
  36. Evan Jones Posted on July 11, 2020 at 3:27 pm

    Program worked perfectly for me. Thank you very much!

    Reply
  37. Thanasis Athanasi Posted on July 11, 2020 at 3:27 pm

    Video stupidly posted in June/2019 and it uses android studio version 1…. Now Android Studio ships with version 4. Crap video.

    Reply
  38. ala eddine boukhicha Posted on July 11, 2020 at 3:27 pm

    plzz sir can u send me the source code at alaboukhicha2@gmail.com

    Reply
  39. Rose Fanely Posted on July 11, 2020 at 3:27 pm

    con android studio 3.4.1 no tiene "Android Device Monitor" . Podría decirme el equivalente?, gracias

    Reply
  40. Zeeranim Posted on July 11, 2020 at 3:27 pm

    my app terminated everytime i press the View All button 🙁 even tho i did exactly the same as this tutorial

    Reply
  41. Psychoholic Dude Posted on July 11, 2020 at 3:27 pm

    Do anyone have the project file of this one?

    Reply
  42. Psychoholic Dude Posted on July 11, 2020 at 3:27 pm

    which version of Android Studio is this one you are working on?

    Reply
  43. Ayhan Çoban Posted on July 11, 2020 at 3:27 pm

    Everything used in this video even Firefox and the extension are so outdated that I can't really keep up. Should have noticed earlier that it's almost a 5 years old video in fact.

    Reply
LEAVE A COMMENT