onCreate Activity未调用

时间:2013-06-12 13:28:14

标签: java android tabs

所以我有这个TabActivity(我知道已被弃用,但我不习惯使用片段),但我遇到了问题。它没有调用AnalisesPonto.class,我将id作为intent传递。我不知道这段代码有什么问题。这是TabActivity代码:

 @SuppressWarnings("deprecation")
public class RelatorioPontos extends TabActivity {

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.relatorio_layout);

        TabHost tabHost = getTabHost();
        TabHost.TabSpec spec;

        Intent desc = getIntent().setClass(this, DadosPonto.class);
        spec = tabHost.newTabSpec("dados").setIndicator("Dados", null).setContent(desc);
        tabHost.addTab(spec);

        Intent an = getIntent().setClass(this, AnalisesPonto.class);
        TabSpec analises = tabHost.newTabSpec("analises").setIndicator("Análises", null).setContent(an);
        tabHost.addTab(analises);
//      tabHost.addTab(spec);

        Intent multim = getIntent().setClass(this, ArquivosMultimidia.class);
        TabSpec multimidia = tabHost.newTabSpec("multimidia").setIndicator("Multimídia", null).setContent(multim);
        tabHost.addTab(multimidia);
//      tabHost.addTab(spec);

        tabHost.setCurrentTab(0);
    }
}

这是AnalisesPonto.class:

public class AnalisesPonto extends ListActivity implements OnItemClickListener{

    private ArrayList<AnaliseEstrutural> analises;
    private String id;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.analises_ponto_layout);

        id = getIntent().getStringExtra("id");

        ListView listView = (ListView) findViewById(R.id.analises_list);
        listView.setOnItemClickListener(this);

        AnalisesDAO andao = new AnalisesDAO(this);
        analises = andao.relatorioAnalises(id);

        AnalisesAdapter analisesAdapter = new AnalisesAdapter(this);
        for(int j = 0; j < analises.size(); j++) {
            analisesAdapter.add(analises.get(j));
        }

        setListAdapter(analisesAdapter);
    }

    public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
    }

}

其他两个onCreate(DadosPonto.class和ArquivosMultimidia.class)被称为正确,只有这个没有用,并且不知道该怎么做。

0 个答案:

没有答案