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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:01:47+00:00 2026-05-27T15:01:47+00:00

I have some text in a file [~100 KB ] that needs to be

  • 0

I have some text in a file [~100 KB] that needs to be displayed to the user in a TextView. I want to split the text into pages.

This is the idea I have in mind to implement pagination:

  • Determine screen width and screen height, say 320 x 480.
  • Calculate 75% of height, [360 px] to accommodate buttons etc.
  • Determine font size
  • Calculate number of characters [N] that can be displayed.
  • Read from file and display only N number of characters.

This seems like it would work, but it seems crude and error-prone. Does anyone have better ideas?

  • 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-27T15:01:47+00:00Added an answer on May 27, 2026 at 3:01 pm

    You should create your own extension of TextView and hook up into the onMeasure function which should give you the width and height (prob want to give the textview layout_weight=1)

    Then you can use a paint to get the size that text will take up, not I’ve not tested this and you’ll probably need to do something to account for splitting of newlines. But it is a good start…

    Paint paint = new Paint();
    Rect bounds = new Rect();
    
    int text_height = 0;
    int text_width = 0;
    
    paint.setTypeface(Typeface.DEFAULT);
    paint.setTextSize(12);// have this the same as your text size
    
    String text = "Some random text";
    
    paint.getTextBounds(text, 0, text.length(), bounds);
    
    text_check_h =  bounds.height(); // Will give you height textview will occupy
    text_check_w =  bounds.width();  // Will give you width textview will occupy
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have text file with some text information and i need to split this
I have text file with some stuff that i would like to put into
I have a plain text file looking like this: some text containing line breaks
We have some C# code that reads data from a text file using a
I am reading a text file with this format: grrr,some text,45.4321,54.22134 I just have
I have to import some UTF-8 encoded text-file into my C++Builder 5 program. Are
I have a simple WPF (XAML) file that has some animated shapes and text.
Hi I have a text file which contains some numerical data. Of that text
I have a .rc file which is used to include some text data in
I have to parse a tab-delimited text file with Ruby to extract some data

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.