in the name of GOD
hello i have a text file and want to read and show into textview with different font and color for odd line and even line , how to change this reading code :
code :
File sdcard = Environment.getExternalStorageDirectory();
File file = new File(sdcard,"komeil.txt");
StringBuilder text = new StringBuilder();
try {
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
text.append('\n');
while ((line = br.readLine()) != null) {
text.append(line);
text.append('\n');
}
}
catch (IOException e) {
//You'll need to add proper error handling here
}
like this text file :
file :
hello people i am student //black
i want to rad this file //green
different color //black
different font //green
how to do this //black
... //green
... //black
. //green
. //black
. //green