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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:05:35+00:00 2026-06-02T12:05:35+00:00

below is logcat result which shows out of memory problem. it may be involved

  • 0

below is logcat result which shows out of memory problem.

it may be involved with too big byte[] array.


04-17 22:21:38.773: W/dalvikvm(4963): threadid=1: thread exiting with uncaught exception (group=0x40a4d1f8)
04-17 22:21:38.781: E/AndroidRuntime(4963): FATAL EXCEPTION: main
04-17 22:21:38.781: E/AndroidRuntime(4963): java.lang.OutOfMemoryError
04-17 22:21:38.781: E/AndroidRuntime(4963): at java.nio.CharBuffer.put(CharBuffer.java:509)
04-17 22:21:38.781: E/AndroidRuntime(4963): at java.nio.charset.CharsetDecoder.allocateMore(CharsetDecoder.java:238)
04-17 22:21:38.781: E/AndroidRuntime(4963): at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:195)
04-17 22:21:38.781: E/AndroidRuntime(4963): at java.nio.charset.Charset.decode(Charset.java:487)
04-17 22:21:38.781: E/AndroidRuntime(4963): at java.lang.String.(String.java:174)
04-17 22:21:38.781: E/AndroidRuntime(4963): at java.lang.String.(String.java:141)

04-17 22:21:38.781: E/AndroidRuntime(4963): at exam.militarymgrs.Draw_LOS.readFile(Draw_LOS.java:182)

Draw_LOS.java:182 is as follows.
(String s = new String(dat);)

——-Source code————–

public static ArrayList<String> readFile(String fileName) {
//map data access
String sdPath;
sdPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/";

File file = new File(sdPath+fileName);
//String[] k = new String[1440000];
//String line = "";

ArrayList<String> data = new ArrayList<String>();//consider using ArrayList<int>
try {
FileInputStream fis = new FileInputStream(file);
byte[] dat = new byte[fis.available()];
String s = new String(dat);
String[] k = s.split("[\\r\\n]+");
while(fis.read(dat) != -1) {;}
fis.close();

}
catch(FileNotFoundException fN) {
fN.printStackTrace();
}
catch(IOException e) {
System.out.println(e);
}
return data; 
}

A file which should be loaded is as follows

12
32
43
…

How can I read the data file without Out of Memory with fileStream??

  • 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-06-02T12:05:36+00:00Added an answer on June 2, 2026 at 12:05 pm

    try to use this:

    public static String toBinaryString(byte n) {
    StringBuilder sb = new StringBuilder("00000000");
    for (int bit = 0; bit < 8; bit++) {
    if (((n >> bit) & 1) > 0) {
    sb.setCharAt(7 - bit, '1');
    }
    }
    return sb.toString();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Android SQLite Cursor Problem at cur3 = db3.rawQuery below is my logcat Errors and
Android SQLite Cursor Problem at cur3 = db3.rawQuery below is my logcat errors and
This is the code that is causing the problem. And below is the Logcat.
Below I present you some code which has completely been butchered by me. $(.gig).hover(function()
UPDATE maybe changing the Bitmap size in the new Activity may fix the problem
In Android Emulator i am getting below Logcat Error: 03-11 04:44:56.663: ERROR/AndroidRuntime(403): java.lang.RuntimeException: Unable
I create a project which only includes one receiver. Some codes are like below:
I am getting below error in logcat. > E/AndroidRuntime( 3197): Uncaught handler: thread main
When i'm displaying image from url with using below code, application is taking too
The widgets work fine, but the main activity FC's. The logcat is below: 04-22

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.