我尝试在Android Studio中使用onClick
函数创建两个对接。但是我无法在日志事件面板中看到它们的状态。
以下是图片:App Image
这是代码:-
package com.example.demoap;
import androidx.appcompat.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
public void clickFunction(View view)
{
Log.i("Info", "Congratulations, button pressed!");
}
public void clickFunction1(View view)
{
Log.i("Info", "Congratulations,2 button pressed!");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
这是我运行项目并单击两个按钮时得到的。
20:42 IDE and Plugin Updates: Android Studio is ready to update.
20:42 Gradle sync started
20:43 Project setup started
20:43 Gradle sync finished in 39 s 529 ms (from cached state)
20:43 Source generation ended in 1 s 705 ms
20:45 * daemon not running; starting now at tcp:5037
20:45 * daemon started successfully
20:45 Executing tasks: [:app:assembleDebug]
20:45 Gradle build finished in 6 s 81 ms
20:46 Emulator: Process finished with exit code 0