为什么让这个活动不显示我的布局?

时间:2014-01-20 18:02:56

标签: android android-intent android-activity

我有以下代码

@SuppressLint("NewApi")

公共类Happy_HourActivity扩展了SherlockActivity {

private ListView listaHP;
private Bundle bundle;
private List<HappyHourModel> listaHpModelResponse; 
private HappyHourAdapter adapterHappyHour;

public void OnCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_happy__hour);
    setTheme(R.style.Theme_Sherlock_Light_DarkActionBar);
    setSupportProgressBarIndeterminateVisibility(true);
    getSupportActionBar().setTitle("Happy Hour");       
    listaHP = (ListView)findViewById(R.id.list_happy);
    bundle = getIntent().getExtras();

并从名为“descriptionActivity”的活动中调用。

case R.id.happy:
        intent = new Intent(DescriptionActivity.this, Happy_HourActivity.class);
        intent.putExtra("_id", _bundle.getString("_id"));
        intent.putExtra("_name", _bundle.getString("_name"));
        startActivity(intent);
    break;

布局:

enter image description here

但这就是展示

enter image description here

1 个答案:

答案 0 :(得分:3)

这种方法对于你想要的东西是错误的,而且可能永远不会被称为

public void OnCreate(Bundle savedInstanceState){

应该是

@Override
public void onCreate(Bundle savedInstanceState){

小“o”。如果您有@Override注释,那么您的IDE可能会大吼大叫,让您在运行之前更容易诊断。