I struggled for a few hours trying to get this outdated example to work. I finally figured it out, and I want to share some suggestions for anyone who is running into the same problems.
After following HBarker's instructions on how to update the depreciated Button members and successfully compile, I was still getting the following runtime error: "android.view.InflateException: Binary XML file line #23: Error inflating class org.anddev.android.customviews.ToggleButton"
The problem is that a
third ToggleButton constructor is missing. The solution is to add the following lines of code to ToggleButton.java
Using java Syntax Highlighting
public ToggleButton(Context context, AttributeSet attrs) {
super(context, attrs);
}
Parsed in 0.030 seconds, using
GeSHi 1.0.8.4
I think HBarker was hinting of this solution when mentioning using the constructor completion menu, but I was primarily focusing on the Map to int conversion, so it wasn't obvious to me. So to be extra specific, you can either copy and paste the code above, or use Right-Click>Source>Generate Constructors from Superclass... to add the missing constructor.