How to load an XML inside a View in android?
<p>I am having a class that extends View. I have another class that extends activity and I want to add the first class to be loaded inside the activity class.
I tried the following code</p>

<pre><code>package Test2.pack;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;

public class Test2 extends Activity {
    /** Called when the activity is first created. */

    static view v;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);        

        try{
            v = (view) View.inflate(Test2.this, R.layout.main2, null);
        }catch(Exception e){
            System.out.println(" ERR " + e.getMessage()+e.toString());
        }       
    }
}

class view extends View{
    public view(Context context) {
        super(context);     
    }   
}
</code></pre>
