Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7561991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:18:07+00:00 2026-05-30T13:18:07+00:00

I am new to android phonegap. i am storing and retrieving data using native

  • 0

I am new to android phonegap. i am storing and retrieving data using native application. i dont know how to display the retrieved data from native to phonegap(HTML)page.

can anyone pls guide me how to access sqlite with phonegap.?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:18:09+00:00Added an answer on May 30, 2026 at 1:18 pm

    You need to first create a Android plugin for Phonegap through which you will be able to access the native code and hence the native DB like this

    public class SqlitePlugin extends Plugin {
    
    private static final String TAG = "SqlitePlugin";
    private static final String CREATE_DB_ACTION = "createDatabase";
    private static final String SHOW_DB_VALUES_ACTION = "showValues";
    
    @Override
    public PluginResult execute(String action, JSONArray data, String callbackId) {
        Log.i(TAG, "Plugin Called");
        PluginResult result = null;
    
        if (CREATE_DB_ACTION.equals(action)) {
            Log.d(TAG, "CREATE_DB_ACTION");
            DB _db = new DB(ctx);
            _db.insertValues();
        }
        else if (SHOW_DB_VALUES_ACTION.equals(action)) {
            Log.d(TAG, "SHOW_DB_VALUES_ACTION");
    
            JSONObject DBInfo = null;
            try {
                DBInfo = getDBValuesListing();
    
            } catch (JSONException e) {
                e.printStackTrace();
            }
    
            result = new PluginResult(Status.OK, DBInfo);
    
        }       
        else {
            result = new PluginResult(Status.INVALID_ACTION);
            Log.d(TAG, "Invalid action : " + action + " passed");
        }
    
        return result;
      }
    }
    

    After that Create a sqlite.js file like this

        function SqlitePlugin() {
    };
    
    SqlitePlugin.prototype.createDatabase = function(successCallback, failCallback) {
    
    return PhoneGap.exec(successCallback, failCallback, "SqlitePlugin",
            "createDatabase", [ null ]);
    };
    
    SqlitePlugin.prototype.showValues = function(params, successCallback, failCallback) {
    return PhoneGap.exec(successCallback, failCallback, 'SqlitePlugin', 'showValues',
            [ params ]);
    };
    
    PhoneGap.addConstructor(function() {
    PhoneGap.addPlugin("SqlitePlugin", new SqlitePlugin());
    });
    

    Import this sqlite.js in your page(index.html) and then finally use the plugin like this

    function showValues() {
        window.plugins.SqlitePlugin.showValues('showValues',
                showValuesSuccessCallBack, showValuesFailCallBack);
    
    }
    function showValuesSuccessCallBack(e) {
        if (e.Rows.length > 0) {
            alert("Success");
            for (i = 0; i < e.Rows.length; i++) {
                alert("Id = " + e.Rows[i].id);
                alert("Number = " + e.Rows[i].number);
            }
        } else {
            alert("No values in Database");
        }
    }
    
    function showValuesFailCallBack(f) {
        alert("Failure");
    }
    

    Let me know if this worked out for you

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using phonegap to develop my android application.I want to show google chart
I am developing an app using phonegap for Android. I want this mobile application
I am new to phonegap.I am using jquery mobile with html5 for developing android
I am new to phonegap and android development. May I know how can I
I'm new to Phonegap and I want to develop a Phonegap application for Android..
I'm developing a phonegap/jquery-mobile test application (I'm new in this technologies) for android and
The new Android 2.1 SDK (version 7) has a new class called SignalStrength: http://developer.android.com/reference/android/telephony/SignalStrength.html
I know that eclipse can do this, can Intellij via the new Android support
I am currently designing a native android application. I am planning to use jQuery
My issue is regarding PhoneGap and Android development using the Eclipse Applaud plugin. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.