我正在尝试制作计算器应用程序,但是我因为重写OnClickListner
而收到错误BtnAdd.setOnClickListener(new View.OnClickListner(){
@Override // getting red line here asking method does not override super class
public void onClick(View v){
Toast.makeText(getActivity(), "this is my Toast message!!! =)",
Toast.LENGTH_LONG).show();
}
});
答案 0 :(得分:0)
它不是getActivity
getApplicationContext
@Override // getting red line here asking method does not override super class
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "this is my Toast message!!! =)",
Toast.LENGTH_LONG).show();
}
});