Example usage for android.widget TextView setTextAppearance

List of usage examples for android.widget TextView setTextAppearance

Introduction

In this page you can find the example usage for android.widget TextView setTextAppearance.

Prototype

@Deprecated
public void setTextAppearance(Context context, @StyleRes int resId) 

Source Link

Document

Sets the text color, size, style, hint color, and highlight color from the specified TextAppearance resource.

Usage

From source file:com.ushahidi.android.ui.widget.SlidingTabLayout.java

private void populateTabStrip() {
    final PagerAdapter adapter = mViewPager.getAdapter();
    final View.OnClickListener tabClickListener = new TabClickListener();

    for (int i = 0; i < adapter.getCount(); i++) {
        View tabView = null;//from  w  w w.  j  a  v  a2  s .  c  o  m
        TextView tabTitleView = null;

        if (mTabViewLayoutId != 0) {
            // If there is a custom tab view layout id set, try and inflate it
            tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false);
            tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId);
        }

        if (tabView == null) {
            tabView = createDefaultTabView(getContext());
        }

        if (tabTitleView == null && TextView.class.isInstance(tabView)) {
            tabTitleView = (TextView) tabView;
        }

        if (mTabViewTextAppearance != 0) {
            tabTitleView.setTextAppearance(getContext(), mTabViewTextAppearance);
        }

        tabTitleView.setText(adapter.getPageTitle(i));
        tabView.setOnClickListener(tabClickListener);

        mTabStrip.addView(tabView);
    }
}

From source file:com.vonglasow.michael.satstat.RadioSectionFragment.java

protected void showCellGsm(CellTowerGsm cell) {
    TableRow row = new TableRow(rilCells.getContext());
    row.setWeightSum(29);/*from   w  w  w . j av  a2  s.co m*/

    TextView newType = new TextView(rilCells.getContext());
    newType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2));
    newType.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newType.setTextColor(
            rilCells.getContext().getResources().getColor(getColorFromGeneration(cell.getGeneration())));
    newType.setText(rilCells.getContext().getResources().getString(R.string.smallDot));
    row.addView(newType);

    TextView newMcc = new TextView(rilCells.getContext());
    newMcc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newMcc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newMcc.setText(formatCellData(rilCells.getContext(), "%03d", cell.getMcc()));
    row.addView(newMcc);

    TextView newMnc = new TextView(rilCells.getContext());
    newMnc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newMnc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newMnc.setText(formatCellData(rilCells.getContext(), "%02d", cell.getMnc()));
    row.addView(newMnc);

    TextView newLac = new TextView(rilCells.getContext());
    newLac.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 5));
    newLac.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newLac.setText(formatCellData(rilCells.getContext(), null, cell.getLac()));
    row.addView(newLac);

    TextView newCid = new TextView(rilCells.getContext());
    newCid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 9));
    newCid.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    if ((mainActivity.prefCid) && (cell.getCid() != CellTower.UNKNOWN) && (cell.getCid() > 0x0ffff)) {
        int rtcid = cell.getCid() / 0x10000;
        int cid = cell.getCid() % 0x10000;
        newCid.setText(String.format("%d-%d", rtcid, cid));
    } else
        newCid.setText(formatCellData(rilCells.getContext(), null, cell.getCid()));
    row.addView(newCid);

    TextView newPsc = new TextView(rilCells.getContext());
    newPsc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newPsc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newPsc.setText(formatCellData(rilCells.getContext(), null, cell.getPsc()));
    row.addView(newPsc);

    TextView newDbm = new TextView(rilCells.getContext());
    newDbm.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 4));
    newDbm.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium);
    newDbm.setText(formatCellDbm(rilCells.getContext(), null, cell.getDbm()));
    row.addView(newDbm);

    rilCells.addView(row, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}

From source file:com.vonglasow.michael.satstat.RadioSectionFragment.java

protected void showCellLte(CellTowerLte cell) {
    TableRow row = new TableRow(rilLteCells.getContext());
    row.setWeightSum(29);//  ww  w.  ja  v a2 s  . co m

    TextView newType = new TextView(rilLteCells.getContext());
    newType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2));
    newType.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newType.setTextColor(
            rilLteCells.getContext().getResources().getColor(getColorFromGeneration(cell.getGeneration())));
    newType.setText(rilLteCells.getContext().getResources().getString(R.string.smallDot));
    row.addView(newType);

    TextView newMcc = new TextView(rilLteCells.getContext());
    newMcc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newMcc.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newMcc.setText(formatCellData(rilLteCells.getContext(), "%03d", cell.getMcc()));
    row.addView(newMcc);

    TextView newMnc = new TextView(rilLteCells.getContext());
    newMnc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newMnc.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newMnc.setText(formatCellData(rilLteCells.getContext(), "%02d", cell.getMnc()));
    row.addView(newMnc);

    TextView newTac = new TextView(rilLteCells.getContext());
    newTac.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 5));
    newTac.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newTac.setText(formatCellData(rilLteCells.getContext(), null, cell.getTac()));
    row.addView(newTac);

    TextView newCi = new TextView(rilLteCells.getContext());
    newCi.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 9));
    newCi.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    if ((mainActivity.prefCid) && (cell.getCi() != CellTower.UNKNOWN)) {
        int eNodeBId = cell.getCi() / 0x100;
        int sectorId = cell.getCi() % 0x100;
        newCi.setText(String.format("%d-%d", eNodeBId, sectorId));
    } else
        newCi.setText(formatCellData(rilLteCells.getContext(), null, cell.getCi()));
    row.addView(newCi);

    TextView newPci = new TextView(rilLteCells.getContext());
    newPci.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3));
    newPci.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newPci.setText(formatCellData(rilLteCells.getContext(), null, cell.getPci()));
    row.addView(newPci);

    TextView newDbm = new TextView(rilLteCells.getContext());
    newDbm.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 4));
    newDbm.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium);
    newDbm.setText(formatCellDbm(rilLteCells.getContext(), null, cell.getDbm()));
    row.addView(newDbm);

    rilLteCells.addView(row,
            new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}

From source file:com.mycelium.wallet.activity.modern.RecordsFragment.java

private TextView createTitle(int stringResourceId) {
    TextView tv = new TextView(getActivity());
    tv.setLayoutParams(_titleLayoutParameters);
    tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
    tv.setText(stringResourceId);/*from   w  w w .j  a  v  a 2  s .c o  m*/
    tv.setGravity(Gravity.LEFT);

    tv.setTextAppearance(getActivity(), R.style.GenericText);
    // tv.setBackgroundColor(getResources().getColor(R.color.darkgrey));
    return tv;
}

From source file:com.bluros.updater.UpdatesSettings.java

private void showSysInfo() {
    // Build the message
    Date lastCheck = new Date(mPrefs.getLong(Constants.LAST_UPDATE_CHECK_PREF, 0));
    String date = DateFormat.getLongDateFormat(this).format(lastCheck);
    String time = DateFormat.getTimeFormat(this).format(lastCheck);

    String cmReleaseType = Constants.CM_RELEASETYPE_NIGHTLY;
    int updateType = Utils.getUpdateType();
    if (updateType == Constants.UPDATE_TYPE_SNAPSHOT) {
        cmReleaseType = Constants.CM_RELEASETYPE_SNAPSHOT;
    }/*w w  w . j a  v  a 2 s .co  m*/

    String message = getString(R.string.sysinfo_device) + " " + Utils.getDeviceType() + "\n\n"
            + getString(R.string.sysinfo_running) + " " + Utils.getInstalledVersion() + "\n\n"
            + getString(R.string.sysinfo_update_channel) + " " + cmReleaseType + "\n\n"
            + getString(R.string.sysinfo_last_check) + " " + date + " " + time;

    AlertDialog.Builder builder = new AlertDialog.Builder(this).setTitle(R.string.menu_system_info)
            .setMessage(message).setPositiveButton(R.string.dialog_ok, null);

    AlertDialog dialog = builder.create();
    dialog.show();

    TextView messageView = (TextView) dialog.findViewById(android.R.id.message);
    messageView.setTextAppearance(this, android.R.style.TextAppearance_DeviceDefault_Small);
}

From source file:com.slushpupie.deskclock.DeskClock.java

protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DIALOG_CHANGELOG:

        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        // Standard AlertDialog does not support HTML-style links.
        // So rebuild the ScrollView->TextView with the appropriate
        // settings and set the view directly.
        TextView tv = new TextView(this);
        tv.setPadding(5, 5, 5, 5);//from   ww w.  j av a  2  s.c  o m
        tv.setLinksClickable(true);
        tv.setMovementMethod(LinkMovementMethod.getInstance());
        tv.setText(R.string.changeLog);
        tv.setTextAppearance(this, android.R.style.TextAppearance_Medium);
        ScrollView sv = new ScrollView(this);
        sv.setPadding(14, 2, 10, 12);
        sv.addView(tv);
        builder.setView(sv).setCancelable(false).setTitle(R.string.changeLogTitle)
                .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(DeskClock.this);
                        SharedPreferences.Editor editor = prefs.edit();
                        editor.putBoolean("pref_changelog", false);
                        editor.putString("last_changelog", getString(R.string.app_version));
                        editor.commit();
                    }
                });
        return builder.create();
    default:
        return null;
    }
}

From source file:com.adarshahd.indianrailinfo.donate.TrainDetails.java

private void createTableLayoutTrainFare() {
    if (mPage.contains("SORRY")) {
        TextView textViewTrnDtls = new TextView(mActivity);
        textViewTrnDtls.setText("Not a valid class, Please select a different class and try again.");
        textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large);
        textViewTrnDtls.setPadding(10, 10, 10, 10);
        textViewTrnDtls.setTextColor(Color.RED);
        mFrameLayout.removeAllViews();//  w w  w .ja  v  a  2 s .co m
        mFrameLayout.addView(textViewTrnDtls);
        if (mDialog.isShowing()) {
            mDialog.cancel();
        }
        return;
    }
    if (mPage.contains("ISL Of")) {
        TextView textViewTrnDtls = new TextView(mActivity);
        textViewTrnDtls.setText("Station is not in ISL Of the Train. \nPlease modify the source/destination!");
        textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large);
        textViewTrnDtls.setPadding(10, 10, 10, 10);
        textViewTrnDtls.setTextColor(Color.RED);
        mFrameLayout.removeAllViews();
        mFrameLayout.addView(textViewTrnDtls);
        if (mDialog.isShowing()) {
            mDialog.cancel();
        }
        return;
    }

    if (mPage.contains("ERROR")) {
        TextView textViewTrnDtls = new TextView(mActivity);
        textViewTrnDtls.setText("Your request resulted in an error.\nPlease check!");
        textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large);
        textViewTrnDtls.setPadding(10, 10, 10, 10);
        textViewTrnDtls.setTextColor(Color.RED);
        mFrameLayout.removeAllViews();
        mFrameLayout.addView(textViewTrnDtls);
        if (mDialog.isShowing()) {
            mDialog.cancel();
        }
        return;
    }

    if (mPage.contains("Network Connectivity")) {
        TextView textViewTrnDtls = new TextView(mActivity);
        textViewTrnDtls.setText("Looks like the server is busy.\nPlease try later!");
        textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large);
        textViewTrnDtls.setPadding(10, 10, 10, 10);
        textViewTrnDtls.setTextColor(Color.RED);
        mFrameLayout.removeAllViews();
        mFrameLayout.addView(textViewTrnDtls);
        if (mDialog.isShowing()) {
            mDialog.cancel();
        }
        return;
    }

    if (mPage.contains("unavailable")) {
        TextView textViewTrnDtls = new TextView(mActivity);
        textViewTrnDtls.setText(
                "Response from server:\n\nYour request could not be processed now. \nPlease try again later!");
        textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large);
        textViewTrnDtls.setPadding(10, 10, 10, 10);
        textViewTrnDtls.setTextColor(Color.RED);
        mFrameLayout.removeAllViews();
        mFrameLayout.addView(textViewTrnDtls);
        if (mDialog.isShowing()) {
            mDialog.cancel();
        }
        return;
    }

    if (mDetails == null || !mDetails.getTrainNumber().equals(mTrainNumber)) {
        Iterator iterator = null;
        try {
            iterator = mElements.first().parent().parent().parent().getElementsByTag("tr").iterator();
        } catch (Exception e) {
            Log.i("TrainDetails", mPage);
        }
        mListFr = new ArrayList<List<String>>();
        List<String> list;
        Element tmp;
        while (iterator.hasNext()) {
            tmp = (Element) iterator.next();
            list = new ArrayList<String>();
            list.add(tmp.select("td").get(0).text());
            list.add(tmp.select("td").get(1).text());
            mListFr.add(list);
        }
        mDetails = new Details(mListFr, TrainEnquiry.FARE, mTrainNumber);
    } else {
        mListFr = mDetails.getList();
    }
    mTblLayoutFr = new TableLayout(mActivity);
    TableRow row;
    TextView tv1, tv2;
    mTblLayoutFr.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    for (int i = 0; i < mListFr.size(); i++) {
        row = new TableRow(mActivity);
        tv1 = new TextView(mActivity);
        tv2 = new TextView(mActivity);

        tv1.setText("   " + mListFr.get(i).get(0));
        tv2.setText("   " + mListFr.get(i).get(1));

        tv1.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Medium);
        tv2.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Medium);

        tv1.setPadding(5, 5, 5, 5);
        tv2.setPadding(5, 5, 5, 5);

        /*tv2.setBackgroundResource(R.drawable.card_divider);
        tv3.setBackgroundResource(R.drawable.card_divider);
        tv4.setBackgroundResource(R.drawable.card_divider);*/

        row.addView(tv1);
        row.addView(tv2);

        row.setBackgroundResource(R.drawable.button_selector);
        row.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
        mTblLayoutFr.addView(row);
    }
    LinearLayout ll = new LinearLayout(mActivity);
    ScrollView scrollView = new ScrollView(mActivity);
    TextView textViewTrnDtls = new TextView(mActivity);
    textViewTrnDtls.setText("Fare details:");
    textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large);
    textViewTrnDtls.setPadding(10, 10, 10, 10);
    ll.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    ll.setOrientation(LinearLayout.VERTICAL);
    ll.addView(textViewTrnDtls);
    ll.addView(mTblLayoutFr);
    scrollView.addView(ll);
    mFrameLayout.removeAllViews();
    mFrameLayout.addView(scrollView);
    if (mDialog.isShowing()) {
        mDialog.cancel();
    }
}

From source file:uk.co.ashtonbrsc.intentexplode.Explode.java

private void addTextToLayout(String text, int typeface, int paddingLeft, LinearLayout layout) {
    TextView textView = new TextView(this);
    ParagraphStyle style_para = new LeadingMarginSpan.Standard(0,
            (int) (STANDARD_INDENT_SIZE_IN_DIP * density));
    SpannableString styledText = new SpannableString(text);
    styledText.setSpan(style_para, 0, styledText.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
    textView.setText(styledText);//from w  ww.  j  ava2s . c om
    textView.setTextAppearance(this, R.style.TextFlags);
    textView.setTypeface(null, typeface);
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    params.setMargins((int) (paddingLeft * density), 0, 0, 0);
    layout.addView(textView, params);
}

From source file:tw.org.tsos.bsrs.view.SlidingTabLayout.java

private void populateTabStrip() {
    removeOldSelection();/*from w w  w  . j av a 2  s . c om*/
    oldSelection = null;
    final PagerAdapter adapter = mViewPager.getAdapter();
    final View.OnClickListener tabClickListener = new TabClickListener();

    for (int i = 0; i < adapter.getCount(); i++) {
        View tabView = null;
        TextView tabTitleView = null;

        if (mTabViewLayoutId != 0) {
            // If there is a custom tab view layout id set, try and inflate it
            tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, false);
            tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId);
        }

        if (tabView == null) {
            tabView = createDefaultTabView(getContext());
        }

        if (tabTitleView == null && TextView.class.isInstance(tabView)) {
            tabTitleView = (TextView) tabView;
        }

        if (tabTitleView != null) {
            tabTitleView.setText(adapter.getPageTitle(i));
            tabTitleView.setTextAppearance(getContext(), android.R.style.TextAppearance_Large);
            tabTitleView.setTextColor(getResources().getColorStateList(R.color.tab_text_color));
        }
        tabView.setOnClickListener(tabClickListener);

        mTabStrip.addView(tabView);
    }
}

From source file:com.adarshahd.indianrailinfo.donate.TrainDetails.java

private void createTableLayoutTrainAvailability() {

    if (mPage.contains("SORRY")) {
        TextView textViewTrnDtls = new TextView(mActivity);
        textViewTrnDtls.setText("Not a valid class, Please select a different class and try again.");
        textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large);
        textViewTrnDtls.setPadding(10, 10, 10, 10);
        textViewTrnDtls.setTextColor(Color.RED);
        mFrameLayout.removeAllViews();//from  w  w  w  .j  av  a  2 s. co  m
        mFrameLayout.addView(textViewTrnDtls);
        if (mDialog.isShowing()) {
            mDialog.cancel();
        }
        return;
    }

    if (mPage.contains("ISL Of")) {
        TextView textViewTrnDtls = new TextView(mActivity);
        textViewTrnDtls.setText("Station is not in ISL Of the Train. \nPlease modify the source/destination!");
        textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large);
        textViewTrnDtls.setPadding(10, 10, 10, 10);
        textViewTrnDtls.setTextColor(Color.RED);
        mFrameLayout.removeAllViews();
        mFrameLayout.addView(textViewTrnDtls);
        if (mDialog.isShowing()) {
            mDialog.cancel();
        }
        return;
    }

    if (mPage.contains("ERROR")) {
        TextView textViewTrnDtls = new TextView(mActivity);
        textViewTrnDtls.setText("Your request resulted in an error.\nPlease check!");
        textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large);
        textViewTrnDtls.setPadding(10, 10, 10, 10);
        textViewTrnDtls.setTextColor(Color.RED);
        mFrameLayout.removeAllViews();
        mFrameLayout.addView(textViewTrnDtls);
        if (mDialog.isShowing()) {
            mDialog.cancel();
        }
        return;
    }

    if (mPage.contains("Network Connectivity")) {
        TextView textViewTrnDtls = new TextView(mActivity);
        textViewTrnDtls.setText("Looks like the server is busy.\nPlease try later!");
        textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large);
        textViewTrnDtls.setPadding(10, 10, 10, 10);
        textViewTrnDtls.setTextColor(Color.RED);
        mFrameLayout.removeAllViews();
        mFrameLayout.addView(textViewTrnDtls);
        if (mDialog.isShowing()) {
            mDialog.cancel();
        }
        return;
    }

    if (mPage.contains("unavailable")) {
        TextView textViewTrnDtls = new TextView(mActivity);
        textViewTrnDtls.setText(
                "Response from server:\n\nYour request could not be processed now.\nPlease try again later!");
        textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large);
        textViewTrnDtls.setPadding(10, 10, 10, 10);
        textViewTrnDtls.setTextColor(Color.RED);
        mFrameLayout.removeAllViews();
        mFrameLayout.addView(textViewTrnDtls);
        if (mDialog.isShowing()) {
            mDialog.cancel();
        }
        return;
    }

    if (mDetails == null || !mDetails.getTrainNumber().equals(mTrainNumber)) {
        Iterator iterator = null;
        try {
            iterator = mElements.first().parent().parent().parent().getElementsByTag("tr").iterator();
        } catch (Exception e) {
            Log.i("TrainDetails", mPage);
            e.printStackTrace();
            return;
        }
        mListAv = new ArrayList<List<String>>();
        List<String> list;
        Element tmp;
        tmp = (Element) iterator.next();
        list = new ArrayList<String>();
        list.add(tmp.select("th").get(0).text());
        list.add("Date");
        list.add(tmp.select("th").get(2).text());
        //list.add(tmp.select("th").get(3).text());
        mListAv.add(list);
        while (iterator.hasNext()) {
            tmp = (Element) iterator.next();
            if (!tmp.hasText()) {
                continue;
            }
            list = new ArrayList<String>();
            list.add(tmp.select("td").get(0).text());
            list.add(tmp.select("td").get(1).text());
            list.add(tmp.select("td").get(2).text());
            //list.add(tmp.select("td").get(3).text());
            mListAv.add(list);
        }
        mDetails = new Details(mListAv, TrainEnquiry.AVAILABILITY, mTrainNumber);
    } else {
        mListAv = mDetails.getList();
    }
    mTblLayoutAv = new TableLayout(mActivity);
    TableRow row;
    TextView tv1, tv2, tv3;
    mTblLayoutAv.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    for (int i = 0; i < mListAv.size(); i++) {
        row = new TableRow(mActivity);
        tv1 = new TextView(mActivity);
        tv2 = new TextView(mActivity);
        tv3 = new TextView(mActivity);
        //tv4 = new TextView(mActivity);

        tv1.setText("   " + mListAv.get(i).get(0));
        tv2.setText("   " + mListAv.get(i).get(1));
        tv3.setText("   " + mListAv.get(i).get(2));
        //tv4.setText("   " + mListAv.get(i).get(3));

        tv1.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Medium);
        tv2.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Medium);
        tv3.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Medium);
        //tv4.setTextAppearance(mActivity,android.R.style.TextAppearance_DeviceDefault_Medium);

        tv1.setPadding(5, 5, 5, 5);
        tv2.setPadding(5, 5, 5, 5);
        tv3.setPadding(5, 5, 5, 5);
        //tv4.setPadding(5,5,5,5);

        /*tv2.setBackgroundResource(R.drawable.card_divider);
        tv3.setBackgroundResource(R.drawable.card_divider);
        tv4.setBackgroundResource(R.drawable.card_divider);*/

        row.addView(tv1);
        row.addView(tv2);
        row.addView(tv3);
        //row.addView(tv4);

        row.setBackgroundResource(R.drawable.button_selector);
        row.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
        row.setOnClickListener(this);
        mTblLayoutAv.addView(row);
    }
    LinearLayout ll = new LinearLayout(mActivity);
    ScrollView scrollView = new ScrollView(mActivity);
    TextView textViewTrnDtls = new TextView(mActivity);
    textViewTrnDtls.setText("Availability details:");
    textViewTrnDtls.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Large);
    textViewTrnDtls.setPadding(10, 10, 10, 10);
    ll.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    ll.setOrientation(LinearLayout.VERTICAL);
    ll.addView(textViewTrnDtls);
    ll.addView(mTblLayoutAv);
    scrollView.addView(ll);
    mFrameLayout.removeAllViews();
    mFrameLayout.addView(scrollView);
    if (mDialog.isShowing()) {
        mDialog.cancel();
    }
}