i am currently trying to assign each character that i get from a file in SD card into a different text view
could anyone advise how would i have to do this?
am quite unsure about adding textviews on the fly
try {
BufferedReader br = new BufferedReader(new FileReader(file));
String line="";
int c,counter=0;
while ((c = br.read()) != -1) {
line+=(char)c;
counter++;
}
char[] singleText = line.toCharArray();
for (int i = 1; i < counter; i++)
{
//text.append(singleText[i]);
}
}
catch (IOException e) {
//You'll need to add proper error handling here
}
//Find the view by its id
TextView tv = (TextView)findViewById(R.id.TextView01);
//Set the text
tv.setText(text);
i have done a counter to count how many textviews should be added as well as assigned the characters into an array but i cant seem to find the code to add a textview with a specific size for each char on the fly
Thanks in Advance
You mean this code ?
Similarly you can use all of these lovely api’s. To add a text view to your layout you must use
addView()