android - Not able to access the XML file from layout getting Resource not found exception and xml file is in res folder -
this code accessing search_product_item.xml
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); if (rootutil.isdevicerooted()) finish(); if (getresources().getboolean(r.bool.portrait)) { span_count = 2; setrequestedorientation(activityinfo.screen_orientation_portrait); } else { span_count = 4; setrequestedorientation(activityinfo.screen_orientation_landscape); } setcontentview(r.layout.search_product_item);
this search_product_item xml file
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" android:orientation="vertical" > <include android:id="@+id/toolbar" layout="@layout/toolbar_main" /> <include android:id="@+id/footerlinkview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" layout="@layout/layout_footer_link_view" /> <include android:id="@+id/footerview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/footerlinkview" layout="@layout/layout_footer" /> <android.support.v7.widget.recyclerview android:id="@+id/recyclerview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/footerview" android:layout_below="@+id/toolbar" android:layout_centerinparent="true" /> </relativelayout>
my logcat
03-01 11:01:01.399: e/androidruntime(20344): fatal exception: main 03-01 11:01:01.399: e/androidruntime(20344): process: com.pg.dentistpartnerapp.mt, pid: 20344 03-01 11:01:01.399: e/androidruntime(20344): java.lang.runtimeexception: unable start activity componentinfo{com.pg.dentistpartnerapp.mt/com.pg.dentistpartnerapp.mt.activities.searchagainactivity}: android.content.res.resources$notfoundexception: resource id #0x7f030048 03-01 11:01:01.399: e/androidruntime(20344): @ android.app.activitythread.performlaunchactivity(activitythread.java:2298) 03-01 11:01:01.399: e/androidruntime(20344): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2360) 03-01 11:01:01.399: e/androidruntime(20344): @ android.app.activitythread.access$800(activitythread.java:144) 03-01 11:01:01.399: e/androidruntime(20344): @ android.app.activitythread$h.handlemessage(activitythread.java:1278) 03-01 11:01:01.399: e/androidruntime(20344): @ android.os.handler.dispatchmessage(handler.java:102) 03-01 11:01:01.399: e/androidruntime(20344): @ android.os.looper.loop(looper.java:135) 03-01 11:01:01.399: e/androidruntime(20344): @ android.app.activitythread.main(activitythread.java:5221) 03-01 11:01:01.399: e/androidruntime(20344): @ java.lang.reflect.method.invoke(native method) 03-01 11:01:01.399: e/androidruntime(20344): @ java.lang.reflect.method.invoke(method.java:372) 03-01 11:01:01.399: e/androidruntime(20344): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:899) 03-01 11:01:01.399: e/androidruntime(20344): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:694) 03-01 11:01:01.399: e/androidruntime(20344): caused by: android.content.res.resources$notfoundexception: resource id #0x7f030048 03-01 11:01:01.399: e/androidruntime(20344): @ android.content.res.resources.getvalue(resources.java:1233) 03-01 11:01:01.399: e/androidruntime(20344): @ android.content.res.resources.loadxmlresourceparser(resources.java:2598) 03-01 11:01:01.399: e/androidruntime(20344): @ android.content.res.resources.getlayout(resources.java:1049) 03-01 11:01:01.399: e/androidruntime(20344): @ android.view.layoutinflater.inflate(layoutinflater.java:412) 03-01 11:01:01.399: e/androidruntime(20344): @ android.view.layoutinflater.inflate(layoutinflater.java:365) 03-01 11:01:01.399: e/androidruntime(20344): @ android.support.v7.app.appcompatdelegateimplv7.setcontentview(appcompatdelegateimplv7.java:249) 03-01 11:01:01.399: e/androidruntime(20344): @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:106) 03-01 11:01:01.399: e/androidruntime(20344): @ com.pg.dentistpartnerapp.mt.activities.searchagainactivity.oncreate(searchagainactivity.java:120) 03-01 11:01:01.399: e/androidruntime(20344): @ android.app.activity.performcreate(activity.java:5933) 03-01 11:01:01.399: e/androidruntime(20344): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1105) 03-01 11:01:01.399: e/androidruntime(20344): @ android.app.activitythread.performlaunchactivity(activitythread.java:2251) 03-01 11:01:01.399: e/androidruntime(20344): ... 10 more
i cleaned project 100 times , restart eclipse problem didn't resolve. please provide solution.
is .xml file in res folder?
if yes put inside res/layout/file.xml
Comments
Post a Comment