I have a button, and when i click to it, i make textView.setText()
a very big text, 50000 symbols, and the interface stops for 3 seconds, how can i fix it?
- I tried to make it with Handle and thread, but it hasn`t helped.
I tried to make
textview.append()
, but it also hasn`t helped.MainActivity.this.runOnUiThread(new Runnable() { @Override public void run() { textText.append(rowItemHeader.getText().substring((endOfNews - 10000, endOfNews)); } });
Edit 1 no result
private class MyTask extends AsyncTask <Void, Void, String> {
String str;
TextView txt;
MyTask(String str, TextView txt){
this.str = str;
this.txt = txt;
}
public String doInBackground(Void... args) {
return str.substring(endOfNews - 10000, endOfNews);
}
public void onPostExecute(String myString) {
// do your update here or you will get that error (the original thread one)
txt.append(myString);
}
}
myString
correctly elaborated? – Veld