O'Reilly logo

Android SQLite Essentials by Vikash Kumar Karn, Sunny Kumar Aditya

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Connecting the UI and database

Now that we have our database hooks in place, let's connect our UI with the data:

  1. The first step would be to get the data from the user. We can use the existing contact data from the Android's contact application by means of the content provider.

    We will be covering this approach in the next chapter. For now, we will be asking the user to add a new contact, which we will insert into the database:

    Connecting the UI and database
  2. We are using standard Android UI widgets, such as EditText, TextView, and Buttons to collect the data provided by the user:
    private void prepareSendData() { if (TextUtils.isEmpty(contactName.getText().toString()) || TextUtils.isEmpty( ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required