views:

379

answers:

1

I have a simple application with a view and a class that should return a ListView. The application works unless I refactor, and I am refactoring not just renaming, the name of the class. Everything seems to get changed properly but the application throws an exception of : android.view.InflateException: Binary XML file line #2: Error inflating class

If I refactor back to the original name all is well. What is not being renamed that I am missing?

The code is

    package com.mynamespace.more.views;

import com.mynamespace.more.QTEvent;

import android.content.Context; import android.util.AttributeSet; import android.widget.CheckedTextView; import android.widget.LinearLayout;

public class MyListItem extends LinearLayout {

private QTEvent qtEvent;
private CheckedTextView checkbox;

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

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    checkbox = (CheckedTextView)findViewById(android.R.id.text1);
}

public void setQTEvent(QTEvent q) {
    this.qtEvent = q;
    checkbox.setText(q.getName());
    checkbox.setChecked(q.isComplete());
}

public QTEvent getEvent() {
    return qtEvent;
}

}

A: 

It would appear that some layout XML is still referencing the old name. The error will tell you which file and line this is occurring on.

You might also need to do an Eclipse Project -> Force Clean, or ant clean from the command line, to get rid of earlier editions of pre-compiled classes and whatnot.

CommonsWare
I am not sure what happened or what resolved the issue nut I think you were on the right track. I had tried to "clean" before and that did not work. Copying the source to another machine allowed the code to work and creating a new project with the code worked as well. thanks