I have an activity class that creates a view child object
public class DaDActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new DragSurface(this));
}
}
Here is my DragSurface.java
public class DragSurface extends View{
public DragSurface(Context context) {
super(context);
setFocusable(true);
}
}
And also I have dragsurface.xml file but I dont know how to use this xml file in my DragSurface.java.I mean I want DragSurface.java works with background,buttons or something like that in dragsurface.xml but I could not link .java to .xml
Thanks for help..
try the above line to inflate your xml file.
try the below code:::
Here is my DragSurface.java