Question: the id name is also the same id in the menu setting file; it is the same ID name and also imports the R; but
the id name is also the same id in the menu setting file; it is the same ID name and also imports the R; but also shows errors.... please give the reason and solution with Rid statement; the Ridactionhome always has errors although I import the R; please provide the solution with Ridstatements;
package com.example.dropdown;
import static com.example.dropdown.R;
import com.example.dropdown.R;
import android.content.SharedPreferences;
import android.osBundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.PopupMenu;
private boolean onMenuItemClickMenuItem menuItem
switch menuItemgetItemId
case Ridactionhome:
Toast.makeTextthisHome clicked", Toast.LENGTHSHORTshow;
break;
case Ridactionlightmode:
Toast.makeTextthisLight Mode activated", Toast.LENGTHSHORTshow;
setLightMode;
break;
case Ridactiondarkmode:
Toast.makeTextthisDark Mode activated", Toast.LENGTHSHORTshow;
setDarkMode;
break;
default:
return false;
return true;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
