Android Studio Can't find Drawable Resource -
package com.sarham.kabs.fruity; import android.support.v4.widget.drawerlayout; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.support.v7.app.actionbardrawertoggle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.listview; import android.widget.toast; public class mainactivity extends actionbaractivity implements adapterview.onitemclicklistener{ private drawerlayout drawerlayout; private listview listview; private string[] planets; private actionbardrawertoggle drawerlistener; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); drawerlayout = (drawerlayout)findviewbyid(r.id.drawerlayout); listview = (listview)findviewbyid(r.id.drawerlistview); planets = getresources().getstringarray(r.array.planets); listview.setadapter(new arrayadapter<>(this, android.r.layout.simple_list_item_1, planets)); listview.setonitemclicklistener(this); drawerlistener = new actionbardrawertoggle(this, drawerlayout, r.mipmap.ic_drawer, r.string.drawer_open, r.string.drawer_close){ @override public void ondraweropened(view drawerview) { super.ondraweropened(drawerview); toast.maketext(mainactivity.this,"drawer open", toast.length_long).show(); } @override public void ondrawerclosed(view drawerview) { super.ondrawerclosed(drawerview); toast.maketext(mainactivity.this, "drawer closed", toast.length_long).show(); } }; drawerlayout.setdrawerlistener(drawerlistener); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.menu_main, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); //noinspection simplifiableifstatement if (id == r.id.action_settings) { return true; } return super.onoptionsitemselected(item); } @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { toast.maketext(this, planets[position]+" selected", toast.length_long).show(); selectitem(position); } public void selectitem(int position){ listview.setitemchecked(position, true); settitle(planets[position]); } public void settitle(string title){ getsupportactionbar().settitle(title); } }
i'm working on project in android studio, i'm trying put navigation drawer icon receive error: 'cannot find symbol r.mipmap.if_drawer', i've tried placing in drawable same error thrown symbol 'r.drawable. ic_drawer'
after cleaning , rebuliding, following message:
error:(32, 26) error: no suitable constructor found actionbardrawertoggle(mainactivity,drawerlayout,int,int,int) constructor actionbardrawertoggle.actionbardrawertoggle(activity,toolbar,drawerlayout,t,int,int) not applicable (cannot instantiate arguments because actual , formal argument lists differ in length) constructor actionbardrawertoggle.actionbardrawertoggle(activity,drawerlayout,toolbar,int,int) not applicable (actual argument int cannot converted toolbar method invocation conversion) constructor actionbardrawertoggle.actionbardrawertoggle(activity,drawerlayout,int,int) not applicable (actual , formal argument lists differ in length) t type-variable: t extends drawable,drawertoggle declared in constructor actionbardrawertoggle(activity,toolbar,drawerlayout,t,int,int)
please clean project & rebuild .
build > clean project build > rebuild project
Comments
Post a Comment