考慮這個下面的代碼:如何從OnClick方法擺脫對按鈕偵聽Android中
Button add_product_button = (Button) findViewById(R.id.add_product_button);
add_product_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//Before going further, we check whether all the information is provided or not
EditText item_title_text = (EditText) findViewById(R.id.item_title);
if(isEmpty(item_title_text)){
break;
}
我想要的「突破;」作爲我不想進一步處理的迴應(不執行其他代碼,只是退出)。
這是警告用戶沒有提供足夠的信息。我怎樣才能做到這一點?
是它返回; ;我已經忘記了它。 – user3787757