android - How to inflate custom ViewPager -
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:gravity="center_vertical" >`` <com.example.sumit.myapplication.custom_viewpager android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/pager_threee" xmlns:android="http://schemas.android.com/apk/res/android" /> </linearlayout>
the related java code is:
import android.support.v4.view.viewpager; viewpager vp; private static double latitude = 0.0; private static double longitude = 0.0; private static string country = ""; private static string locality = ""; private static string areacode = ""; private static string my_id = "0"; list<fragment> fragments = new arraylist<fragment>(); fragment frag_public_list; fragment frag_users_list; fragment frag_profile; fragment frag_photos; adapter _adapter; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main__users__page); frag_users_list = new users_list(); bundle bundle = new bundle(); bundle.putdouble("lat", latitude); bundle.putdouble("long", longitude); bundle.putstring("country", country); bundle.putstring("locality", locality); bundle.putstring("areacode", areacode); bundle.putstring("my_id", my_id); frag_users_list.setarguments(bundle); frag_public_list = new public_chat(); fragments.add(frag_public_list); fragments.add(frag_users_list); vp = (viewpager) findviewbyid(r.id.pager_threee);
the exception have been getting is:
java.lang.runtimeexception: unable start activity componentinfo{com.example.sumit.myapplication/com.example.sumit.myapplication.main_users_page}: android.view.inflateexception: binary xml file line #7: error inflating class com.example.sumit.myapplion.custom_viewpager
Comments
Post a Comment