I\'m trying to dynamically resize my textview but getlinecount() method always returns me 0 even after settext() and invalidate(). I\'m using the following code:
I made an asynctask class and did my getLineCount()-related tasks in its onPostExecute method.
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
new myAsyncTask().execute(null, null, null);
}
private class myAsyncTask extends AsyncTask {
@Override
protected Void doInBackground(final Void... params) {
// It's okay to leave this as it is
return null;
}
@Override
protected void onPostExecute(final Void result) {
super.onPostExecute(result);
//DO YOUR TASK HERE, getLineCount(), etc.
}
}