一个监听器绑定多个按钮控件

该博客介绍了如何在Android应用中使用同一个监听器ButtonListener为多个按钮设置点击事件。每个按钮点击后会启动不同的Activity,例如btnS01E01点击后启动S01E01Activity,以此类推。
摘要由CSDN通过智能技术生成
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class IndexActivity extends AppCompatActivity {

    private Button btnS01E01;
    private Button btnS01E02;
    private Button btnS01E03;
    private Button btnS01E04;
    private Button btnS01E05;
    private Button btnS01E06;

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

        btnS01E01 = (Button)findViewById(R.id.btnS01E01);
        btnS01E02 = (Button)findViewById(R.id.btnS01E02);
        btnS01E03 = (Button)findViewById(R.id.btnS01E03);
        btnS01E04 = (Button)findViewById(R.id.btnS01E04);
        btnS01E05 = (Button)findViewById(R.id.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值