Reputation: 65
I'm attempting to make an App in Android Studio that changes the color of a box based on RGBA values gathered from a set of 4 Seek Bars (one for each RGBA value).
Currently I have it set so that the number value of each seek bar is displayed below the bar in real time.
I haven't gotten to the part where I connect the bars to anything other than the text below them. It was working like a charm until I went and added an ImageButton into the mix (via the design view) and all of a sudden I keep getting the following errors:
06-08 00:24:59.004 1581-1581/edu.ggc.tkeating.grizzlycolorsapptkeating E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{edu.ggc.tkeating.grizzlycolorsapptkeating/edu.ggc.tkeating.grizzlycolorsapptkeating.MainActivity}: android.view.InflateException: Binary XML file line #87: Error inflating class TextView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #87: Error inflating class TextView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at edu.ggc.tkeating.grizzlycolorsapptkeating.MainActivity.onCreate(MainActivity.java:22)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: File res/color/abc_search_url_text.xml from drawable resource ID #0x7f0b004e
at android.content.res.Resources.loadDrawable(Resources.java:1953)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.<init>(View.java:3330)
at android.widget.TextView.<init>(TextView.java:583)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:60)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:56)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103)
at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:980)
at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1039)
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at edu.ggc.tkeating.grizzlycolorsapptkeating.MainActivity.onCreate(MainActivity.java:22)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #18: <item> tag requires a 'drawable' attribute or child tag defining a drawable
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:178)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:885)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:822)
at android.content.res.Resources.loadDrawable(Resources.java:1950)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.<init>(View.java:3330)
at android.widget.TextView.<init>(TextView.java:583)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:60)
at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:56)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103)
at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:980)
at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1039)
at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at edu.ggc.tkeating.grizzlycolorsapptkeating.MainActivity.onCreate(MainActivity.java:22)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Now I've looked all over for solutions and I've found several similar issues here on StackOverflow and some other sites but nothing seems to be working. I'm not sure if my code is just too bulky or what. I checked the XML file referenced in the android.view.InflateException: Binary XML file line #87" Error but that's in an auto generated class that I haven't even touched
Here's the TextView that is giving me trouble in my content_main.xml file
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="@+id/textViewAlphaProg"
android:layout_below="@+id/seekBarAlpha"
android:layout_centerHorizontal="true"
android:background="@color/abc_search_url_text"/>
And here's my rather lengthy MainActivity.java
package edu.ggc.tkeating.grizzlycolorsapptkeating;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.SeekBar;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private static SeekBar seek_bar_red;
private static SeekBar seek_bar_blue;
private static TextView text_view_red;
private static TextView text_view_blue;
private static SeekBar seek_bar_green;
private static TextView text_view_green;
private static SeekBar seek_bar_alpha;
private static TextView text_view_alpha;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//start seekbar methods
seekbarred();
seekbarblue();
seekbargreen();
seekbaralpha();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
public void seekbarred() {
//Red Value
seek_bar_red = (SeekBar) findViewById(R.id.seekBarRed);
text_view_red = (TextView) findViewById(R.id.textViewRedProg);
text_view_red.setText("Red Value : " + seek_bar_red.getProgress() + " of " + seek_bar_red.getMax());
seek_bar_red.setOnSeekBarChangeListener(
new SeekBar.OnSeekBarChangeListener() {
int progress_value_red;
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
progress_value_red = progress;
text_view_red.setText("Red Value : " + progress + " of " + seek_bar_red
.getMax
());
//Toast.makeText(MainActivity.this, "SeekBar in Progress", Toast
//.LENGTH_LONG).show();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
/*Toast.makeText(MainActivity.this, "SeekBar in StartTracking", Toast
.LENGTH_LONG).show();*/
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
/*text_view.setText("Value : " + progress_value + " of " + seek_bar.getMax());
Toast.makeText(MainActivity.this, "SeekBar in StopTracking", Toast
.LENGTH_LONG).show();*/
}
}
);
}
public void seekbarblue() {
//blue Value
seek_bar_blue = (SeekBar) findViewById(R.id.seekBarBlue);
text_view_blue = (TextView) findViewById(R.id.textViewBlueProg);
text_view_blue.setText("Blue Value : " + seek_bar_blue.getProgress() + " of " +
seek_bar_blue
.getMax());
seek_bar_blue.setOnSeekBarChangeListener(
new SeekBar.OnSeekBarChangeListener() {
int progress_value_blue;
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
progress_value_blue = progress;
text_view_blue.setText("Blue Value : " + progress + " of " + seek_bar_blue
.getMax
());
//Toast.makeText(MainActivity.this, "SeekBar in Progress", Toast
//.LENGTH_LONG).show();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
/*Toast.makeText(MainActivity.this, "SeekBar in StartTracking", Toast
.LENGTH_LONG).show();*/
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
/*text_view.setText("Value : " + progress_value + " of " + seek_bar.getMax());
Toast.makeText(MainActivity.this, "SeekBar in StopTracking", Toast
.LENGTH_LONG).show();*/
}
}
);
}
public void seekbargreen() {
//Green Value
seek_bar_green = (SeekBar) findViewById(R.id.seekBarGreen);
text_view_green = (TextView) findViewById(R.id.textViewGreenProg);
text_view_green.setText("Green Value : " + seek_bar_green.getProgress() + " of " +
seek_bar_green.getMax());
seek_bar_green.setOnSeekBarChangeListener(
new SeekBar.OnSeekBarChangeListener() {
int progress_value_green;
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
progress_value_green = progress;
text_view_green.setText("Green Value : " + progress + " of " +
seek_bar_green.getMax());
//Toast.makeText(MainActivity.this, "SeekBar in Progress", Toast
//.LENGTH_LONG).show();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
/*Toast.makeText(MainActivity.this, "SeekBar in StartTracking", Toast
.LENGTH_LONG).show();*/
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
/*text_view.setText("Value : " + progress_value + " of " + seek_bar.getMax());
Toast.makeText(MainActivity.this, "SeekBar in StopTracking", Toast
.LENGTH_LONG).show();*/
}
}
);
}
public void seekbaralpha() {
//Alpha Value
seek_bar_alpha = (SeekBar) findViewById(R.id.seekBarAlpha);
text_view_alpha = (TextView) findViewById(R.id.textViewAlphaProg);
text_view_alpha.setText("Alpha Value : " + seek_bar_alpha.getProgress() + " of " +
seek_bar_alpha.getMax());
seek_bar_alpha.setOnSeekBarChangeListener(
new SeekBar.OnSeekBarChangeListener() {
int progress_value_alpha;
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
progress_value_alpha = progress;
text_view_alpha.setText("Alpha Value : " + progress + " of " +
seek_bar_alpha.getMax());
//Toast.makeText(MainActivity.this, "SeekBar in Progress", Toast
//.LENGTH_LONG).show();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
/*Toast.makeText(MainActivity.this, "SeekBar in StartTracking", Toast
.LENGTH_LONG).show();*/
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
/*text_view.setText("Value : " + progress_value + " of " + seek_bar.getMax());
Toast.makeText(MainActivity.this, "SeekBar in StopTracking", Toast
.LENGTH_LONG).show();*/
}
}
);
}
}
So if anybody knows how I can fix this so it can run again and I can continue on with coding that would be fantastic. And if anyone has any suggestions on an easier way to execute the seek bar function that would be nice too.
Upvotes: 2
Views: 1584
Reputation: 1415
I had similar issue caused by bad implementation made by Sony mobile.
Try adding:
android:hardwareAccelerated="true"
to your manifest file, or simply making minSdkVersion=14+.
The issue I suffered was related to hardware acceleration and the last error shown to me looks like what you are seeing right now.
For long story of this issue, see this.
Upvotes: 1
Reputation: 21
check it.
android:background="@color/abc_search_url_text"
see your logcat
dalvik.system.NativeStart.main(Native Method) Caused by: android.content.res.Resources$NotFoundException: File res/color/abc_search_url_text.xml from drawable resource ID #0x7f0b004e at
Upvotes: 2
Reputation: 658
If you look at your log you can see
android.content.res.Resources$NotFoundException: File res/color/abc_search_url_text.xml from drawable resource ID #0x7f0b004e
Meaning it cannot find color/abc_search_url_text
Upvotes: 3