android.content.res.Resources$NotFoundException: String array resource ID #0x7f070002

android content res resources notfoundexception: string resource id #0x0
android content res resources notfoundexception string resource id #0x7e2
caused by: android content res resources$notfoundexception: string resource id 0x2040003
caused by: android content res resources$notfoundexception: string resource id #0x3040002
android content res resources notfoundexception resource id #0x7f06006b
android content res resources$notfoundexception: resource id 0x7f060054
resources notfoundexception string resource id #0x3e8
unable to create application android content res resources notfoundexception

I'm having problem getting a string array for strings.xml .

The error is:

android.content.res.Resources$NotFoundException: String array resource ID #0x7f070002
            at android.content.res.Resources.getStringArray(Resources.java:472)
            at com.klh.lehava.MainActivity.onCreate(MainActivity.java:87)

Basically what I'm trying to do is to get a string-array called planets_array, and store it into mPlanetTitles. This is one of google's examples for navigation drawer, and I downloaded it from their site and modified it.

For some reason I don't get this error on Nexus 4 (android 5.0 lollipop), but I do get the problem on Galaxy S3, and LG G2 (android 4.4.4)

Here is my full code:

public class MainActivity extends Activity {
    private static MainActivity instance;

    public MainActivity() {
        instance = this;
    }
    private static String response_str;
    private static HttpResponse result;
    private DrawerLayout mDrawerLayout;
    private static ListView mDrawerList;
    private ActionBarDrawerToggle mDrawerToggle;
    private ArrayAdapter<String> adapter1;

    private static String isUserLoggedIn;

    private static String getUrl;

    public String getUrl() {
        return getUrl;
    }

    public static final String TAG = "loginCookie";

    private CharSequence mDrawerTitle;
    private static CharSequence mTitle;

    //private final ArrayList<String> assignArr0 = new ArrayList<String>();
    private static String[] mPlanetTitles;
    private static String[] mPlanetTitlesDisconnected;
    private static String[] mPlanetTitlesConnected;


    private static int checked;
    private String[] newAr;


    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        WebView webview;
        webview = (WebView) findViewById(R.id.webview);

        mTitle = mDrawerTitle = getTitle();
        mPlanetTitles = getResources().getStringArray(R.array.planets_array);
        mPlanetTitlesDisconnected = getResources().getStringArray(R.array.mPlanetTitlesDisconnected);
        mPlanetTitlesConnected = getResources().getStringArray(R.array.mPlanetTitlesConnected);
        mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
        mDrawerList = (ListView) findViewById(R.id.left_drawer);


        // set a custom shadow that overlays the main content when the drawer opens
        mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
        // set up the drawer's list view with items and click listener
        adapter1 = new ArrayAdapter<String>(this,
                R.layout.drawer_list_item, mPlanetTitlesDisconnected);
        mDrawerList.setAdapter(adapter1);
        mDrawerList.setOnItemClickListener(new DrawerItemClickListener());

        // enable ActionBar app icon to behave as action to toggle nav drawer
        getActionBar().setDisplayHomeAsUpEnabled(true);
        getActionBar().setHomeButtonEnabled(true);


        // ActionBarDrawerToggle ties together the the proper interactions
        // between the sliding drawer and the action bar app icon
        mDrawerToggle = new ActionBarDrawerToggle(
                this,                 
                mDrawerLayout,         
                R.drawable.ic_drawer,  
                R.string.drawer_open,  
                R.string.drawer_close  
        ) {
            public void onDrawerClosed(View view) {
                getActionBar().setTitle(mTitle);
                invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
            }

            public void onDrawerOpened(View drawerView) {
                getActionBar().setTitle(mDrawerTitle);
                invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
            }
        };
        mDrawerLayout.setDrawerListener(mDrawerToggle);

        if (savedInstanceState == null) {
            selectItem(0);
        }
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.main, menu);
        return super.onCreateOptionsMenu(menu);
    }



    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // The action bar home/up action should open or close the drawer.
        // ActionBarDrawerToggle will take care of this.
        if (mDrawerToggle.onOptionsItemSelected(item)) {
            return true;
        }
        // Handle action buttons
        switch (item.getItemId()) {
            default:
                return super.onOptionsItemSelected(item);
        }
    }


    private class DrawerItemClickListener implements ListView.OnItemClickListener {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            selectItem(position);
        }
    }

    private void selectItem(int position) {
        // update the main content by replacing fragments
        Bundle args = new Bundle();

        //isUserLoggedIn=IsLoggedIn();
        if (isUserLoggedIn == null) {
            Fragment fragment = new MainFragment();
            args.putInt(MainFragment.ARG_PLANET_NUMBER, position);

            fragment.setArguments(args);

            FragmentManager fragmentManager = getFragmentManager();
            fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

            mDrawerList.setItemChecked(position, true);
            setTitle(mPlanetTitles[position]);
            mDrawerLayout.closeDrawer(mDrawerList);
        } else {
            if (isUserLoggedIn.equals("0")) {
                if (position == 0) {
                    Fragment fragment = new MainFragment();
                    args.putInt(MainFragment.ARG_PLANET_NUMBER, position);

                    fragment.setArguments(args);

                    FragmentManager fragmentManager = getFragmentManager();
                    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

                    mDrawerList.setItemChecked(position, true);
                    setTitle(mPlanetTitles[position]);
                    mDrawerLayout.closeDrawer(mDrawerList);
                }
                if (position == 1) {
                    Fragment fragment = new AboutFragment();
                    args.putInt(AboutFragment.ARG_PLANET_NUMBER, position);

                    fragment.setArguments(args);

                    FragmentManager fragmentManager = getFragmentManager();
                    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

                    mDrawerList.setItemChecked(position, true);
                    setTitle(mPlanetTitles[position]);
                    mDrawerLayout.closeDrawer(mDrawerList);
                }
            } else if (isUserLoggedIn.equals("1")) {
                if (position == 0) {
                    Fragment fragment = new InOutFragment();
                    args.putInt(InOutFragment.ARG_PLANET_NUMBER, position);

                    fragment.setArguments(args);

                    FragmentManager fragmentManager = getFragmentManager();
                    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

                    mDrawerList.setItemChecked(position, true);
                    setTitle(mPlanetTitles[position]);
                    mDrawerLayout.closeDrawer(mDrawerList);
                }
                if (position == 1) {
                    Fragment fragment = new AddEventFragment();
                    args.putInt(AddEventFragment.ARG_PLANET_NUMBER, position);

                    fragment.setArguments(args);

                    FragmentManager fragmentManager = getFragmentManager();
                    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

                    mDrawerList.setItemChecked(position, true);
                    setTitle(mPlanetTitles[position]);
                    mDrawerLayout.closeDrawer(mDrawerList);
                }
                if (position == 2) {
                    Fragment fragment = new AboutFragment();
                    args.putInt(AboutFragment.ARG_PLANET_NUMBER, position);

                    fragment.setArguments(args);

                    FragmentManager fragmentManager = getFragmentManager();
                    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

                    mDrawerList.setItemChecked(position, true);
                    setTitle(mPlanetTitles[position]);
                    mDrawerLayout.closeDrawer(mDrawerList);


                }
                if (position == 3) {
                    Fragment fragment = new WebLogoutFragment();
                    args.putInt(WebLogoutFragment.ARG_PLANET_NUMBER, position);

                    fragment.setArguments(args);

                    FragmentManager fragmentManager = getFragmentManager();
                    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

                    mDrawerList.setItemChecked(0, true);
                    setTitle(mPlanetTitles[0]);
                    mDrawerLayout.closeDrawer(mDrawerList);

                }
            }
        }



        // update selected item and title, then close the drawer

    }

    @Override
    public void setTitle(CharSequence title) {
        mTitle = title;
        getActionBar().setTitle(mTitle);
    }



    @Override
    protected void onPostCreate(Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
        // Sync the toggle state after onRestoreInstanceState has occurred.
        mDrawerToggle.syncState();
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        // Pass any configuration change to the drawer toggls
        mDrawerToggle.onConfigurationChanged(newConfig);
    }


    public static class PlanetFragment extends Fragment {
        public static final String ARG_PLANET_NUMBER = "planet_number";


        public PlanetFragment() {
            // Empty constructor required for fragment subclasses
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {


            View rootView = inflater.inflate(R.layout.fragment_planet, container, false);
            int i = getArguments().getInt(ARG_PLANET_NUMBER);
            String planet = getResources().getStringArray(R.array.planets_array)[i];

            int imageId = getResources().getIdentifier(planet.toLowerCase(Locale.getDefault()),
                    "drawable", getActivity().getPackageName());
            ((ImageView) rootView.findViewById(R.id.image)).setImageResource(imageId);
            getActivity().setTitle(planet);*/
            return null;
        }
    }

    public static class AboutFragment extends Fragment {
        public static final String ARG_PLANET_NUMBER = "planet_number";


        public AboutFragment() {
            // Empty constructor required for fragment subclasses
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_about, container, false);
            int i = getArguments().getInt(ARG_PLANET_NUMBER);
            String planet = getResources().getStringArray(R.array.planets_array)[i];



            getActivity().setTitle(planet);

            return rootView;
        }
    }

    public static class MainFragment extends Fragment {
        public static final String ARG_PLANET_NUMBER = "planet_number";

        public static final String MY_DOMAIN = "klh-dev.com";

        public MainFragment() {
            // Empty constructor required for fragment subclasses
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {

            View rootView = inflater.inflate(R.layout.fragment_web, container, false);
            int i = getArguments().getInt(ARG_PLANET_NUMBER);
            String planet = getResources().getStringArray(R.array.planets_array)[i];


            WebView webview;
            webview = (WebView) rootView.findViewById(R.id.webview);

            webview.setWebViewClient(new WebViewClient() {
                @Override
                public void onPageFinished(WebView view, String url) {
                    String weburl = view.getUrl();
                    String cookies = CookieManager.getInstance().getCookie(url);
                    getUrl = view.getUrl();
                    isUserLoggedIn = IsLoggedIn();
                    Log.d(TAG, "All the cookies in a string:" + cookies);
                    if (weburl.equals("http://www.klh-dev.com/lehava/lehava/system/mlogin.php")) {
                        mDrawerList.setItemChecked(0, true);
                        getActivity().getActionBar().setTitle("התחברות");
                    } else if (weburl.equals("http://www.klh-dev.com/lehava/lehava/system/mtimecounter.php")) {
                        mDrawerList.setItemChecked(1, true);
                        getActivity().getActionBar().setTitle("כניסה/יציאה");
                    } else if (weburl.equals("http://www.klh-dev.com/lehava/lehava/system/madd.php")) {
                        mDrawerList.setItemChecked(2, true);
                        getActivity().getActionBar().setTitle("הוספת אירוע");
                    }
                }
            });
            webview.getSettings().setJavaScriptEnabled(true);
            webview.getSettings().setUseWideViewPort(true);
            webview.setWebChromeClient(new WebChromeClient());
            webview.loadUrl("http://www.klh-dev.com/lehava/lehava/system/mlogin.php");


            getActivity().setTitle(planet);

            return rootView;
        }
    }

    public static class InOutFragment extends Fragment {
        public static final String ARG_PLANET_NUMBER = "planet_number";

        public static final String MY_DOMAIN = "klh-dev.com";

        public InOutFragment() {
            // Empty constructor required for fragment subclasses
        }


        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {

            View rootView = inflater.inflate(R.layout.fragment_web, container, false);
            int i = getArguments().getInt(ARG_PLANET_NUMBER);
            String planet = getResources().getStringArray(R.array.planets_array)[i];


            WebView webview;
            webview = (WebView) rootView.findViewById(R.id.webview);

            webview.setWebViewClient(new WebViewClient() {
                @Override
                public void onPageFinished(WebView view, String url) {
                    String weburl = view.getUrl();
                    String cookies = CookieManager.getInstance().getCookie(url);
                    getUrl = view.getUrl();
                    isUserLoggedIn = IsLoggedIn();
                    Log.d(TAG, "All the cookies in a string:" + cookies);
                    if (weburl.equals("http://www.klh-dev.com/lehava/lehava/system/mlogin.php")) {
                        mDrawerList.setItemChecked(0, true);
                        getActivity().getActionBar().setTitle("התחברות");
                    } else if (weburl.equals("http://www.klh-dev.com/lehava/lehava/system/mtimecounter.php")) {
                        mDrawerList.setItemChecked(1, true);
                        getActivity().getActionBar().setTitle("כניסה/יציאה");
                    } else if (weburl.equals("http://www.klh-dev.com/lehava/lehava/system/madd.php")) {
                        mDrawerList.setItemChecked(2, true);
                        getActivity().getActionBar().setTitle("הוספת אירוע");
                    }
                }
            });
            webview.getSettings().setJavaScriptEnabled(true);
            webview.getSettings().setUseWideViewPort(true);
            webview.setWebChromeClient(new WebChromeClient());
            webview.loadUrl("http://www.klh-dev.com/lehava/lehava/system/mtimecounter.php");


            getActivity().setTitle(planet);

            return rootView;
        }
    }

    public static class AddEventFragment extends Fragment {
        public static final String ARG_PLANET_NUMBER = "planet_number";

        public static final String MY_DOMAIN = "klh-dev.com";

        public AddEventFragment() {
            // Empty constructor required for fragment subclasses
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {

            View rootView = inflater.inflate(R.layout.fragment_web, container, false);
            int i = getArguments().getInt(ARG_PLANET_NUMBER);
            String planet = getResources().getStringArray(R.array.planets_array)[i];


            WebView webview;
            webview = (WebView) rootView.findViewById(R.id.webview);

            webview.setWebViewClient(new WebViewClient() {
                @Override
                public void onPageFinished(WebView view, String url) {
                    String weburl = view.getUrl();
                    String cookies = CookieManager.getInstance().getCookie(url);
                    getUrl = view.getUrl();
                    isUserLoggedIn = IsLoggedIn();
                    Log.d(TAG, "All the cookies in a string:" + cookies);
                    if (weburl.equals("http://www.klh-dev.com/lehava/lehava/system/mlogin.php")) {
                        mDrawerList.setItemChecked(0, true);
                        getActivity().getActionBar().setTitle("התחברות");
                    } else if (weburl.equals("http://www.klh-dev.com/lehava/lehava/system/mtimecounter.php")) {
                        mDrawerList.setItemChecked(1, true);
                        getActivity().getActionBar().setTitle("כניסה/יציאה");
                    } else if (weburl.equals("http://www.klh-dev.com/lehava/lehava/system/madd.php")) {
                        mDrawerList.setItemChecked(2, true);
                        getActivity().getActionBar().setTitle("הוספת אירוע");
                    }
                }
            });
            webview.getSettings().setJavaScriptEnabled(true);
            webview.getSettings().setUseWideViewPort(true);
            webview.setWebChromeClient(new WebChromeClient());
            webview.loadUrl("http://www.klh-dev.com/lehava/lehava/system/madd.php");


            getActivity().setTitle(planet);

            return rootView;
        }
    }

    public static class WebLogoutFragment extends Fragment {
        public static final String ARG_PLANET_NUMBER = "planet_number";


        public WebLogoutFragment() {
            // Empty constructor required for fragment subclasses
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_web, container, false);

            WebView webview;
            webview = (WebView) rootView.findViewById(R.id.webview);

            webview.setWebViewClient(new WebViewClient() {
                @Override
                public void onPageFinished(WebView view, String url) {
                    String weburl = view.getUrl();
                    String cookies = CookieManager.getInstance().getCookie(url);
                    getUrl = view.getUrl();
                    isUserLoggedIn = IsLoggedIn();
                    Log.d(TAG, "All the cookies in a string:" + cookies);
                    if (weburl.equals("http://www.klh-dev.com/lehava/lehava/system/mlogin.php")) {
                        mDrawerList.setItemChecked(0, true);
                        getActivity().getActionBar().setTitle("התחברות");
                    } else if (weburl.equals("http://www.klh-dev.com/lehava/lehava/system/mlogin.php?log=1")) {
                        mDrawerList.setItemChecked(0, true);
                        getActivity().getActionBar().setTitle("התחברות");
                    } else if (weburl.equals("http://www.klh-dev.com/lehava/lehava/system/mtimecounter.php")) {
                        mDrawerList.setItemChecked(1, true);
                        getActivity().getActionBar().setTitle("כניסה/יציאה");
                    } else if (weburl.equals("http://www.klh-dev.com/lehava/lehava/system/madd.php")) {
                        mDrawerList.setItemChecked(2, true);
                        getActivity().getActionBar().setTitle("הוספת אירוע");
                    } else if (weburl.equals("http://www.klh-dev.com/lehava/lehava/system/mlogin.php?log=1")) {
                        mDrawerList.setItemChecked(2, true);
                        getActivity().getActionBar().setTitle("התחברות");
                    }
                }
            });
            webview.getSettings().setJavaScriptEnabled(true);
            webview.getSettings().setUseWideViewPort(true);
            webview.setWebChromeClient(new WebChromeClient());
            webview.loadUrl("http://www.klh-dev.com/lehava/lehava/system/mlogout.php");


            return rootView;
        }
    }

    public static BasicCookieStore getCookieStore(String cookies, String domain) {
        String[] cookieValues = cookies.split(";");
        BasicCookieStore cs = new BasicCookieStore();

        BasicClientCookie cookie;
        for (int i = 0; i < cookieValues.length; i++) {
            String[] split = cookieValues[i].split("=");
            if (split.length == 2)
                cookie = new BasicClientCookie(split[0], split[1]);
            else
                cookie = new BasicClientCookie(split[0], null);

            cookie.setDomain(domain);
            cs.addCookie(cookie);
        }
        return cs;

    }



        public void UpdateMenu()
        {
            runOnUiThread(new Runnable()
            {
                public void run()
                {
                    if (isUserLoggedIn == null) {
                        isUserLoggedIn = IsLoggedIn();
                    }
                    int i;
                    SparseBooleanArray localSparseBooleanArray;
                    if (isUserLoggedIn.equals("0")) {
                        mPlanetTitles = mPlanetTitlesDisconnected;
                    }
                    i = mDrawerList.getCount();
                    localSparseBooleanArray = mDrawerList.getCheckedItemPositions();

                    for (int j = 0; j < i ; j++)
                    {
                        if (isUserLoggedIn.equals("1")) {
                            mPlanetTitles = mPlanetTitlesConnected;
                        }
                        mDrawerList.setAdapter(new ArrayAdapter(instance, R.layout.drawer_list_item, mPlanetTitles));
                        mDrawerList.setItemChecked(checked, true);
                        if (localSparseBooleanArray.get(j)) {
                            checked = j;
                        }
                    }
                }
            });
        }
        public void showToast(final String toast)
        {
            runOnUiThread(new Runnable() {
                public void run()
                {
                    Toast.makeText(instance, toast, Toast.LENGTH_SHORT).show();
                }
            });
        }

        public static String IsLoggedIn()
        {
            new Thread(new Runnable()
            {
                public void run()
                {
                    BasicCookieStore localBasicCookieStore = getCookieStore(CookieManager.getInstance().getCookie(getUrl), "klh-dev.com");
                    BasicHttpContext localBasicHttpContext = new BasicHttpContext();
                    DefaultHttpClient localDefaultHttpClient = new DefaultHttpClient();
                    localDefaultHttpClient.setCookieStore(localBasicCookieStore);
                    localBasicHttpContext.setAttribute("http.cookie-store", localBasicCookieStore);
                    HttpGet localHttpGet = new HttpGet("http://klh-dev.com/lehava/lehava/system/isloggedin.php");
                    try
                    {
                        result = localDefaultHttpClient.execute(localHttpGet, localBasicHttpContext);
                        response_str = EntityUtils.toString(result.getEntity());
                        System.out.println(response_str);
                        instance.UpdateMenu();
                        isUserLoggedIn = response_str;
                    }
                    catch (ClientProtocolException localClientProtocolException)
                    {
                            localClientProtocolException.printStackTrace();
                    }
                    catch (IOException localIOException)
                    {
                            localIOException.printStackTrace();
                    }
                }
            }).start();
            String str = response_str;
            isUserLoggedIn = str;
            return str;
        }
    }

Line 87:

mPlanetTitles = getResources().getStringArray(R.array.planets_array);

strings.xml:

<resources>
    <string name="app_name">Lehava</string>
    <string-array name="planets_array">
        <item>login</item>
        <item>about</item>
        <item>start shift</item>
        <item>add event</item>
        <item>logout</item>
    </string-array>
    <string-array name="mPlanetTitlesDisconnected">
        <item>login</item>
        <item>about</item>
    </string-array>
    <string-array name="mPlanetTitlesConnected">
        <item>start shift</item>
        <item>add event</item>
        <item>about</item>
        <item>logout</item>
    </string-array>
    <string name="drawer_open">Open navigation drawer</string>
    <string name="drawer_close">Close navigation drawer</string>
    <string name="action_websearch">Web search</string>
</resources>

I have tried to create a resource named res and use getResources() instead and it didn't work. this is what I have tried:

Resources res = getResources();
mPlanetTitles = res.getStringArray(R.array.planets_array);

Make sure you don't have variants of the values resources, with the string array defined only for a subset of the variants. For example:

values-v21/strings.xml - defined
values/strings.xml - not defined

If the resource is present in at least one variant, you get the entry in R and can refer to it in code, but the runtime resource file variant does not necessarily have the resource.

android.content.res.Resources$NotFoundException: String resource , android.content.res.Resources$NotFoundException: String resource ID #0x0. The app is crashing when I try to run it. I think this issue has  @EricAnthony not just static Strings, just any Strings in general.The thing is that setText() can either accept in an int or a String.If you pass an int, Android tries to find the id of the precompiled String from Strings.xml, and 99% of the time, fails.

I got this error because I used TextView.setText(int) to set a number in the text. The problem is that Android thinks that the integer is a ressource id. Therefore I should encapsulate the interger inside of String.valueOf(int) so the code becomes TextView.setText(String.valueOf(int));

Android example - Resources.java, Android example source code file: Resources.java (charsequence, id, notfoundexception public String[] getStringArray(int id) throws NotFoundException { String[] res = mAssets. If the resource holds a complex * {@link android.content.res. Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

I solve the problem. Juste create a values/strings.xml file with all your string values define in values-v21/strings.xml.

More resource types, This page defines more types of resources you can externalize, including: A Integer Array: XML resource that provides an array of integers. The <bool> element's name will be used as the resource ID. resource reference: In Java: name: String. example: XML file saved at res/values-small/bools.xml : The following are top voted examples for showing how to use android.content.res.Resources.NotFoundException.These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.

Do this to render Integer to textview

TextView.setText(String.valueOf(int));

android.content.res.Resources$NotFoundException: Resource ID , android,android-tablayout. android.content.res.Resources$​NotFoundException: Resource ID ZygoteInit.main(ZygoteInit.java:616) Caused by: android.content.res. Resources$NotFoundException: String array resource ID #0x7f070002  Make sure you don't have variants of the values resources, with the string array defined only for a subset of the variants. For example: values-v21/strings.xml - defined values/strings.xml - not defined

in my case array.xml was in w820dp version. i just created another in values.xml without w820dp. Works!!!

Resources$NotFoundException: String resource ID” error. So what really happens? In Android Studio, there is a resource file called strings.xml  Android.content.res.Resources $ NotFoundException: Valor del recurso de matriz de cadenas # 0x7f070002. Tengo problemas para obtener una matriz de cadenas para strings.xml.

Hi. im trying to implement the standard drawer in my app (the one that shows up when you open the sample app), however i am getting a ResourceNotFoundException and i have no idea why. this is my co

Comments
  • Please highlight line 87 in your MainActivity
  • Where have you stored: strings.xml?
  • @FahadIshaque scroll down a bit and look I typed again line 87. Also I will highlight it now.
  • @Carnal values folder
  • Do you have resource variants for the values resources, with the string array in one variant but not in some other?
  • what if the value is defined in values/ but not values-v21/ ? Would it be available to all variants in that case?