java - How to Call the class that extends RelativeLayout programatically in android? -


i've made layout in java class extending relativelayout , want call view programatically when button clicked. able set custom layout in xml file this

<com.sample.customlayout     android:layout_width="wrap_content"     android:layout_height="wrap_content"/> 

i have set sample of code below

public class card extends relativelayout {      textview tutorialok;      public card(context context) {         super(context);         init();     }      public card(context context, attributeset attrs) {         super(context, attrs);         init();     }      public card(context context, attributeset attrs, int defstyle) {         super(context, attrs, defstyle);         init();     } } 

how call class when button clicked ? since, i'm new android, tips or code helpful !

//custom layout called qualified name ... package.classname <com.sample.card   android:layout_width="wrap_content"   android:layout_height="wrap_content"/> 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -