Note that there are some explanatory texts on larger screens.

plurals
  1. POsplitting the text, make the view of text false in textview
    primarykey
    data
    text
    <p>i have a text file, that i want to display it's text in the number of text views,that i set their texts in run time.</p> <p>here is my code, that i use for my program:</p> <pre><code>while(text.length() &gt; 0) { text = text.trim(); int index = text.indexOf("L1"); int index2 = 0; temp = ""; if(index &gt; -1 &amp;&amp; index == 0) { index2 = text.indexOf("/L1"); temp = text.substring(index + 2, index2); temp.trim(); t = temp.toCharArray(); text = text.substring(index2 + 3, text.length()); index = text.indexOf("\r\n"); while(index &gt; -1 &amp;&amp; index == 0) { temp += "\r\n"; text = text.substring(index + 2, text.length()); index = text.indexOf("\r\n"); } temp = String.valueOf(t); } else { index = text.indexOf("L2"); if(index &gt; -1 &amp;&amp; index == 0) { index2 = text.indexOf("/L2"); temp = text.substring(index + 2, index2); text = text.substring(index2 + 3, text.length()); index = text.indexOf("\r\n"); while(index &gt; -1 &amp;&amp; index == 0) { temp += "\r\n"; text = text.substring(index + 2, text.length()); index = text.indexOf("\r\n"); } } else { index = text.indexOf("List"); if(index &gt; -1 &amp;&amp; index == 0) { index2 = text.indexOf("/List"); temp = text.substring(index + 4, index2); text = text.substring(index2 + 5, text.length()); index = text.indexOf("\r\n"); while(index &gt; -1 &amp;&amp; index == 0) { temp += "\r\n"; text = text.substring(index + 2, text.length()); index = text.indexOf("\r\n"); } } else { text = text.trim(); index = text.indexOf("Plain"); if(index &gt; -1 &amp;&amp; index == 0) { index2 = text.indexOf("/Plain"); temp = text.substring(index + 5, index2); text = text.substring(index2 + 6, text.length()); index = text.indexOf("\r\n"); while(index &gt; -1 &amp;&amp; index == 0) { temp += "\r\n"; text = text.substring(index + 2, text.length()); index = text.indexOf("\r\n"); } } } } } } for(int i = 0; i &lt; texts.length; i++) { TextView tv = new TextView(this); tv.setText(Farsi.Convert(texts[i])); Typeface font = Typeface.createFromAsset(getAssets(), "fonts/naz.ttf"); tv.setTypeface(font); tv.setTextColor(Color.BLACK); tv.setGravity(Gravity.RIGHT); tv.setPadding(10, 10, 10, 10); tv.setLayoutParams(params); linearLayout.addView(tv); } layout.addView(linearLayout); LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); this.addContentView(layout, p); } </code></pre> <p>i use some auxiliary words(such as "L1" and "/L1") for some reasons in text file, that delete them in run time. but, when i run the program, in the output the text that shown in text views, is not in right style, i want to align it to right, but in the output there are some additional text, that aren't in the input text file.</p> <p>in the 2 images in below, i attach the output with and without the auxiliary words in the input text file.</p> <p>output with auxiliary words:</p> <p><img src="https://i.stack.imgur.com/hCBdZ.jpg" alt="output with auxiliary words:"></p> <p>output without auxiliary words, in this state, i set the content of layout using, "setContentView" function, and read the whole file instead of split text using auxiliary words index. in this state, the input does not contain the auxiliary words.</p> <p><img src="https://i.stack.imgur.com/0rf62.jpg" alt="output without auxiliary words"></p> <p>what is the problem friends? thanks</p>
    singulars
    1. This table or related slice is empty.
    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