Android studio does not recognize a method within my code.
I implemented a method to handle the call.
private void saveDeal(){ String title = textTitle.getText().toString(); String description = textDescription.getText().toString(); String price = textPrice.getText().toString(); TravelDeal deal = new TravelDeal(title, description, price, ""); mDatabaseReference.push().setValue(deal); } private void clean(){ textTitle.setText(""); textDescription.setText(""); textPrice.setText(""); textTitle.requestFocus(); } But in the method call,
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()){ case R.id.menu_save: saveDeal(); Toast.makeText(this, "Deal saved", Toast.LENGTH_LONG); clean(); return true; default: return super.onOptionsItemSelected(item); } saveDeal() and clean() are still showing in red in the switch block.
Yes. They both belong to the same class.