I want to read from the text file which is placed in res/raw/text i am successful in reading but after every line in my output there is a strange character something like this "[]". And this character is at the end of every line in output where there is new line in my source file(text). Don't know how to remove this character from every line..
public class HelpActivity extends Activity{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.help);
TextView textview = (TextView)findViewById(R.id.TextView_HelpText);
textview.setText(readTxt());
}
private String readTxt() {
InputStream is = getResources().openRawResource(R.raw.text);
ByteArrayOutputStream byteArray = new ByteArrayOutputStream();
int i;
try
{
i = is.read();
while (i != -1)
{
byteArray.write(i);
i = is.read();
}
is.close();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return byteArray.toString();
}
}