我使用了 if else 条件来显示手机的版本是否大于或等于 HoneyComb,然后它将显示ActionBar
否则不是 .. 这是我的onCreate
功能:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sign_up);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
}
editName = (EditText) findViewById(R.id.editName);
editUsername = (EditText) findViewById(R.id.editUsername);
editPassword = (EditText) findViewById(R.id.editPassword);
editEmail = (EditText) findViewById(R.id.editEmail);
editBatch = (EditText) findViewById(R.id.editBatch);
}
但是 eclipse 显示 Call requires Api level 11 (Current Min is 9) 的错误
如何摆脱这个错误?