如何在Android Studio中控制多个活动

时间:2017-02-10 04:22:05

标签: android-layout listview android-studio android-intent android-activity

我目前正在开发一款具有物理,化学和数学各种公式的公式应用程序。 但问题是每个主题至少有20章,所以这就像60-70章。因此,如果我将进行那么多活动,我的应用程序大小肯定会增加。而且我的代码也很复杂。有没有简单的方法来做到这一点。也许碎片或类似的东西?

String phyChapters[] = {"Kinematics", "Laws of Motion", "Work Power Energy", "Rotational Motion",
        "Gravitation", "Thermodynamics", "Kinetic Theory of Gases", "Properties of Matters",
        "Oscillations", "Waves and Sound", "Current & Electricity", "Heating Eff. of Current",
        "Magnetic Eff. of Current", "Magnetism", "Electromagnetic Induction", "Alternating Current",
        "Electromagnetic Waves", "Ray Optics", "Wave Optics", "Dual Nature of Matter", "Atomic Physics",
        "Nuclear Physics", "Electronics"};

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_physics);

    ListAdapter phyAdapter = new ArrayAdapter<String>(this, R.layout.list_config, R.id.textView, phyChapters);
    ListView phyList = (ListView) findViewById(R.id.phyListView);
    phyList.setAdapter(phyAdapter);

我可以获取源代码吗?

0 个答案:

没有答案