Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5945141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:38:24+00:00 2026-05-22T16:38:24+00:00

As per this question, my app is throwing seemingly random errors. Code that works

  • 0

As per this question, my app is throwing seemingly random errors. Code that works fine starts to crash whenever I add a significant change (new resource, new code, function call), etc. The activity does not launch at all. The logcat output is telling me that the XML file has an error. Unfortunately, I haven’t touched that file. Looking at it closely, it’s also telling me something about a color resource not found in an animation XML file. The logcat output is below along with the code:

E/ActivityThread(   54): Failed to find provider info for android.server.checkin
E/AndroidRuntime(  241): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime(  241): java.lang.RuntimeException: Unable to start activity ComponentInfo{uris.apps.com/uris.apps.com.PlayGame}: android.view.InflateException: Binary XML file line #18: Error inflating class uris.apps.com.ClockTextView
E/AndroidRuntime(  241):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
E/AndroidRuntime(  241):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
E/AndroidRuntime(  241):        at android.app.ActivityThread.access$2200(Activi    tyThread.java:119)
E/AndroidRuntime(  241):        at android.app.ActivityThread$H.handleMessage(Ac    tivityThread.java:1863)
E/AndroidRuntime(  241):        at android.os.Handler.dispatchMessage(Handler.ja    va:99)
E/AndroidRuntime(  241):        at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  241):        at android.app.ActivityThread.main(ActivityThrea    d.java:4363)
E/AndroidRuntime(  241):        at java.lang.reflect.Method.invokeNative(Native     Method)
E/AndroidRuntime(  241):        at java.lang.reflect.Method.invoke(Method.java:5    21)
E/AndroidRuntime(  241):        at com.android.internal.os.ZygoteInit$MethodAndA    rgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime(  241):        at com.android.internal.os.ZygoteInit.main(Zygot    eInit.java:618)
E/AndroidRuntime(  241):        at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(  241): Caused by: android.view.InflateException: Binary XML fi    le line #18: Error inflating class uris.apps.com.ClockTextView
E/AndroidRuntime(  241):        at android.view.LayoutInflater.createView(Layout    Inflater.java:513)
E/AndroidRuntime(  241):        at android.view.LayoutInflater.createViewFromTag    (LayoutInflater.java:565)
E/AndroidRuntime(  241):        at android.view.LayoutInflater.rInflate(LayoutIn    flater.java:618)
E/AndroidRuntime(  241):        at android.view.LayoutInflater.inflate(LayoutInf    later.java:407)
E/AndroidRuntime(  241):        at android.view.LayoutInflater.inflate(LayoutInf    later.java:320)
E/AndroidRuntime(  241):        at android.view.LayoutInflater.inflate(LayoutInf    later.java:276)
E/AndroidRuntime(  241):        at com.android.internal.policy.impl.PhoneWindow.    setContentView(PhoneWindow.java:198)
E/AndroidRuntime(  241):        at android.app.Activity.setContentView(Activity.    java:1622)
E/AndroidRuntime(  241):        at uris.apps.com.PlayGame.onCreate(PlayGame.java    :41)
E/AndroidRuntime(  241):        at android.app.Instrumentation.callActivityOnCre    ate(Instrumentation.java:1047)
E/AndroidRuntime(  241):        at android.app.ActivityThread.performLaunchActiv    ity(ActivityThread.java:2459)
E/AndroidRuntime(  241):        ... 11 more
E/AndroidRuntime(  241): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime(  241):        at uris.apps.com.ClockTextView.<init>(ClockTextV    iew.java:29)
E/AndroidRuntime(  241):        at java.lang.reflect.Constructor.constructNative    (Native Method)
E/AndroidRuntime(  241):        at java.lang.reflect.Constructor.newInstance(Con    structor.java:446)
E/AndroidRuntime(  241):        at android.view.LayoutInflater.createView(Layout    Inflater.java:500)
E/AndroidRuntime(  241):        ... 21 more
E/AndroidRuntime(  241): Caused by: android.content.res.Resources$NotFoundExcept    ion: File res/anim/score_rotate.xml from color state list resource ID #0x7f04000    0
E/AndroidRuntime(  241):        at android.content.res.Resources.loadColorStateL    ist(Resources.java:1813)
E/AndroidRuntime(  241):        at android.content.res.Resources.getColor(Resour    ces.java:626)
E/AndroidRuntime(  241):        at uris.apps.com.ClockTextView.init(ClockTextVie    w.java:42)
E/AndroidRuntime(  241):        ... 25 more
E/AndroidRuntime(  241): Caused by: org.xmlpull.v1.XmlPullParserException: Binar    y XML file line #3: invalid drawable tag set
E/AndroidRuntime(  241):        at android.content.res.ColorStateList.createFrom    XmlInner(ColorStateList.java:144)
E/AndroidRuntime(  241):        at android.content.res.ColorStateList.createFrom    Xml(ColorStateList.java:127)
E/AndroidRuntime(  241):        at android.content.res.Resources.loadColorStateL    ist(Resources.java:1810)
E/AndroidRuntime(  241):        ... 27 more
E/gralloc (   54): [unregister] handle 0x4d08b0 still locked (state=40000001)

The animation resource is:

<?xml version="1.0" encoding="utf-8"?>

<set 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:interpolator="@android:anim/linear_interpolator"
    >
  <rotate 
      android:fromDegrees="-45" 
      android:toDegrees="-45" 
      android:pivotX="75%"
      android:pivotY="100%"
      android:duration="1" 
      android:repeatCount="infinite"
      >
  </rotate>
</set>

The PlayGame class is

package uris.apps.com;

import android.widget.*;
import android.widget.AdapterView.*;
import android.app.Activity;
import android.os.Bundle;
import android.view.*;
import android.view.View.*;
import android.content.*;
import android.graphics.PorterDuff.Mode;

/* the PlayGame class coordinates: (1) the TreeGenerator (which is
 * actually the underlying board, I don't know why I called it
 * TreeGenerator), (2) the GameGridView that displays the pictures, (3)
 * the progress bar, (4) the running clock. */

public class PlayGame extends Activity
{
    private GameGridView mGameGridView;
    private TreeGenerator mTree;
    private ImageAdapter mAdapter;
    private ClockTextView mRunningClock;

    //debug
    private TextView mTextView;

    // Menu
    static final private int RESTART = Menu.FIRST;
    static final private int BACK = Menu.FIRST + 1;

    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //get settings from OptionsMenu
    Intent settings=getIntent();
    int difficulty = settings.getIntExtra("level",
                          TreeGenerator.EASY);
    //create progress bar - must be called before setcontentview
    requestWindowFeature(Window.FEATURE_PROGRESS);

    setContentView(R.layout.play_game);

    //Set up TreeGenerator

    //difficulty = TreeGenerator.HARD;
    mTree = new TreeGenerator(12, difficulty, 3); // no art pieces,
                             // difficulty, no
                             // of stages

    //Set up GridView
    mGameGridView = (GameGridView) findViewById(R.id.game_grid_view);
    mAdapter = new ImageAdapter(this, mTree);
    mGameGridView.setAdapter(mAdapter);

    //Set up RunningClock
    mRunningClock = (ClockTextView) findViewById(R.id.running_clock);
    mRunningClock.initStartTime();

    //Call this method when user selects an image 
    mGameGridView.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, 
                    View v, 
                    int position, 
                    long id) {
            TreeGenerator mTree = PlayGame.this.mTree;

            //check answer
            boolean result = mTree.checkAnswer(position);
            String text = "Almost!";

            PlayGame.this.mGameGridView.deselect(); //if any

            if ( result ) { // if answer correct
            text = "Correct!";
            //update text view
            PlayGame.this.mGameGridView.flashGreen(position);
            }
            else {
             PlayGame.this.mGameGridView.flashRed(position);
            }

            //check if game complete
            if ( mTree.gameComplete() ) {
            mTree.nextGame();

            //PlayGame.this.mRunningClock.stop();
            //tally score/calculate scores
            //: max_score = no_stages * 1000;
            //: ideal_time = 2 * no_stages + 4;
            //: f(time,stage) = 1/time * max_score * ideal_time;

            float time = PlayGame.this.mRunningClock
                .getRunningTime();
            float max_score = mTree.getStages() * 1000.0f;
            float ideal_time = 2.0f * mTree.getStages() + 4.0f;
            Score.time_bonus = (int) (1.0f / time * max_score * ideal_time);

            PlayGame.this.mRunningClock.initStartTime();

            Intent scoreReport = new 
                Intent(
                   PlayGame.this, 
                   uris.apps.com.ScoreReport.class
                   );
            scoreReport.putExtra("score",Score.score);
            scoreReport.putExtra("incorrect",Score.incorrect_penal);
            scoreReport.putExtra("timebonus",Score.time_bonus);
            scoreReport.putExtra("noerrorbonus",Score.error_bonus);
            startActivity(scoreReport);
            }

            //update pictures
            PlayGame.this.mGameGridView.updateImages();

            //update progress bar
            PlayGame.this.updateProgressBar();

            if ( MyDebug.playGameDebug ) {
            //say if correct or not
            Toast.makeText(PlayGame.this, 
                       text + " " + position,
                       Toast.LENGTH_SHORT).show();
            }
        }
        });

    if ( MyDebug.playGameDebug) {
        Toast.makeText(PlayGame.this, 
                   "Level: "+String.valueOf(difficulty), 
                   Toast.LENGTH_SHORT).show();

        mTextView = (TextView) findViewById(R.id.textview);

        mTextView.setText(
                      mTree.toString() 
                      //+ "\n" + "Item sel: " + position
                      );
    }

    //init progress bar
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, 0);
    }

play_game.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
  <uris.apps.com.GameGridView 
      android:id="@+id/game_grid_view"
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"
      android:columnWidth="90dp"
      android:numColumns="auto_fit"
      android:verticalSpacing="10dp"
      android:horizontalSpacing="10dp"
      android:stretchMode="columnWidth"
      android:gravity="center"
      />
  <uris.apps.com.ClockTextView
      android:id="@+id/running_clock"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:textColor="#ffffff"
      android:textSize="50sp"
      />
  <!--Debug -->
  <TextView
      android:id="@+id/textview"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      />
</LinearLayout>

ClockView:

package uris.apps.com;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.widget.TextView;
import android.os.SystemClock;

public class ClockTextView extends TextView {

    private Paint textPaintColor;
    private long startTime;
    private float secs;

    public ClockTextView (Context context, AttributeSet ats, int ds) {
    super(context, ats, ds);
    init();
    }

    public ClockTextView (Context context) {
    super(context);
    init();
    }

    public ClockTextView (Context context, AttributeSet attrs) {
    super(context, attrs);
    init();
    }

    public void initStartTime() {
    startTime = SystemClock.uptimeMillis();
    }

    private void init() {
    // Get a reference to our resource table.
    Resources myResources = getResources();

    // Create the paint brushes we will use in the onDraw method.
    textPaintColor = new Paint(Paint.ANTI_ALIAS_FLAG);
    textPaintColor.setColor(myResources.getColor(R.color.clockTextColor));
    textPaintColor.setTextSize( 50 );

    startTime = SystemClock.uptimeMillis();

    // // Get the paper background color and the margin width.
    // paperColor = myResources.getColor(R.color.notepad_paper);
    //margin = myResources.getDimension(R.dimen.notepad_margin);
    }

    public float getRunningTime() {
    return secs;
    }

    @Override
    public void onDraw(Canvas canvas) {

    //number of milliseconds elapsed
    long curTime = SystemClock.uptimeMillis() - startTime;
    //convert to seconds
    secs = curTime / 1000.0f;
    //Round to 1 decimal place
    //float p = (float) Math.pow(10,1);
    secs = (float) (Math.round(secs*10.0f)/10.0f);

    canvas.drawText(String.valueOf(secs), 60, 60, textPaintColor);
    // Color as paper
    // canvas.drawColor(paperColor);

    // // Draw ruled lines
    // canvas.drawLine(0, 0, getMeasuredHeight(), 0, linePaint);
    // canvas.drawLine(0, getMeasuredHeight(), 
    //                    getMeasuredWidth(), getMeasuredHeight(), 
    //                    linePaint);

    // // Draw margin
    // canvas.drawLine(margin, 0, margin, getMeasuredHeight(), marginPaint);

    // // Move the text across from the margin
    // canvas.save();
    // canvas.translate(margin, 0);

    // Use the TextView to render the text.
    super.onDraw(canvas);
    //canvas.restore();
    invalidate();
    }
}

and finally the resource that defines the clock color:

<?xml version="1.0" encoding="utf-8"?>

<resources>
  <color name="clockTextColor">#FFFFFF</color>
</resources>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:38:25+00:00Added an answer on May 22, 2026 at 4:38 pm

    Thanks CommonsWare. Somehow the XML gets out of sync. Perhaps it’s because I’m not using Eclipse. Anyway, the workaround is to remove the bin directory, recompile, and install.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Per this question: Setting up rake-pipeline for use with handlebars alongside Google App Engine
Per this question: Setting up rake-pipeline for use with handlebars alongside Google App Engine
Per this question (see comments near the bottom), I was wondering if anyone knows
I've started to become a Good Citizen, as per this question here: Domain compatibility:
As per the title I have three parts to this question... Is db4o object
This is not a programming question per se, although the ultimate goal is to
This is not a question of premature optimization per se. On the garbage collector
All, I'm working on a SharePoint project, but this isn't a SharePoint-specific question per-se.
I've read every answer available for this question that I could find, including this
I know that this question asked a lot (i think) but i could not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.