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 6898703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:19:48+00:00 2026-05-27T07:19:48+00:00

My database name is AppDB.db and table name is Scrip which contains 3 columns

  • 0

My database name is AppDB.db and table name is Scrip which contains 3 columns _id and symbol&company_name which are text.
I have copied database in Assets folder.

When app runs, first check data button appears, on clicking it, app stops.
I don’t know what might be the reason.
Please help..

DatabaseSample.class:

            package com.app.DatabaseSample;

            import android.app.Activity;
            import android.content.Intent;
            import android.os.Bundle;
            import android.view.View;
            import android.view.View.OnClickListener;
            import android.widget.Button;

            public class DatabaseSample extends Activity implements OnClickListener {
                /** Called when the activity is first created. */
                @Override
                public void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.main);
                    Button btncheck = (Button) findViewById(R.id.btncheck);
                    btncheck.setOnClickListener(this);
                }

                @Override
                public void onClick(View v) {
                    Intent i = new Intent(this, CheckData.class);
                    startActivity(i);
                }
            }

CheckData.class:

            package com.app.DatabaseSample;

            import java.util.ArrayList;
            import java.util.List;

            import android.app.ListActivity;
            import android.os.Bundle;
            import android.util.Log;
            import android.widget.ArrayAdapter;
            import android.widget.TextView;

            public class CheckData extends ListActivity {
                TextView selection;
                DataManipulator dm;
                private static final String TAG = "CheckData";
                List<String[]> list = new ArrayList<String[]>();
                List<String[]> symbol2 = null;
                String[] list1;

                public void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    try {
                        setContentView(R.layout.check);

                        dm = new DataManipulator(this);
                        // dm.createNewDatabase();
                        dm.open();
                        symbol2 = dm.selectAll();
                        dm.close();

                        list1 = new String[symbol2.size()];
                        int x = 0;
                        String stg;

                        for (String[] symbol : symbol2) {
                            stg = symbol[1];// + " –-> " + symbol[1];
                            list1[x] = stg;
                            x++;
                        }

                        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                                android.R.layout.simple_list_item_1, list1);
                        this.setListAdapter(adapter);
                        selection = (TextView) findViewById(R.id.selection);
                    } catch (Exception e) {
                        Log.e(TAG, "Exception in check class...");
                    }
                }

                // public void onListItemClick(ListView parent, View v, int position, long
                // id) {
                // selection.setText(list1[position]);
                // }
            }

DataManipulator.class:

            package com.app.DatabaseSample;

            import java.util.ArrayList;
            import java.util.List;

            import android.content.Context;
            import android.database.Cursor;
            import android.database.SQLException;
            import android.database.sqlite.SQLiteDatabase;
            import android.database.sqlite.SQLiteOpenHelper;
            import android.util.Log;

            public class DataManipulator extends SQLiteOpenHelper {
                private static final String DATABASE_NAME = "AppDB";
                private static final int DATABASE_VERSION = 1;
                private static final String DATABASE_PATH = "/data/data/com.app.DatabaseSample/databases/";
                private static final String TAG = "DbManipulator";
                static final String TABLE_NAME = "Scrip";
                private Context context;
                SQLiteDatabase db;
                DataManipulator dmDB;

                public DataManipulator(Context context) {
                    super(context, DATABASE_NAME, null, DATABASE_VERSION);
                    this.context = context;
                }

                @Override
                public void onCreate(SQLiteDatabase db) {
                    db.execSQL("CREATE TABLE IF NOT EXISTS Scrip(_id integer primary key autoincrement,"
                            + "symbol text,company_name text);");
                }

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

                public DataManipulator open() {
                    dmDB = new DataManipulator(context);
                    db = dmDB.getWritableDatabase();
                    return this;
                }

                public void close() {
                    dmDB.close();
                }

                /*
                 * public void createNewDatabase() { InputStream assetsDB = null; try {
                 * assetsDB = context.getAssets().open(DATABASE_NAME); OutputStream dbOut =
                 * new FileOutputStream(DATABASE_PATH + DATABASE_NAME);
                 * 
                 * byte[] buffer = new byte[1024]; int length; while ((length =
                 * assetsDB.read(buffer)) > 0) { dbOut.write(buffer, 0, length); }
                 * 
                 * dbOut.flush(); dbOut.close(); assetsDB.close(); Log.i(TAG,
                 * "New database created..."); } catch (IOException e) { Log.e(TAG,
                 * "Could not create new database..."); e.printStackTrace(); } }
                 */

                public List<String[]> selectAll() {

                    List<String[]> list = new ArrayList<String[]>();
                    // Cursor cursor = db
                    // .query(TABLE_NAME, new String[] {"symbol", "company_name" }, null,
                    // null, null, null, null);
                    try {
                        Cursor cursor = db.rawQuery(
                                "select symbol,company_name from Scrip", new String[] {
                                        "symbol", "company_name" });

                        int x = 0;
                        if (cursor.moveToFirst()) {
                            do {
                                String[] b1 = new String[] {
                                        cursor.getString(cursor.getColumnIndex("symbol")),
                                        cursor.getString(cursor
                                                .getColumnIndex("company_name")) };
                                list.add(b1);
                                Log.e(TAG, "selectAll method Error");
                                x = x + 1;
                            } while (cursor.moveToNext());
                        }
                        if (cursor != null && !cursor.isClosed()) {
                            cursor.close();
                        }
                        cursor.close();

                    } catch (SQLException e) {
                        Log.e("selectAll method Error", e.toString());
                        e.printStackTrace();
                    }
                    return list;
                }
            }

LOG CAT

 11-24 17:43:52.535: A/NetworkStats(88): problem reading network stats
11-24 17:43:52.535: A/NetworkStats(88): java.lang.IllegalStateException: problem parsing line: null
11-24 17:43:52.535: A/NetworkStats(88):     at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:313)
11-24 17:43:52.535: A/NetworkStats(88):     at com.android.server.NetworkManagementService.getNetworkStatsUidDetail(NetworkManagementService.java:1223)
11-24 17:43:52.535: A/NetworkStats(88):     at com.android.server.net.NetworkStatsService.performPollLocked(NetworkStatsService.java:810)
11-24 17:43:52.535: A/NetworkStats(88):     at com.android.server.net.NetworkStatsService.updateIfacesLocked(NetworkStatsService.java:721)
11-24 17:43:52.535: A/NetworkStats(88):     at com.android.server.net.NetworkStatsService.updateIfaces(NetworkStatsService.java:699)
11-24 17:43:52.535: A/NetworkStats(88):     at com.android.server.net.NetworkStatsService.access$000(NetworkStatsService.java:128)
11-24 17:43:52.535: A/NetworkStats(88):     at com.android.server.net.NetworkStatsService$8.handleMessage(NetworkStatsService.java:1546)
11-24 17:43:52.535: A/NetworkStats(88):     at android.os.Handler.dispatchMessage(Handler.java:95)
11-24 17:43:52.535: A/NetworkStats(88):     at android.os.Looper.loop(Looper.java:137)
11-24 17:43:52.535: A/NetworkStats(88):     at android.os.HandlerThread.run(HandlerThread.java:60)
11-24 17:43:52.535: A/NetworkStats(88): Caused by: java.io.FileNotFoundException: /proc/net/xt_qtaguid/stats: open failed: ENOENT (No such file or directory)
11-24 17:43:52.535: A/NetworkStats(88):     at libcore.io.IoBridge.open(IoBridge.java:406)
11-24 17:43:52.535: A/NetworkStats(88):     at java.io.FileInputStream.<init>(FileInputStream.java:78)
11-24 17:43:52.535: A/NetworkStats(88):     at java.io.FileReader.<init>(FileReader.java:42)
11-24 17:43:52.535: A/NetworkStats(88):     at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:272)
11-24 17:43:52.535: A/NetworkStats(88):     ... 9 more
11-24 17:43:52.535: A/NetworkStats(88): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
11-24 17:43:52.535: A/NetworkStats(88):     at libcore.io.Posix.open(Native Method)
11-24 17:43:52.535: A/NetworkStats(88):     at libcore.io.BlockGuardOs.open(BlockGuardOs.java:98)
11-24 17:43:52.535: A/NetworkStats(88):     at libcore.io.IoBridge.open(IoBridge.java:390)
11-24 17:43:52.535: A/NetworkStats(88):     ... 12 more
11-24 17:44:00.085: E/ActivityManager(88): ANR in system
11-24 17:44:00.085: E/ActivityManager(88): Reason: Broadcast of Intent { act=android.intent.action.BOOT_COMPLETED flg=0x10 cmp=android/com.android.server.BootReceiver }
11-24 17:44:00.085: E/ActivityManager(88): Load: 4.62 / 1.5 / 0.53
11-24 17:44:00.085: E/ActivityManager(88): CPU usage from 3420ms to -4642ms ago:
11-24 17:44:00.085: E/ActivityManager(88):   31% 88/system_server: 19% user + 12% kernel / faults: 2796 minor 2 major
11-24 17:44:00.085: E/ActivityManager(88):   19% 34/surfaceflinger: 17% user + 1.5% kernel / faults: 1 minor
11-24 17:44:00.085: E/ActivityManager(88):   14% 349/com.android.launcher: 12% user + 2.5% kernel / faults: 2385 minor
11-24 17:44:00.085: E/ActivityManager(88):   11% 199/com.android.systemui: 9% user + 2.9% kernel / faults: 2953 minor
11-24 17:44:00.085: E/ActivityManager(88):   9.8% 283/android.process.acore: 6.6% user + 3.1% kernel / faults: 1630 minor 1 major
11-24 17:44:00.085: E/ActivityManager(88):   3.5% 64/bootanimation: 3.4% user + 0.1% kernel
11-24 17:44:00.085: E/ActivityManager(88):   1.1% 43/adbd: 0.6% user + 0.5% kernel
11-24 17:44:00.085: E/ActivityManager(88):   1% 226/com.android.phone: 0.3% user + 0.6% kernel / faults: 53 minor
11-24 17:44:00.085: E/ActivityManager(88):   0.1% 35/zygote: 0% user + 0.1% kernel / faults: 75 minor
11-24 17:44:00.085: E/ActivityManager(88):   0.3% 87/logcat: 0% user + 0.3% kernel
11-24 17:44:00.085: E/ActivityManager(88):  +0% 411/com.android.deskclock: 0% user + 0% kernel
11-24 17:44:00.085: E/ActivityManager(88): 100% TOTAL: 74% user + 25% kernel + 0.1% irq
11-24 17:44:00.085: E/ActivityManager(88): CPU usage from 3713ms to 4380ms later:
11-24 17:44:00.085: E/ActivityManager(88):   53% 199/com.android.systemui: 32% user + 20% kernel / faults: 2625 minor
11-24 17:44:00.085: E/ActivityManager(88):     40% 199/ndroid.systemui: 23% user + 17% kernel
11-24 17:44:00.085: E/ActivityManager(88):     10% 201/GC: 7.8% user + 3.1% kernel
11-24 17:44:00.085: E/ActivityManager(88):   18% 34/surfaceflinger: 15% user + 3% kernel
11-24 17:44:00.085: E/ActivityManager(88):     16% 61/SurfaceFlinger: 16% user + 0% kernel
11-24 17:44:00.085: E/ActivityManager(88):     1.5% 34/surfaceflinger: 1.5% user + 0% kernel
11-24 17:44:00.085: E/ActivityManager(88):     1.5% 266/Binder Thread #: 0% user + 1.5% kernel
11-24 17:44:00.085: E/ActivityManager(88):   16% 88/system_server: 10% user + 6% kernel / faults: 63 minor
11-24 17:44:00.085: E/ActivityManager(88):     9% 103/ActivityManager: 7.5% user + 1.5% kernel
11-24 17:44:00.085: E/ActivityManager(88):     4.5% 95/Compiler: 1.5% user + 3% kernel
11-24 17:44:00.085: E/ActivityManager(88):     3% 100/Binder Thread #: 3% user + 0% kernel
11-24 17:44:00.085: E/ActivityManager(88):     1.5% 106/PackageManager: 0% user + 1.5% kernel
11-24 17:44:00.085: E/ActivityManager(88):     1.5% 281/Binder Thread #: 1.5% user + 0% kernel
11-24 17:44:00.085: E/ActivityManager(88):   4.5% 64/bootanimation: 4.5% user + 0% kernel
11-24 17:44:00.085: E/ActivityManager(88):     6% 66/BootAnimation: 6% user + 0% kernel
11-24 17:44:00.085: E/ActivityManager(88):   3% 43/adbd: 1.5% user + 1.5% kernel
11-24 17:44:00.085: E/ActivityManager(88):     1.5% 43/adbd: 0% user + 1.5% kernel
11-24 17:44:00.085: E/ActivityManager(88):   0.4% 87/logcat: 0% user + 0.4% kernel
11-24 17:44:00.085: E/ActivityManager(88):   1.6% 283/android.process.acore: 0% user + 1.6% kernel / faults: 7 minor
11-24 17:44:00.085: E/ActivityManager(88):     1.6% 290/Compiler: 0% user + 1.6% kernel
11-24 17:44:00.085: E/ActivityManager(88): 100% TOTAL: 67% user + 32% kernel
  • 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-27T07:19:48+00:00Added an answer on May 27, 2026 at 7:19 am

    found the problem. DB doesn’t actually got connected to app. So it was not getting any data. Thanks anyways.

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

Sidebar

Related Questions

I have a database name "CUED" (sqlite Android)it have a table HELLO which contain
I have a table in my database: Name | Element 1 2 1 3
Suppose a database table has a column Name which is defined as key for
I have a table in the database: name Opinion Tim Tim has an opinion
If I know the database-name and table-name, how can I find columns-count of the
I have a string which has database name,Schema name and Procdedure name which is
I have got table as given below in database: Name Grade Subject Ami HD
I have a simple model which I have to set the database name manually
Given a model's instance object, how can I get the database table's name? I
I have a name in a database, lets say its DFectuoso and some legacy

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.