I am trying to make this work
<mypackage.Square
android:id="@+id/imageButton8"
android:contentDescription="@string/r8"
android:layout_height="50dp"
android:layout_width="47dp"
stringRandom="lalala"/>
where stringRandom is a custom variable from the java class Square located at src/mypackage
this is the java class Square:
public class Square extends ImageButton {
private String stringRandom;
public Square(Context context, boolean iswhite) {
super(context);
}
public Square(Context context, boolean iswhite, String piece) {
super(context);
}
public Square(Context context, AttributeSet attrs)
{
super(context, attrs);
}
}
I found an example here where they make work exactly the same as I am trying to, but I can not figure out why in my case it is not working. However I also found out that if instead of the right variable with the sample given you type anything else that should crash, it doesn't crash but it reports a java.null exception when getting the original variable.
Any clue?