In the application, I'm afraid I have a custom view. I cannot declare it in the layout XML file, because I will use it from an action that contains my custom instance of the view, and I need to have access to it (I cannot override findViewById ...).
In this, I decided to declare all the GUI elements in the Activity.
But I just can not take a single step forward, since I can not even create an instance of viewGroup ...
Here is what I am trying:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ViewGroup vg = new ViewGroup(this.getApplicationContext());
setContentView(vg);
}
and I get "Unable to instantiate ViewGroup" ...
Can someone give a direct example on how to declare a viewGroup that contains views?
... XML ...?
, !