java提示 method buttonPressed未调用

Sanefin Sanefin 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
package com.example.myapplicationforexample;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import android.util.Log;

import android.view.View;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
TextView mTextView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setupUI();
}

private void setupUI(){
setContentView(R.layout.activity_main);
mTextView = (TextView) findViewById(R.id.textView);
}

// Create a local variable for identifying the class where the log statements come from.
private final static String LOG_TAG = MainActivity.class.getSimpleName();

public void buttonPressed(View view){
Log.i(LOG_TAG, "buttonPressed(View) Called");

String stringValue = "Hello World!";

mTextView.setText(stringValue);

Log.v(LOG_TAG, " text changed to:" + stringValue);

Log.d(LOG_TAG, "buttonPressed(View) finished");
}
}

rt, 我在安卓机上按按钮,Android studio的logcat没有反应,是否是这段代码的问题呢,求助,谢谢各位大腿~
...全文

相关推荐

评论
收藏 已收藏
分享
返回顶部
Sanefin
Java SE 62,621 成员 307,251 内容