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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:14:17+00:00 2026-06-01T04:14:17+00:00

So, I’m making my first Android application, which basically contains ~250 .txt files in

  • 0

So, I’m making my first Android application, which basically contains ~250 .txt files in the asset folder. I list them all in a ListActivity, so you can choose the one you want to read and then open it in a TextView. The app is working just fine in the emulator, no problemo. However, when I install the .apk on my phone, the longest .txt files get cut off, mid-sentence. This does not happen on the emulator. I’m at a loss, I have no clue what could be causing this, but if anyone has any ideas, I would be happy to explore them!

Here’s the code, I’m still very much learning, and I realize this probably isn’t the optimal way to do what I want to do, but anyway, here goes:

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    // TODO Auto-generated method stub
    super.onListItemClick(l, v, position, id);
    String path = fikBog[position];

    try {

        bog = getAssets().open("skyrimbooks/" + path);
        int size = bog.available();
        byte[] buffer = new byte[size];
        bog.read(buffer);
        bog.close();
        String bookInput = new String(buffer);
        Bundle taske = new Bundle();
        taske.putString("bog", bookInput);
        Intent g = new Intent(GotSkyrimBooks.this, BookReader.class);
        g.putExtras(taske);
        startActivity(g);

    } catch (IOException e) {
        // Should never happen!
        throw new RuntimeException(e);
    }


}

So, in the ListActivity, the user can browse all the different .txt files, and when he/she picks one, it gets opened in the BookReader class. And in the BookReader class, the textview gets populated like so:

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.bookreader);

    reader = (TextView) findViewById(R.id.reader);


Bundle fikTaske = getIntent().getExtras();
fikBog = fikTaske.getString("bog");
reader.setText(fikBog);
}

Here is my .xml. Simple as can be:

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <LinearLayout 
        android:id="@+id/linearLayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/reader"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="TextView"
            android:textColor="#000000" />

  </LinearLayout>
</ScrollView>

  • 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-01T04:14:18+00:00Added an answer on June 1, 2026 at 4:14 am

    Some handsets out there seem to set a low maximum default length for TextViews. I would suggest setting the maxLength property in the XML for the TextView to something larger than the files you’d like to view.

    If you want to do it programmatically, this answer should help you with that:
    How to programmatically set maxLength in Android TextView?

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

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.