i just want to inflate one xml file and show it in viewpager pages.
lll
logcat:
FATAL EXCEPTION: main java.lang.StackOverflowError at android.graphics.drawable.BitmapDrawable.setAlpha(BitmapDrawable.java:406) at android.graphics.drawable.DrawableContainer.jumpToCurrentState(DrawableContainer.java:179) at android.widget.CompoundButton.jumpDrawablesToCurrentState(CompoundButton.java:319) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5158) at android.view.ViewGr
pageradapter class:
public class pageradapter extends PagerAdapter {
Context mContext;
LayoutInflater mLayoutInflater;
List<String> l = MainActivity.list;
ImageLoader mImageLoader;
public pageradapter(Context context) {
mContext = context;
mLayoutInflater = LayoutInflater.from(mContext.getApplicationContext());
}
@Override
public int getCount() {
return 4;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
// View itemView = mLayoutInflater.inflate(R.layout.img, container, false);
// ImageLoader mImageLoader = ImageLoader.getInstance();
View view = mLayoutInflater.inflate(R.layout.createnew, container);
// ImageView imageView = (ImageView) itemView.findViewById(R.id.imageView3);
// mImageLoader.displayImage("http://www.airtel.in/4g/images/airtel_4g_hotspot_responsive.jpg", imageView);
container.addView(view);
return view;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((LinearLayout) object);
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
}
xml file that i want to inflate and show it in viewpager ,same in all 4 pages:->
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New RadioButton"
android:id="@+id/radioButton"
android:layout_gravity="center_horizontal" />
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Switch"
android:id="@+id/switch1"
android:layout_gravity="center_horizontal" />
</LinearLayout>
container
inside theinflate()
? – Teillo