Example usage for android.view ViewGroup removeView

List of usage examples for android.view ViewGroup removeView

Introduction

In this page you can find the example usage for android.view ViewGroup removeView.

Prototype

@Override
public void removeView(View view) 

Source Link

Document

Note: do not invoke this method from #draw(android.graphics.Canvas) , #onDraw(android.graphics.Canvas) , #dispatchDraw(android.graphics.Canvas) or any related method.

Usage

From source file:com.yanzhenjie.album.app.gallery.PreviewAdapter.java

@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
    container.removeView(((View) object));
}

From source file:library.slideMenu.SlideMenu.java

public static void removeViewFromParent(View view) {
    if (null == view) {
        return;/*from   w  w w .  ja  v  a2 s  .  c  o m*/
    }
    ViewGroup parent = (ViewGroup) view.getParent();
    if (null == parent) {
        return;
    }
    parent.removeView(view);
}

From source file:com.siso.app.adapter.BannerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    final View view = viewlist.get(position);
    final ImageView imageView = (ImageView) view.findViewById(R.id.item_banner_img);
    //      final LinearLayout loading = (LinearLayout)view.findViewById(R.id.item_banner_loading);
    Log.i("tag", "imgUrl[position]==" + imgUrl[position]);
    if (imageView.getDrawable() == null) {
        Picasso picasso = Picasso.with(imageView.getContext());
        picasso.load(imgUrl[position]).into(imageView);
        //         Log.i("image", "position=="+position+""+imgUrl[position]);
        //         AsyncHttpClient client=new AsyncHttpClient();
        //         client.get(imgUrl[position], new AsyncHttpResponseHandler() {
        //            
        //            @Override
        //            public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
        //               if(statusCode==200){
        //                  BitmapFactory factory=new BitmapFactory();
        //                  Bitmap bitmap=factory.decodeByteArray(responseBody, 0, responseBody.length);
        //                  imageView.setImageBitmap(bitmap);
        //                  loading.setVisibility(View.GONE);
        //               }
        //            }
        //            
        //            @Override
        //            public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) {
        //               loading.setVisibility(View.GONE);
        //               Toast.makeText(context, context.getResources().getString(R.string.timeoutError), Toast.LENGTH_SHORT);
        //            }
        //         });
    }//  w  w  w. j  a v a 2  s . co m

    ViewParent vp = view.getParent();
    if (vp != null) {
        ViewGroup parent = (ViewGroup) vp;
        parent.removeView(view);
    }
    container.addView(view);
    return view;
}

From source file:rss.RssFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (view == null) {
        view = inflater.inflate(R.layout.fragment_layout, container, false);
        progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
        listView = (ListView) view.findViewById(R.id.listView);
        listView.setOnItemClickListener(this);
        startService();//  ww  w  .j  a  v a2 s  . c  o  m
    } else {
        // If we are returning from a configuration change:
        // "view" is still attached to the previous view hierarchy
        // so we need to remove it and re-attach it to the current one
        ViewGroup parent = (ViewGroup) view.getParent();
        parent.removeView(view);
    }
    return view;
}

From source file:kz.qobyzbook.adapter.SongsPagerAdapter.java

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    Log.d(TAG, "destroyItem()");
    container.removeView((View) object);
}

From source file:org.libreoffice.impressremote.adapter.SlidesPagerAdapter.java

@Override
public void destroyItem(ViewGroup aViewGroup, int aPosition, Object aObject) {
    View aView = (View) aObject;

    aViewGroup.removeView(aView);
}

From source file:com.tmall.ultraviewpager.sample.UltraPagerAdapter.java

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    LinearLayout view = (LinearLayout) object;
    container.removeView(view);
}

From source file:com.dreamfactory.kurtishu.pretty.view.adapter.ImageViewerAdapter.java

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    View contentView = views.get(position);
    container.removeView(contentView);
}

From source file:com.ran.pics.activity.fragment.SettingFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (rootView != null) {
        ViewGroup parent = (ViewGroup) rootView.getParent();
        if (parent != null) {
            parent.removeView(rootView);
        }/*from w  w w . j a  v  a2 s .  c  om*/
    } else {
        initView(inflater);
        initEvent();
    }
    return rootView;
}

From source file:ch.gianulli.flashcards.lists.CardsAdapter.java

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    container.removeView(((Flashcard) object).getView());
}