mirror of https://github.com/BOINC/boinc.git
android: fixes bug reported through PlayStore system: NullPointerException while seting up Tab layout.
getTabHost would return null in some cases, moved it into onCreate, where application context is always present.
This commit is contained in:
parent
91f3fa1bed
commit
24bc9460a7
|
@ -62,6 +62,7 @@ public class BOINCActivity extends TabActivity {
|
|||
private Boolean mIsBound = false;
|
||||
|
||||
private TabHost tabHost;
|
||||
private Resources res;
|
||||
|
||||
// dummy jni to trigger PlayStore filter for CPU architecture
|
||||
static{
|
||||
|
@ -109,6 +110,10 @@ public class BOINCActivity extends TabActivity {
|
|||
|
||||
// adapt to custom title bar
|
||||
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_bar);
|
||||
|
||||
// get tab host and setup layout
|
||||
res = getResources();
|
||||
tabHost = getTabHost();
|
||||
setupTabLayout();
|
||||
}
|
||||
|
||||
|
@ -221,10 +226,6 @@ public class BOINCActivity extends TabActivity {
|
|||
* which tabs should be set up is defined in resources file: /res/values/configuration.xml
|
||||
*/
|
||||
private void setupTabLayout() {
|
||||
|
||||
Resources res = getResources();
|
||||
tabHost = getTabHost();
|
||||
|
||||
// set tabs
|
||||
if(res.getBoolean(R.bool.tab_status))
|
||||
setupTab(new TextView(this), getResources().getString(R.string.tab_status), R.drawable.icon_status_tab, StatusActivity.class);
|
||||
|
|
Loading…
Reference in New Issue