我有一个内部的三项片段类的活动。 试图从他们的内部改变操作栏冠军时,我得到一个错误。 如果我尽量让班只是公众,而不是公共静态我得到一个错误,当我试图启动类。 它应该是很清楚的是,代码是喜好尽管这不应该改变任何东西。 下面的代码:
package com.simon.wikiics;
import android.preference.*;
import android.os.*;
import java.util.*;
public class MainSettingsActivity extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onBuildHeaders(List<Header> target) {
loadHeadersFromResource(R.xml.headers, target);
}
//If I don't make the classes static my app force closes when I try to start them
public static class NavigationSettingsActivity extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.navigation);
//The getActionBar() is what is giving me the error
getActionBar().setTitle("Navigation");
}
}
public static class InterfaceSettingsActivity extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.interf);
//The getActionBar() is what is giving me the error
getActionBar().setTitle("Interface");
}
}
public static class OtherSettingsActivity extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.other);
//The getActionBar() is what is giving me the error
getActionBar().setTitle("Other");
}
}
}