lundi 2 mai 2016

How to get a table from SQLite DataBase stored in external memory

I am working with DB in android. my db has three tables and i want to get a single table from them.Now I am reading my sqlite file success fully and writing into my desired place to some modification. but issue is that I do not know how to get a single table from database.db file. now i am getting db by using this program.

   public void getDB(){
        File f=new File("/data/data/com.android.lunchernewone/databases/launcher.db");
        FileInputStream fis=null;
        FileOutputStream fos=null;

        try
        {
            fis=new FileInputStream(f);
            fos=new FileOutputStream("/mnt/sdcard/db_dump.db");
            while(true)
            {
                int i=fis.read();
                if(i!=-1)
                {fos.write(i);}
                else
                {break;}
            }
            fos.flush();
            Toast.makeText(this, "DB dump OK", Toast.LENGTH_LONG).show();
        }
        catch(Exception e)
        {
            e.printStackTrace();
            Toast.makeText(this, "DB dump ERROR", Toast.LENGTH_LONG).show();
        }
        finally
        {
            try
            {
                fos.close();
                fis.close();
            }
            catch(IOException ioe)
            {}
        }
    }

can anybody tell me that how I get a single table from this db file ?

Aucun commentaire:

Enregistrer un commentaire