Android - Get "Source Not Found" Error after adding a custom layout -


i created custom layout extended relative layout , put 1 of activity. after got "source not found" error. code simple not sure cause , how debug error.

the code follow:

customlayout.class

public class customlayout extends relativelayout{  public customlayout(context context) {     super(context);     init(); }  public void init() {     this.inflate(getcontext(), r.layout.custom_layout, this); } 

custom_layout.xml

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" >  </relativelayout> 

myactivitylayout.xml

...... <com.example.view.customlayout      android:layout_width="match_parent"      android:layout_height="match_parent" /> ...... 

you have create constructor having context , attributeset parameters.

public commentbarlayout(context context,attributeset attrs) { super(context,attrs); }


Comments