代码之家  ›  专栏  ›  技术社区  ›  Sunil Kumar Sahoo

如何开始活动

  •  1
  • Sunil Kumar Sahoo  · 技术社区  · 15 年前

    Example1 Example2 ,它扩展了活动。 onclick

    Intent i = new Intent();
    i.setClassName("com.a.ui", "com.a.ui.Example2");
    startActivity(i);
    

    因此,我能够成功地获得示例2的UI。另一种叫意图的方法是什么?

    有没有别的方法来开始一项活动?

    3 回复  |  直到 15 年前
        1
  •  1
  •   Praveen    15 年前

    你可以这样称呼:

    startActivity(new Intent(com.a.ui.this, com.a.ui.Example2.class));
    
        2
  •  0
  •   krunal shah    15 年前

    你可以这样试试。

      Intent i = new Intent(com.a.ui.this, com.a.ui.Example2.class);
      startActivity(i);
    
        3
  •  0
  •   dijipiji    15 年前

    记住把这些活动包括在你的报告中清单.xml

    <activity android:name=".SampleActivity"
                      android:label="@string/app_name">
                <intent-filter>
                    <action android:name="android.intent.action.VIEW" />
                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>