Comment lire un fichier dans la vue texte avec l'affichage approprié comme dans un fichier texte? Je peux lire le fichier en textview. Mais afficher comme dans le fichier texte. Mon dossier Texte original:Comment lire un fichier dans une vue texte avec un affichage correct comme dans un fichier texte?
Testing this 1
Satheeshisdf sdf asdfsdfasd fasdfsdfsd
i can able to do it.
Trying it thats all.`
Mais l'affichage comme ceci:
i can able to do it.
Trying it thats all.`
Mise en page:
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:layout_weight="1.0">
<TextView
android:id="@+id/subtitletv"
android:textSize="18dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
Programme:
subtitletv = (TextView)findViewById("R.id.t");
try {
FileReader fr=new FileReader(selectedfile);
BufferedReader br=new BufferedReader(fr);
String line = null;
try {
while(br.readLine()!=null)
{
line =br.readLine();
subtitletv.append(line);
subtitletv.append("\n");
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Update1: Mais maintenant je ne peux pas lire le gros fichier (50KB). Petit fichier de chargement bien.
homme Merci. Il travaille.Mais maintenant je ne peux pas lire grand fichier (30 Ko) .Comment faire. –
Quelle est l'erreur? –
L'activité ne répond pas. avec deux boutons attendez et ok –