0

所以我有这个 TabActivity (我知道已弃用,但我不习惯使用片段),但我遇到了问题。它没有调用 AnalisesPonto.class,我将 id 作为意图传递。我不知道这段代码有什么问题。这是 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)调用正确,只有这个不工作,不知道该怎么办。

4

0 回答 0