首页  >  文章  >  Java  >  Launch new Activity(Intent)

Launch new Activity(Intent)

Linda Hamilton
Linda Hamilton原创
2024-09-22 14:15:33257浏览

Launch new Activity(Intent)

XML file:

 <Button
           android:id="@+id/btn"
           android:onClick="launchSettings"
           android:text="button"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"/>

java file:

 public void launchSettings(View v){

        //Launch a new activity

        Intent i = new Intent(this,SettingActivity.class);
        startActivity(i);
    }

After adding these functionality you will be able to launch new Activity.

以上是Launch new Activity(Intent)的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn