Wednesday, 15 May 2013

android - Resources$NotFoundException: Resource is not a Drawable (color or path)? -


I have a text view, when it is clicked, I am populating a list inside a dialog See this code worked fine, but today it is throwing exceptions.

This is my code:

  tvSelectedFont = (TextView) findViewById (R.id.lblQuoteSelectedFont); tvSelectedFont.setOnClickListener (New View.OnClickListener () {@Override public void onClick (View v) {ListView ListView = new ListView (reference); ListViewksetAdapter (New ArrayAdapter & LT; string & gt; (reference, android.R. layout.simple_list_item_1, new String [] { "default", "serif" "Monospace"})); final dialog dialog = new dialog (context); dialog.setContentView (listView); dialog.setTitle (R.string.txt_settings_QuotefontName) ; listView. Safety setOnItemClickListener (new AdapterView.OnItemClickListener () {@Override public void onItemClick (AdapterView & LT ;? & gt; parents, to see see, int position, long id) {string selectedTypeFace = ((TextView) Switch to) .getText () toString (). TvSelectedFont.setText (selected typeface); switch (selected typeface) {case "serif" Cynitkshotaipfes = typeface. SERIF; break; case "monospace" chosen Taiptaipfes = typeface. monospace; break; default: selected QuoteTypeFace = Typeface.DEFAULT; break;} TVQuoteTextSample.setTypeface (selected QuoteTypeFace, selected QuoteFontStyle); Dialog.dismiss (); }}); Dialog.show (); }});  

The logk error indicates:

  Device driver API version: 29 user location API version: 29 03-17 14: 33: 24.701 23220-23220 /com.example.manas.dailyquoteswidget E /: mali: REVISION = Linux-r3p2-01rel3 BUILD_DATE = Tue Julai 22 19:59:34 KST 2014 03-17 14: 33: 27.926 23220-23220 / com. Example Kmana dailyquoteswidget E / AndroidRuntime: Fatal Exception: The main process: com.example.manas.dailyquoteswidget, PID: 23220 android.content.res.Resources $ NotFoundException: Resource is not a Drawable (color or path): TypedValue {t = 0x2 / d = 0x7f0100a7 a = 3} android.content.res.Resources.loadDrawable (Resources.java:3415) on android.content.res.TypedArray.getDrawable (TypedArray.java:602) is android.widget.AbsListView & On lt ;. Init & gt; On android.widget.ListView (AbsListView.java:1089). & Lt; Init & gt; (ListView.java:152) android.widget.ListView at & Lt; Init & gt; (ListView.java:148) android.widget.ListView cum on. On & lt; Init & gt; (ListView.java:144) M.example.manas.dailyquoteswidget.DailyQuotesWidgetConfigureActivity configure $ 6.onClick (daily QuotesWidget on Skriytakjawa 182) android.view.View.performClick (Dekenkjawa 4640) on Android. View.View see $ PerformClick.run (Dekenkjawa 1 9 2425) callback (Handlrkjawa on Android.os.Handler.handle: 733) android.os on android.os.handler.dispatchMessage (handler.java:95) java.lang.reflect.Method.invokeNative on .Looper.loop (Looper.java:146) java.lang.reflect.Method.invoke (method.java / 15) on .com.android.internal.os on Android.ap (native Method) at Aktivetivtredkman (Certificate Thredkjawa TSS 593) .jygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:1283) on com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1099) Dalvik. (Original method) on system.NativeStart.main  

Understand the problem please any help?

I encountered this problem in a recently-made app. In my case, the problem is that I docly - Was putting an image in a folder named v21, which is not available in the old Android API.

The solution is downloadable in your drauble - also the DPI folders.

Hope that helps.


No comments:

Post a Comment