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

  • Home
  • SEARCH
  • 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 6935493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:06:37+00:00 2026-05-27T12:06:37+00:00

I worked in android app that read large text file from server (20 MB)

  • 0

I worked in android app that read large text file from server (20 MB) line by line ,
After each line insert into sqlite DB some data extracted from this line and so on .

the problem is, this application takes one hour approximately to finish reading this file .
note :
there are 400,000 line in this file .

how could i fast this operation to take 3 or 4 minutes ?
Thanks for your help .

    public void readArData() {
    try {
        URL url = new URL("http://10.0.2.2/xy.txt");
        BufferedReader in = new BufferedReader(new   
    inputStreamReader(url.openStream()));
        String str;
        while ((str = in.readLine()) != null) {
            // insert into Sqlite DB
        }
        in.close();
    } catch (MalformedURLException e) {
    } catch (IOException e) {
    }

}
  • 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-27T12:06:38+00:00Added an answer on May 27, 2026 at 12:06 pm

    Text files are highly compressible so use the gzip compression available on Android.

    Other options include:

    • splitting your dataset into multiple files and again using gzip download them separately

    • seeding the database during the install and creating a synchronization method to update newer records and bring the mobile version up to date.\

    • remove redundant data using an efficient database design and only downloading what’s required

    UPDATE

    To clarify:

    1. zip the txt file on the server.
    2. change your android code to download the zip file to local storage on device.
    3. unzip the local copy to local storage.

    You should now have a copy of your txt file on local storage so you can delete the local zip file.

    1. Read the local txt file and insert database records.

    The major differences in this approach are

    a. that you are downloading less data
    b. your download is not interrupted by sql inserts.

    You can also try using a transaction to improve insert speed as described in Android SQLite database: slow insertion

    db.beginTransaction();
    for (entry : listOfEntries) {
        db.insert(entry);
    }
    db.setTransactionSuccessful();
    db.endTransaction();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an Android App that gets some data from a web server,
I package a text file with my Android App (in Assets) which I read
Just a question, can anyone present a Android App that streams from brightcove or
I'm building an Android app that will stream several radio stations from a Latin
I have an Android app that communicates with a server via asynchronous socket connection
In android app, I need to dynamically generate html and load that into webview
I worked with a graphic designer that did not clone from my github account.
i'm working on a android app that will display Strings to the user, and
I have an app that posts a string to user's wall. The app worked
Not sure if that is the best of titles but... In my android app

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.