android - Error: No resource found that matches the given name -


in file layouts following errors display in code

error: error: no resource found matches given name (at 'id' value '@id/question_text_view'). error: error: no resource found matches given name (at 'id' value '@id/next_button'). 

this layout file

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:gravity="center"     android:orientation="vertical" >      <textview         android:id="@id/question_text_view"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:padding="24dp"         />     <linearlayout          android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:gravity="center"         android:orientation="horizontal" >         <button              android:id="@+id/true_button"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="@string/true_button"         />         <button              android:id="@+id/false_button"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="@string/false_button"         />     </linearlayout>         <button          android:id="@id/next_button"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/next_button"         /> </linearlayout> 

this strings.xml

<?xml version="1.0" encoding="utf-8"?>     <resources>          <string name="app_name">geoquiz</string>         <string name="true_button">true</string>         <string name="false_button">false</string>         <string name="correct_toast">correct</string>         <string name="next_button">next</string>         <string name="incorrect_toast">incorrect</string>     <string name="action_settings">settings</string>     <string name="question_founder">frank reed horton founded apo on december 25 1947</string>     <string name="question_chief">willy wonka known cheif</string>     <string name="question_lady">the first lady became president in apo mary katz</string>     <string name="question_president">our current president of delta rho chapter  john dolan</string> <string name="question_alphabets">alpha, beta, gamma, delta, epsilon, eta, zeta</string> </resources> 

i know there know question_text_view on strings did make array in activity takes of questions mquestiontextview =(textview)findviewbyid(r.id.question_text_view); int question = mquestionbank[mcurrentindex].getquestion(); mquestiontextview.settext(question); mquestionbank array of questions ask getquestion() getter method getting question

and second error next_button dont know did wrong since included on strings.xml can please me out

android:id="@id/question_text_view" should android:id="@+id/question_text_view" same button android:id="@id/next_button" should android:id="@+id/next_button"

textview

    <textview     android:id="@+id/question_text_view" //  missing + in xml code     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:padding="24dp"     /> 

button

    <button      android:id="@+id/next_button"  // missing + in xml code     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="@string/next_button"     />  

id

any view object may have integer id associated it, uniquely identify view within tree. when application compiled, id referenced integer, id typically assigned in layout xml file string, in id attribute. xml attribute common view objects (defined view class) , use often. syntax id, inside xml tag is:

the at-symbol (@) @ beginning of string indicates xml parser should parse , expand rest of id string , identify id resource. plus-symbol (+) means new resource name must created , added our resources (in r.java file).

in case consider id of button android:id="@id/next_button". referencing android resource id (assumes). not exist. it's same textview. hence resource not found error.

for more information check link below

http://developer.android.com/guide/topics/ui/declaring-layout.html


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -