Note that there are some explanatory texts on larger screens.

plurals
  1. POdisplay large string into multiple pages in single activity
    primarykey
    data
    text
    <p>I am very new to android development. I am trying to create a simple two activities based ebbok type application where <code>activity1</code> is table of content and <code>activity2</code> displays the details. I have a listview in Activity1 where I list the table of content. On clicking any specific content, I load <code>activity2</code>. In <code>onCreate</code> of <code>activity2</code>, I load the content into a string(from a txt file in assets). and display that in textView (as defined in <code>activity2</code>.xml). So far so good. The challenge now is to display the content page-wise because, as of now all of my string gets loaded into a single page in <code>activity2</code>. So I added two buttons at the bottom of <code>activity2</code> (defined that in <code>activity2.xml</code>). My planned logic now is</p> <ol> <li>get the screen height (I could get that)</li> <li>get the botton height and substract 2) from 1). Now I cannot do this becuase I cannot get button height in <code>onCreate</code> of <code>Activity2</code></li> <li>and then find how much text I can fit in one page, find number of pages accordingly, use a page index and using a page delimiter, keep loading remaining text into next pages when user clicks "next" button.</li> </ol> <p>So i need help with -how to get button width as I have mentioned in 2) -and any sample code you can share to perform 3) above will also help me.</p> <p>any help here from any one of you experts out there will be much appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload