Check the data table of the App without the root user.

Source: Internet
Author: User

Check the data table of the App without the root user.

For a long time, you have to use root to view sqlite databases. However, it is troublesome to use root on many testing machines in the company ~~~

Recently, the project went live, just a little idle,

So I decided to write a library project to facilitate future code debugging.

The key code is as follows:

1. view the database of the current app

context.databaseList()
The databaseList method is a method defined in the ContextWrapper class as follows:
@ Override

    public String[] databaseList() {        return mBase.databaseList();    }

2. View data tables in the database

SQLiteDatabase db = dbHelper. getWritableDatabase (); Cursor c = db. rawQuery ("SELECT name FROM sqlite_master WHERE type = 'table'", null); if (c. moveToFirst () {while (! C. isAfterLast () {tables. add (c. getString (0); // data table c. moveToNext ();}}

3. View data in a data table

DbHelper db = new DbHelper(getContext(), databaseName);Cursor c = db.getWritableDatabase().query(tableName, null, null, null, null, null, null);String[] columnNames = c.getColumnNames();ArrayList<String> datas = new ArrayList<String>();StringBuilder sb = new StringBuilder();if (c.moveToFirst()) {while (!c.isAfterLast()) {sb.setLength(0);for (String columnName : columnNames) {int columnIndex = c.getColumnIndex(columnName);String colValue = c.getString(columnIndex);sb.append(columnName).append(": ").append(colValue).append("\n");}datas.add(sb.toString());Log.d("table_" + tableName, sb.toString());c.moveToNext();}}

In addition to the databaseList () method, the above Code is relatively simple.


. Viewing the data in the app table is initially intended to create a data browsing control like root explorer. However, it seems complicated to think about it. It has not been implemented yet.

The link to the project is here

Https://github.com/droidcoffee/yolanda/tree/master/yolanda_Android


Pay attention to the usage method, introduce the project as a library project

Modify the project. properties file of the main project and add the following configuration.

manifestmerger.enabled=true
In this way, the Activity configured in AndroidManifest. xml in the library takes effect.

That is, you do not need to copy it to the master project to reconfigure it.


If you have any problems, add group 299306868.


How can I back up application data and game records without ROOT on Android phones?

Sorry, as far as I know, there is no way... Unless you and the app or game folders, data packets, etc. Or download a one-click root of mogucloud from the computer!

Without the root of the Android system, I Don't Know What app I installed, so I started to see the push application software. The game's background downloads directly popped up and asked me

Games are infected with viruses, which cannot be found by software. Sometimes they will be automatically downloaded and installed. In this case, you can directly go to the mobile phone store to solve the problem! The virus is hard to find. It cannot be deleted by yourself, and it is useless to uninstall the software. Do not root the virus. If it is root, you will be responsible for the consequences!
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.