I want to read large file from sdcard into text view. I have idea but i don\'t know how to apply.
I think this things need to use: Handler And Thread
But i d
Your problem is that you are accessing a View owned by the GUI thread from the thread that is reading your file:
subtitletv.setText(text.toString());
You need to read the file, then pass its contents to the main thread to be displayed.
//Create a handler on the UI Thread:
private Handler mHandler = new Handler();
//Executed in a non-GUI thread:
public void updateView(){
final String str = TheDataFromTheFile;
mHandler.post(new Runnable(){
@Override
public void run() {
subtitletv.setText(str);
}
}
}