I have a FragmentPagerAdapter that calls back to my MainActivity as follows:
class MyFragmentPagerAdapter extends FragmentPagerAdapter
{
public void someMethod()
{
mMainActivity.setTextViewText("This is a test string");
}
}
In MainActivity:
class MainActivity extends Activity
{
public void setTextViewText(String text)
{
mTextView.setText(text);
}
}
The result is a single line of text that does not wrap in the TextView (it gets cut off). The TextView is 0dp in width and uses the weight of its parent as a width. The bizzare thing is that if I call setTextViewText() from within MainActivity itself, the text wraps just fine. It's only when I call it as a callback that the text no longer wraps. Why would this be? P.S. Both approaches are being done on the UI thread as proven by logging Thread.currentThread.getId().