0

I'm using both ActionBarSherlock and HoloEverywhere as libraries in my project, and suddenly HoloEverywhere started messing up.

I made an AlertDialog like this:

AlertDialog.Builder alert = new AlertDialog.Builder(DomaCareDetailViewActivity.this)
    .setTitle(R.string.edit_service)
    .setItems(R.array.edit_service_array, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
                //tested and working code
            });
alert.create();
alert.show();

But the "create" line throws the exception:

03-21 17:05:35.167: E/AndroidRuntime(25499): FATAL EXCEPTION: main
03-21 17:05:35.167: E/AndroidRuntime(25499): android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
03-21 17:05:35.167: E/AndroidRuntime(25499):    at android.view.LayoutInflater.createView(LayoutInflater.java:613)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at org.holoeverywhere.LayoutInflater.tryCreateView(LayoutInflater.java:359)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:308)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:287)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:272)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:267)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at org.holoeverywhere.internal.AlertController$AlertParams.createListView(AlertController.java:143)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at org.holoeverywhere.internal.AlertController$AlertParams.apply(AlertController.java:129)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at org.holoeverywhere.app.AlertDialog$Builder.create(AlertDialog.java:60)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at com.invian.domacare.task.DomaCareDetailViewActivity$20.onClick(DomaCareDetailViewActivity.java:1004)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at android.view.View.performClick(View.java:4084)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at android.view.View$PerformClick.run(View.java:16966)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at android.os.Handler.handleCallback(Handler.java:615)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at android.os.Handler.dispatchMessage(Handler.java:92)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at android.os.Looper.loop(Looper.java:137)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at android.app.ActivityThread.main(ActivityThread.java:4931)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at java.lang.reflect.Method.invokeNative(Native Method)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at java.lang.reflect.Method.invoke(Method.java:511)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at dalvik.system.NativeStart.main(Native Method)
03-21 17:05:35.167: E/AndroidRuntime(25499): Caused by: java.lang.reflect.InvocationTargetException
03-21 17:05:35.167: E/AndroidRuntime(25499):    at java.lang.reflect.Constructor.constructNative(Native Method)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-21 17:05:35.167: E/AndroidRuntime(25499):    ... 24 more
03-21 17:05:35.167: E/AndroidRuntime(25499): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f01007a a=-1}
03-21 17:05:35.167: E/AndroidRuntime(25499):    at android.content.res.Resources.loadDrawable(Resources.java:1921)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at android.widget.ListView.<init>(ListView.java:153)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at org.holoeverywhere.widget.ListView.<init>(ListView.java:205)
03-21 17:05:35.167: E/AndroidRuntime(25499):    at org.holoeverywhere.widget.ListView.<init>(ListView.java:200)
03-21 17:05:35.167: E/AndroidRuntime(25499):    ... 27 more

I located the source in HoloEverywhere's com.holoeverywhere.internal.AlertController, and something is wrong with line 143:

final ListView listView = (ListView) mInflater
    .inflate(dialog.mListLayout, null);

Checking mListLayout's initializing brings me to line 383:

mListLayout = a.getResourceId(R.styleable.AlertDialog_listLayout,
    R.layout.select_dialog_holo);

This is as far as I get. I can't find "R.styleable.AlertDialog", but since the AlertDialog.create() throws the exception in my project, I'm sure this is where the problem lies. The select_dialog_holo.xml file does, however, have an error of sorts of its own:

Missing styles. Is the correct theme chosen for this layout?
Use the Theme combo box above the layout to choose a different layout, or fix the theme style references.

Failed to convert ?listDividerAlertDialog into a drawable
Couldn't find theme resource listDividerAlertDialog for the current theme

Anyone have any ideas on how to fix this?

Edit: Going through the HoloEverywhere layout folder, I notice that there are tons of these types of errors. For example, simple_list_item_1 gives me several "could not find resource" errors as well as a few "listPreferredPaddingLeft/Right/etc in attribute paddingLeft is not a valid format" errors.

S Fitz
  • 1,074
  • 15
  • 31
  • what is your minsdk and targetsdk api levels in your manifest? – petey Mar 21 '13 at 15:47
  • I'm going to be unhappy if minSDK has to be 11. – S Fitz Mar 21 '13 at 15:48
  • no, that what you have should be ok. your logs say a missing drawable is the culprit. – petey Mar 21 '13 at 15:55
  • check your styles.xml that the theme you are using is has the attribute ` parent="Holo.Theme"` as in the [demo](https://github.com/ChristopheVersieux/HoloEverywhere/blob/master/demo/res/values/styles.xml) – petey Mar 21 '13 at 15:59
  • I actually JUST fixed this by importing android.app.AlertDialog instead of org.holoeverywhere.app.AlertDialog. I feel like I cheated, though. – S Fitz Mar 21 '13 at 16:00
  • Hmm. I actually don't have any themes in styles.xml. I just have @style/Holo.Theme as an application attribute in my manifest. – S Fitz Mar 22 '13 at 09:38
  • Did you solve that problem. I am also facing the same problem. Please do post your solution if you have found any. – Vinuthan May 07 '13 at 12:32
  • Nope, my solution was to not use HoloEverywhere, unfortunately. – S Fitz May 08 '13 at 08:12

0 Answers0