在类名中使用“ this”

在类名中使用“ this”,第1张

在类名中使用“ this”

通常,您只能使用

this
。但是,有时
this
引用一个内部类…因此,例如:

Button button = (Button)findViewById(R.id.ticket_details_sell_ticket);button.setonClickListener(new onClickListener() {    @Override    public void onClick(View v) {        // it will be wrong to use only "this", because it would        // reference the just created onClickListener object        Intent login = new Intent(ClassName.this, Login.class);        startActivityForResult(login, LOGIN_REQUEST);    }});


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5478655.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-12
下一篇2022-12-12

发表评论

登录后才能评论

评论列表(0条)

    保存