1

How I set all line in textview have same length of character?

This is text in sqlite database

enter image description here

This is textview in android

enter image description here

my query code in main.class

db.open(); Cursor c = db.getdescIntro(department,degree);

    if (c.moveToFirst())
    {

        do {
            a  = (String)c.getString(0);                
            txt.setText(a);

            PDF = c.getString(2);
        } while (c.moveToNext());
    }
    db.close();

My database.class

public Cursor getdescIntro(String dep,String degree) {

return db.query("academic", new String[] {"desc","department","acapdf"},"department" + "=?" +" AND " + "degree" +"=?", new String[] {dep,degree}, null, null, null);

}

Gunnar Karlsson
  • 28,350
  • 10
  • 68
  • 71
GoftZzz
  • 11
  • 1

1 Answers1

0

If I understand your question right based on your screen shots, you're asking how to remove line breaks:

String myNewString = myString.replaceAll("\n", "");

If you're looking for a solution to have the text fit exactly with the TextView's bounds, see this SO answer: auto-scale-textview-text-to-fit-within-bounds

Community
  • 1
  • 1
Gunnar Karlsson
  • 28,350
  • 10
  • 68
  • 71
  • thank you. I mean that my sentence is so long then it will down on the next line since previous space. I does not need it down to next line. – GoftZzz Dec 16 '12 at 08:47
  • Thanks for clarification. Try to remove line breaks with the code in my answer and see if it helps. – Gunnar Karlsson Dec 16 '12 at 08:54