fix crash on old device by using new API conditionally

This commit is contained in:
Eric House 2016-07-02 12:29:16 -07:00
parent 88d8e61620
commit 68df61daa8

View file

@ -86,6 +86,9 @@ public class ChatDelegate extends DelegateBase {
m_scroll = (ScrollView)findViewById( R.id.scroll );
m_layout = (TableLayout)findViewById( R.id.chat_history );
// OnLayoutChangeListener added in API 11
if ( 11 <= Integer.valueOf( android.os.Build.VERSION.SDK ) ) {
m_layout.addOnLayoutChangeListener( new OnLayoutChangeListener() {
@Override
public void onLayoutChange( View vv, int ll, int tt, int rr,
@ -94,6 +97,7 @@ public class ChatDelegate extends DelegateBase {
scrollDown();
}
});
}
DBUtils.HistoryPair[] pairs
= DBUtils.getChatHistory( m_activity, m_rowid, locals );
@ -110,7 +114,7 @@ public class ChatDelegate extends DelegateBase {
// Should really assert....
finish();
}
}
} // init
@Override
protected void onResume()