I get null in Layout object which I try to obtain from a Textview each time after configuration change. The method containing the code is called from onResume().
I suspect I need to do some additional setup for it.
I have studied similar questions, but there isn't a clear answer to it.
What is the event which signals that Layout is ready after configuration changes? Is there some documentation for it?
EDITED:
public class BookDisplayAct extends Activity implements View.OnClickListener {
...
private TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
textView = (TextView) findViewById(R.id.textViewMain);
textView.setPadding(15, 15, 15, 15);
...
}
@Override
protected void onResume() {
...
renderBookView();
}
public void renderBookView() {
...
justifyText(spannable, textView);
...
}
private Spannable justifyText(Spannable spannable, TextView textView) {
Layout layout = textView.getLayout();
int line_count = layout.getLineCount();
...
}
I get the NullPointer exception with the last line.