tags:

views:

35

answers:

1

hi, I am new in android I have created 2 classes.first extends activity and 2nd extends View. I want to add buttons,image Views etc. into the second class....... how can I do this.....please help...........

A: 

Take a look at inflate in the View class, this allows you to inflate an arbitrary XML-file which is then added to a specific ViewGroup:

http://developer.android.com/reference/android/view/View.html#inflate(android.content.Context, int, android.view.ViewGroup)

Usage:

View.inflate(context, R.id.my_layout_file, myViewGroup);
TuomasR
can you provide a simple example. I will be greatful to you.please.
antony
See here: http://stackoverflow.com/questions/3820401/how-to-load-an-xml-inside-a-view-in-android/3820640#3820640
TuomasR