Reputation: 1
app stopped when bootstrap dropdown inserted . used the bit available in the code section . button label etc. are working but when inserted the dropdown app stopped
Log cat
11-21 11:28:30.219 10128-10128/com.example.usr1.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.usr1.myapplication, PID: 10128
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.usr1.myapplication/com.example.usr1.myapplication.feature.MainActivity}: android.view.InflateException: Binary XML file line #0:
Binary XML file line #0: Error inflating class com.beardedhen.androidbootstrap.BootstrapDropDown
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.beardedhen.androidbootstrap.BootstrapDropDown
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.beardedhen.androidbootstrap.BootstrapDropDown
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:286)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.usr1.myapplication.feature.MainActivity.onCreate(MainActivity.java:30)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.IllegalArgumentException: text cannot be null
at android.graphics.Paint.measureText(Paint.java:1856)
at com.beardedhen.androidbootstrap.BootstrapDropDown.measureStringWidth(BootstrapDropDown.java:294)
at com.beardedhen.androidbootstrap.BootstrapDropDown.createDropDown(BootstrapDropDown.java:158)
at com.beardedhen.androidbootstrap.BootstrapDropDown.initialise(BootstrapDropDown.java:140)
at com.beardedhen.androidbootstrap.BootstrapDropDown.(BootstrapDropDown.java:87)
Upvotes: 0
Views: 458
Reputation: 11
Hey I believe I had a similar problem. What I did was add a String array into project/app/res/values/strings.xml.
add string array into your strings.xml like this:
<resources>
...
<string-array name="bootstap_dropdown_example_data">
<item>item1</item>
<item>item2</item>
<item>item3</item>
</string-array>
</resources>
make sure "string-array name" matches the array name in your XML file at app:dropdownResource="@array/..." Make sure you have items inside your strings.xml array.
Let me know if this works out for you!
Upvotes: 0
Reputation: 1
This is the code used in xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:components="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<com.beardedhen.androidbootstrap.BootstrapDropDown
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:bootstrapBrand="regular"
app:roundedCorners="true"
app:dropdownResource="@array/bootstrap_dropdown_example_data"
>
</com.beardedhen.androidbootstrap.BootstrapDropDown>
</RelativeLayout>
Upvotes: 0