Example usage for android.widget LinearLayout removeView

List of usage examples for android.widget LinearLayout removeView

Introduction

In this page you can find the example usage for android.widget LinearLayout 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:ru.strider.simplerecognizer.util.AdMob.java

public static void destroyAdView(Activity activity) {
    LinearLayout linearLayout = (LinearLayout) activity.findViewById(R.id.linearLayoutAdView);

    if (linearLayout != null) {
        AdView adView = (AdView) linearLayout.findViewById(R.id.adView);

        if (adView != null) {
            linearLayout.removeView(adView);

            adView.destroy();/*from  w ww .j ava 2 s.  c  o  m*/
        }
    }
}

From source file:org.kevoree.platform.android.boot.view.ManagerUI.java

@Override
public void removeView(View view) {

    if (view == null) {
        return;/* w  ww  .  ja  va2 s.  co  m*/
    }

    Log.i("Request remove view", "");
    LinkedList<ActionBar.Tab> newtabs = new LinkedList<ActionBar.Tab>();
    for (ActionBar.Tab tab : tabs) {
        LinearLayout tabLayout = (LinearLayout) tab.getTag();
        int childcount = tabLayout.getChildCount();
        for (int i = 0; i < childcount; i++) {
            View v = tabLayout.getChildAt(i);
            if (v != null) {
                if (v.equals(view)) {
                    tabLayout.removeView(view);
                }
            }
        }
        Log.i("Remove view " + tab.getText(), " " + ((LinearLayout) tab.getTag()).getChildCount());
        if (((LinearLayout) tab.getTag()).getChildCount() == 0) {
            if (tab.getPosition() == selectedTab) {
                selectedTab = ktab;
            }
            ctx.getSupportActionBar().removeTab(tab);
        } else {
            newtabs.add(tab);
        }
    }
    tabs.clear();
    tabs.addAll(newtabs);
    notifyObservers(this);
}

From source file:se.eliga.aves.birddetail.BirdDetailsTabActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.bird_details_tab_layout);

    final String latinSpecies = getIntent().getExtras().getString(BirdListFragment.LATIN_SPECIES);
    final String englishSpecies = getIntent().getExtras().getString(BirdListFragment.ENGLISH_SPECIES);
    final String swedishFamily = getIntent().getExtras().getString(BirdListFragment.SWEDISH_FAMILY);

    Bundle bundle = new Bundle(1);
    bundle.putString(BirdSpeciesWebFragment.ENGLISH_SPECIES, englishSpecies);
    bundle.putString(BirdSpeciesXenoCantoPlayerFragment.LATIN_SPECIES, latinSpecies);

    tabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
    tabHost.setup(this, getSupportFragmentManager(), R.id.tabFrameLayout);

    tabHost.addTab(/*from  w w  w  . j av  a 2 s.c o  m*/
            tabHost.newTabSpec("Wikipedia").setIndicator(getText(R.string.tab_wikipedia),
                    getResources().getDrawable(android.R.drawable.star_on)),
            BirdSpeciesWebFragment.class, bundle);
    tabHost.addTab(
            tabHost.newTabSpec("Flickr").setIndicator(getText(R.string.tab_photos),
                    getResources().getDrawable(android.R.drawable.star_on)),
            BirdSpeciesFlickrGalleryFragment.class, bundle);
    tabHost.addTab(
            tabHost.newTabSpec("xeno-canto").setIndicator(getText(R.string.tab_sounds),
                    getResources().getDrawable(android.R.drawable.star_on)),
            BirdSpeciesXenoCantoPlayerFragment.class, bundle);
    tabHost.addTab(
            tabHost.newTabSpec("Statistik").setIndicator(getText(R.string.tab_facts),
                    getResources().getDrawable(android.R.drawable.star_on)),
            BirdSpeciesFactsFragment.class, bundle);
    tabHost.addTab(tabHost.newTabSpec("Karta").setIndicator(getText(R.string.tab_map),
            getResources().getDrawable(android.R.drawable.star_on)), MapFragment.class, bundle);

    TabWidget tabWidget = (TabWidget) findViewById(android.R.id.tabs);
    LinearLayout linearLayout = (LinearLayout) tabWidget.getParent();
    HorizontalScrollView horizontalScrollView = new HorizontalScrollView(this);
    horizontalScrollView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.WRAP_CONTENT));
    linearLayout.addView(horizontalScrollView, 0);
    linearLayout.removeView(tabWidget);
    horizontalScrollView.addView(tabWidget);
    horizontalScrollView.setHorizontalScrollBarEnabled(false);

    BirdListSpinnerAdapter birdListSpinnerAdapter = createAdapter();
    birdListSpinnerAdapter.setFilterFamily(swedishFamily);
    birdListSpinnerAdapter.initialize(getSharedPreferences(Constants.BIRD_APP_SETTINGS, Context.MODE_PRIVATE));
    if (BirdListAdapter.SortOption.PHYLOGENETIC.equals(birdListSpinnerAdapter.getSortOption())) {
        birdListSpinnerAdapter.setSortOption(BirdListAdapter.SortOption.SWEDISH);
    }

    birdListSpinnerAdapter.refresh();
    birdListSpinnerAdapter.notifyDataSetChanged();

    Spinner spinner = new Spinner(this);
    spinner.setId(R.id.birdspecies_spinner);
    spinner.setAdapter(birdListSpinnerAdapter);
    spinner.setGravity(Gravity.FILL_HORIZONTAL);

    spinner.setSelection(birdListSpinnerAdapter.getPosition(new Bird(latinSpecies)));
    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            BirdSpeciesFragment fragment = (BirdSpeciesFragment) getSupportFragmentManager()
                    .findFragmentByTag(tabHost.getCurrentTabTag());
            Spinner spinner = (Spinner) getActionBar().getCustomView().findViewById(R.id.birdspecies_spinner);
            fragment.loadBird((Bird) spinner.getSelectedItem());
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {
        }
    });
    getActionBar().setCustomView(spinner);
    getActionBar().setDisplayOptions(
            ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM);

}

From source file:com.adguard.android.contentblocker.MainActivity.java

@SuppressWarnings("ConstantConditions")
private void refreshMainInfo() {
    boolean available = false;
    boolean reorder = false;

    final boolean samsungBrowserAvailable = BrowserUtils.isSamsungBrowserAvailable(this);
    final boolean yandexBrowserAvailable = BrowserUtils.isYandexBrowserAvailable(this);

    if (samsungBrowserAvailable) {
        available = true;//w ww  .jav a2s .c o m
        if (!yandexBrowserAvailable) {
            reorder = true;
        }
        findViewById(R.id.start_samsung_browser).setVisibility(View.VISIBLE);
        findViewById(R.id.start_samsung_settings).setVisibility(View.VISIBLE);
        findViewById(R.id.install_samsung_browser).setVisibility(View.GONE);
        findViewById(R.id.start_samsung_browser).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                BrowserUtils.startSamsungBrowser(MainActivity.this);
            }
        });
        findViewById(R.id.start_samsung_settings).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                BrowserUtils.openSamsungBlockingOptions(MainActivity.this);
            }
        });
    } else {
        findViewById(R.id.start_samsung_browser).setVisibility(View.GONE);
        findViewById(R.id.start_samsung_settings).setVisibility(View.GONE);
        findViewById(R.id.install_samsung_browser).setVisibility(View.VISIBLE);
        findViewById(R.id.install_samsung_browser).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ActivityUtils.startMarket(MainActivity.this, "com.sec.android.app.sbrowser", null);
            }
        });
    }

    if (yandexBrowserAvailable) {
        available = true;
        findViewById(R.id.start_yandex_browser).setVisibility(View.VISIBLE);
        findViewById(R.id.start_yandex_settings).setVisibility(View.VISIBLE);
        findViewById(R.id.install_yandex_browser).setVisibility(View.GONE);
        findViewById(R.id.start_yandex_browser).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                BrowserUtils.startYandexBrowser(MainActivity.this);
            }
        });
        findViewById(R.id.start_yandex_settings).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                BrowserUtils.openYandexBlockingOptions(MainActivity.this);
            }
        });
    } else {
        findViewById(R.id.start_yandex_browser).setVisibility(View.GONE);
        findViewById(R.id.start_yandex_settings).setVisibility(View.GONE);
        findViewById(R.id.install_yandex_browser).setVisibility(View.VISIBLE);
        findViewById(R.id.install_yandex_browser).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ActivityUtils.startMarket(MainActivity.this, "com.yandex.browser", "adguard1");
            }
        });
    }

    if (available) {
        findViewById(R.id.choose_browser_button).setVisibility(View.GONE);
        findViewById(R.id.enable_adguard_button).setVisibility(View.VISIBLE);

        findViewById(R.id.enable_adguard_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (yandexBrowserAvailable) {
                    BrowserUtils.openYandexBlockingOptions(MainActivity.this);
                } else {
                    BrowserUtils.openSamsungBlockingOptions(MainActivity.this);
                }
            }
        });

        if (reorder) {
            View yandex = findViewById(R.id.yandex_card);
            LinearLayout layout = (LinearLayout) findViewById(R.id.cards_layout);
            layout.removeView(yandex);
            layout.addView(yandex);
        }

        PreferencesService preferencesService = ServiceLocator.getInstance(getApplicationContext())
                .getPreferencesService();
        if (preferencesService.getBrowserConnectedCount() > 0) {
            View noBrowsersCard = findViewById(R.id.no_browsers_card);
            LinearLayout layout = (LinearLayout) findViewById(R.id.cards_layout);
            layout.removeView(noBrowsersCard);
            layout.addView(noBrowsersCard);
        }
    } else {
        findViewById(R.id.choose_browser_button).setVisibility(View.VISIBLE);
        findViewById(R.id.enable_adguard_button).setVisibility(View.GONE);

        findViewById(R.id.choose_browser_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                BrowserUtils.showBrowserInstallDialog(MainActivity.this);
            }
        });
    }

    refreshStatistics();

    FilterServiceImpl.enableContentBlocker(this);
}

From source file:com.t2.androidspineexample.AndroidSpineExampleActivity.java

private void generateChart() {
    // Set up chart
    XYMultipleSeriesDataset deviceDataset = new XYMultipleSeriesDataset();
    XYMultipleSeriesRenderer deviceRenderer = new XYMultipleSeriesRenderer();

    LinearLayout layout = (LinearLayout) findViewById(R.id.deviceChart);
    if (mDeviceChartView != null) {
        layout.removeView(mDeviceChartView);
    }/*w ww.  jav a2 s . c om*/
    if (true) {
        mDeviceChartView = ChartFactory.getLineChartView(this, deviceDataset, deviceRenderer);
        mDeviceChartView.setBackgroundColor(Color.BLACK);
        layout.addView(mDeviceChartView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    }

    deviceRenderer.setShowLabels(false);
    deviceRenderer.setMargins(new int[] { 0, 5, 5, 0 });
    deviceRenderer.setShowAxes(true);
    deviceRenderer.setShowLegend(false);

    deviceRenderer.setZoomEnabled(false, false);
    deviceRenderer.setPanEnabled(false, false);
    deviceRenderer.setYAxisMin(0);
    //        deviceRenderer.setYAxisMax(1000);

    // This is set rather arbitrarily based on observed resistance values in the log
    deviceRenderer.setYAxisMax(8000000);

    deviceDataset.addSeries(mSeries);

    XYSeriesRenderer seriesRenderer = new XYSeriesRenderer();
    seriesRenderer.setColor(Color.WHITE);
    seriesRenderer.setPointStyle(PointStyle.CIRCLE);

    deviceRenderer.addSeriesRenderer(seriesRenderer);
}

From source file:com.achep.base.ui.DialogBuilder.java

private View createSkeleton() {
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout rootLayout = (LinearLayout) inflater.inflate(R.layout.dialog_main_skeleton,
            new FrameLayout(mContext), false);
    TextView titleView = (TextView) rootLayout.findViewById(R.id.title);

    if (Device.hasLollipopApi()) {
        // The dividers are quite ugly with material design.
        rootLayout.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    }/*from  w w  w. ja  v a 2 s.com*/

    if (mTitleText == null && mIcon == null) {
        rootLayout.removeView(titleView);
    } else {
        if (mTitleText != null)
            titleView.setText(mTitleText);
        if (mIcon != null)
            titleView.setCompoundDrawablesWithIntrinsicBounds(mIcon, null, null, null);
    }

    return rootLayout;
}

From source file:com.rstar.mobile.thermocouple.ui.FormulaFragment.java

private void displayPolynomial(LayoutInflater inflater) {
    if (inflater == null) {
        inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }//ww  w  .ja  v a2  s  .c  o  m

    // Remove any existing table
    LinearLayout parent = mPolynomialView;
    if (tablePolynomial_Id != 0) {
        View view = parent.findViewById(tablePolynomial_Id);
        if (view != null)
            parent.removeView(view);
    }

    int order = -1;

    if (inputType == inputType_T) {
        if (fnResult == null)
            return;
        order = fnResult.polynomial.getOrder();
    } else if (inputType == inputType_E) {
        if (fnInvResult == null)
            return;
        order = fnInvResult.polynomial.getOrder();
    }
    Savelog.d(TAG, debug, "order=" + order);

    if (order == -1) {
        return;
    }

    int tableSize = 0;
    tablePolynomial_Id = 0;
    TableLayout tableLayout = null;

    if (order >= 0) {
        View view = inflater.inflate(R.layout.table_polynomial, parent, true);
        tableLayout = (TableLayout) view.findViewById(R.id.tablePolynomial_id);
        tableSize = PolynomialTable.MaxOrder;
        tablePolynomial_Id = R.id.tablePolynomial_id;
    }

    // Each row is a term in the polynomial

    for (int row = 0; row <= order; row++) {
        int cell_id;
        int column;
        int term = row;
        TextView cell;

        double coefficient = 0.0;
        if (inputType == inputType_T) {
            coefficient = fnResult.polynomial.getCoefficent(term);
        } else if (inputType == inputType_E) {
            coefficient = fnInvResult.polynomial.getCoefficent(term);
        }

        if (row == order) {
            column = 0;
            cell_id = PolynomialTable.cell_ids[row][column];
            cell = (TextView) tableLayout.findViewById(cell_id);
            cell.setText("+");
        }

        column = 1;
        cell_id = PolynomialTable.cell_ids[row][column];
        cell = (TextView) tableLayout.findViewById(cell_id);
        cell.setText("" + coefficient);

        column = 2;
        cell_id = PolynomialTable.cell_ids[row][column];
        cell = (TextView) tableLayout.findViewById(cell_id);
        cell.setText(Html.fromHtml("(" + mInput + ")<sup>" + term + "</sup>"));

    }
    for (int row = order + 1; row <= tableSize; row++) {
        int row_id = PolynomialTable.row_ids[row];
        TableRow tableRow = (TableRow) tableLayout.findViewById(row_id);
        tableLayout.removeView(tableRow);
    }

    // The result row shows the value computed by the polynomial

    {
        CharSequence sumPolyLabel = "";
        String sumPoly = "";
        if (inputType == inputType_T) {
            sumPoly = String.format("%.3f", fnResult.Epoly);
            sumPolyLabel = EequalLabel;
            // If there is an exponential term, use a different label
            if (fnResult.exponential != null)
                sumPolyLabel = getText(R.string.label_EPequals);

        } else if (inputType == inputType_E) {
            sumPoly = String.format("%.3f", fnInvResult.T);
            sumPolyLabel = TequalLabel;
        }

        int result_id;

        TextView resultCell;
        result_id = PolynomialTable.result_ids[1]; // column 1
        resultCell = (TextView) tableLayout.findViewById(result_id);
        resultCell.setText(sumPolyLabel);

        result_id = PolynomialTable.result_ids[2]; // column 2
        resultCell = (TextView) tableLayout.findViewById(result_id);
        resultCell.setText(sumPoly);
    }
}

From source file:com.rstar.mobile.thermocouple.ui.FormulaFragment.java

private void displayExponential(LayoutInflater inflater) {
    if (inputType == inputType_T && fnResult != null && fnResult.exponential != null) {
        // Also display exponential
        String exponentialLabel = "For T>0, add correction term:";
        Savelog.d(TAG, debug, "Exponential term=" + exponentialLabel);
        if (mExponentLabelView != null) {
            mExponentLabelView.setText(exponentialLabel);
            mExponentLabelView.setVisibility(View.VISIBLE);
        }//  w w w  .  j a v a 2  s. c o m
        String data = String.format("%.3f", fnResult.E);
        CharSequence exponentConclude = TextUtils.concat(getText(R.string.label_E_typeK), " = ", data);
        if (mExponentConcludeView != null) {
            mExponentConcludeView.setText(exponentConclude);
            mExponentConcludeView.setVisibility(View.VISIBLE);
        }
    } else {
        if (mExponentLabelView != null)
            mExponentLabelView.setVisibility(View.GONE);
        if (mExponentConcludeView != null)
            mExponentConcludeView.setVisibility(View.GONE);
    }

    LinearLayout parent = mExponentialView;

    // Remove any existing table
    TableLayout tableLayoutE;
    if (tableExponential_Id != 0) {
        tableLayoutE = (TableLayout) parent.findViewById(tableExponential_Id);
        parent.removeView(tableLayoutE);
        tableExponential_Id = 0;
    }

    // Handle exponential term if exists
    if (inputType == inputType_T && fnResult != null && fnResult.exponential != null) {
        if (inflater == null) {
            inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        }

        tableExponential_Id = R.id.tableExponential_id;
        View view = inflater.inflate(R.layout.table_exponent, parent, true);
        tableLayoutE = (TableLayout) view.findViewById(tableExponential_Id);

        int cell_id;
        TextView cell;

        for (int row = 0; row <= 2; row++) {
            int term = row;
            cell_id = ExponentialTable.cell_ids[row][1];
            cell = (TextView) tableLayoutE.findViewById(cell_id);
            cell.setText("" + fnResult.exponential.getTerm(term));
        }

        // T
        cell_id = ExponentialTable.cell_ids[3][1];
        cell = (TextView) tableLayoutE.findViewById(cell_id);
        cell.setText("" + fnResult.Tinput);

        // correction
        cell_id = ExponentialTable.result_ids[1];
        cell = (TextView) tableLayoutE.findViewById(cell_id);
        String correction = String.format("%.3f", fnResult.correction);
        cell.setText("" + correction);
    }
}

From source file:net.sourceforge.lifeograph.ActivityDiary.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Log.d(Lifeograph.TAG, "ActivityDiary.onCreate()");

    Lifeograph.sContext = this;
    Lifeograph.updateScreenSizes();//from   w w  w  .  ja  v a2  s .co m
    Lifeograph.sNumberOfDiaryEditingActivities++;

    // PICKING UP THE APPROPRIATE LAYOUT
    if (Lifeograph.getScreenWidth() >= 4.0) {
        setContentView(R.layout.diary_wide);

        mButtonCalendar = (Button) findViewById(R.id.button_calendar);
        mButtonCalendar.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                new DialogCalendar(ActivityDiary.this, !Diary.diary.is_read_only()).show();
            }
        });

        ViewPager pagerCalendar = (ViewPager) findViewById(R.id.pager_calendar);
        mCalPagerAdapter = new PagerAdapterCalendar(pagerCalendar);
    } else {
        mCalPagerAdapter = null;
        setContentView(R.layout.diary);
    }

    // FILLING WIDGETS
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    //mInflater = ( LayoutInflater ) getSystemService( Activity.LAYOUT_INFLATER_SERVICE );

    // LISTENERS
    mDrawerLayout.setDrawerListener(new DrawerLayout.DrawerListener() {
        public void onDrawerSlide(View view, float v) {
        }

        public void onDrawerOpened(View view) {

            for (FragmentElemList fragment : mDiaryFragments) {
                if (fragment.isVisible())
                    fragment.getListView().setEnabled(false);
            }

            // alternative way:
            //                for( int i = 0; i < 3; i++ ) {
            //                    FragmentElemList fragment = ( FragmentElemList ) getFragmentManager()
            //                            .findFragmentByTag( TabsAdapter.makeFragmentName( i ) );
            //                    if( fragment != null )
            //                        if( fragment.isVisible() )
            //                            fragment.getListView().setEnabled( false );
            //                }
        }

        public void onDrawerClosed(View view) {
            for (FragmentElemList fragment : mDiaryFragments) {
                if (fragment.isVisible())
                    fragment.getListView().setEnabled(true);
            }
        }

        public void onDrawerStateChanged(int i) {
        }
    });

    // ACTIONBAR
    mActionBar = getActionBar();
    if (mActionBar != null) {
        mActionBar.setDisplayHomeAsUpEnabled(true);
        mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        mActionBar.setIcon(R.drawable.ic_diary);
        setTitle(Diary.diary.get_title_str());
        mActionBar.setSubtitle(Diary.diary.get_info_str());
    }

    mPager = (ViewPager) findViewById(R.id.pager);
    mTabsAdapter = new TabsAdapter(this, mPager);

    Bundle args = new Bundle();
    args.putInt("tab", 0);
    mTabsAdapter.addTab(mActionBar.newTab().setText(R.string.all_entries), FragmentElemList.class, args);
    args = new Bundle();
    args.putInt("tab", 1);
    mTabsAdapter.addTab(mActionBar.newTab().setText(R.string.chapters), FragmentElemList.class, args);
    args = new Bundle();
    args.putInt("tab", 2);
    mTabsAdapter.addTab(mActionBar.newTab().setText(R.string.tags), FragmentElemList.class, args);

    if (savedInstanceState != null) {
        mActionBar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
    }

    if (!Lifeograph.getAddFreeNotPurchased()) {
        LinearLayout container = (LinearLayout) findViewById(R.id.main_container);
        View ad = findViewById(R.id.fragmentAd);
        container.removeView(ad);
    }

    Lifeograph.sLoginStatus = Lifeograph.LoginStatus.LOGGED_IN;
}

From source file:com.luorrak.ouroboros.reply.ReplyCommentFragment.java

private void addAttachmentPreview(final String filePath, View layout) {
    final LinearLayout view = (LinearLayout) layout.findViewById(R.id.post_comment_container);
    final View card = View.inflate(getActivity(), R.layout.card_reply_attachment, null);
    ImageView imagePreview = (ImageView) card.findViewById(R.id.reply_attachment_image);
    TextView filePathTextView = (TextView) card.findViewById(R.id.reply_attachment_path);
    ImageButton deleteAttachment = (ImageButton) card.findViewById(R.id.reply_delete_attachment);
    Ion.with(imagePreview).load(filePath).withBitmapInfo();
    filePathTextView.setText(filePath);/*from w  w w .  j ava  2  s  .  co  m*/
    deleteAttachment.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            reply.filePath.remove(filePath);
            view.removeView(card);
        }
    });
    view.addView(card);
}