Example usage for android.view Window FEATURE_NO_TITLE

List of usage examples for android.view Window FEATURE_NO_TITLE

Introduction

In this page you can find the example usage for android.view Window FEATURE_NO_TITLE.

Prototype

int FEATURE_NO_TITLE

To view the source code for android.view Window FEATURE_NO_TITLE.

Click Source Link

Document

Flag for the "no title" feature, turning off the title at the top of the screen.

Usage

From source file:android.support.v7ox.app.AppCompatDelegateImplV7.java

private ViewGroup createSubDecor() {
    TypedArray a = mContext.obtainStyledAttributes(R.styleable.AppCompatTheme);

    if (!a.hasValue(R.styleable.AppCompatTheme_windowActionBar_ox)) {
        a.recycle();/*  w ww .j a v  a  2 s  . c  om*/
        throw new IllegalStateException(
                "You need to use a Theme.AppCompat theme (or descendant) with this activity.");
    }

    if (a.getBoolean(R.styleable.AppCompatTheme_windowNoTitle_ox, false)) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
    } else if (a.getBoolean(R.styleable.AppCompatTheme_windowActionBar_ox, false)) {
        // Don't allow an action bar if there is no title.
        requestWindowFeature(FEATURE_SUPPORT_ACTION_BAR);
    }
    if (a.getBoolean(R.styleable.AppCompatTheme_windowActionBarOverlay_ox, false)) {
        requestWindowFeature(FEATURE_SUPPORT_ACTION_BAR_OVERLAY);
    }
    if (a.getBoolean(R.styleable.AppCompatTheme_windowActionModeOverlay_ox, false)) {
        requestWindowFeature(FEATURE_ACTION_MODE_OVERLAY);
    }
    mIsFloating = a.getBoolean(R.styleable.AppCompatTheme_android_windowIsFloating, false);
    a.recycle();

    final LayoutInflater inflater = LayoutInflater.from(mContext);
    ViewGroup subDecor = null;

    if (!mWindowNoTitle) {
        if (mIsFloating) {
            // If we're floating, inflate the dialog title decor
            subDecor = (ViewGroup) inflater.inflate(R.layout.abc_dialog_title_material, null);

            // Floating windows can never have an action bar, reset the flags
            mHasActionBar = mOverlayActionBar = false;
        } else if (mHasActionBar) {
            /**
             * This needs some explanation. As we can not use the android:theme attribute
             * pre-L, we emulate it by manually creating a LayoutInflater using a
             * ContextThemeWrapper pointing to actionBarTheme.
             */
            TypedValue outValue = new TypedValue();
            mContext.getTheme().resolveAttribute(R.attr.actionBarTheme_ox, outValue, true);

            Context themedContext;
            if (outValue.resourceId != 0) {
                themedContext = new ContextThemeWrapper(mContext, outValue.resourceId);
            } else {
                themedContext = mContext;
            }

            // Now inflate the view using the themed context and set it as the content view
            subDecor = (ViewGroup) LayoutInflater.from(themedContext).inflate(R.layout.abc_screen_toolbar,
                    null);

            mDecorContentParent = (DecorContentParent) subDecor.findViewById(R.id.decor_content_parent);
            mDecorContentParent.setWindowCallback(getWindowCallback());

            /**
             * Propagate features to DecorContentParent
             */
            if (mOverlayActionBar) {
                mDecorContentParent.initFeature(FEATURE_SUPPORT_ACTION_BAR_OVERLAY);
            }
            if (mFeatureProgress) {
                mDecorContentParent.initFeature(Window.FEATURE_PROGRESS);
            }
            if (mFeatureIndeterminateProgress) {
                mDecorContentParent.initFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
            }
        }
    } else {
        if (mOverlayActionMode) {
            subDecor = (ViewGroup) inflater.inflate(R.layout.abc_screen_simple_overlay_action_mode, null);
        } else {
            subDecor = (ViewGroup) inflater.inflate(R.layout.abc_screen_simple, null);
        }

        if (Build.VERSION.SDK_INT >= 21) {
            // If we're running on L or above, we can rely on ViewCompat's
            // setOnApplyWindowInsetsListener
            ViewCompat.setOnApplyWindowInsetsListener(subDecor, new OnApplyWindowInsetsListener() {
                @Override
                public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) {
                    final int top = insets.getSystemWindowInsetTop();
                    final int newTop = updateStatusGuard(top);

                    if (top != newTop) {
                        insets = insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), newTop,
                                insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom());
                    }

                    // Now apply the insets on our view
                    return ViewCompat.onApplyWindowInsets(v, insets);
                }
            });
        } else {
            // Else, we need to use our own FitWindowsViewGroup handling
            ((FitWindowsViewGroup) subDecor)
                    .setOnFitSystemWindowsListener(new FitWindowsViewGroup.OnFitSystemWindowsListener() {
                        @Override
                        public void onFitSystemWindows(Rect insets) {
                            insets.top = updateStatusGuard(insets.top);
                        }
                    });
        }
    }

    if (subDecor == null) {
        throw new IllegalArgumentException("AppCompat does not support the current theme features: { "
                + "windowActionBar: " + mHasActionBar + ", windowActionBarOverlay: " + mOverlayActionBar
                + ", android:windowIsFloating: " + mIsFloating + ", windowActionModeOverlay: "
                + mOverlayActionMode + ", windowNoTitle: " + mWindowNoTitle + " }");
    }

    if (mDecorContentParent == null) {
        mTitleView = (TextView) subDecor.findViewById(R.id.title);
    }

    // Make the decor optionally fit system windows, like the window's decor
    ViewUtils.makeOptionalFitsSystemWindows(subDecor);

    final ViewGroup decorContent = (ViewGroup) mWindow.findViewById(android.R.id.content);
    final ContentFrameLayout abcContent = (ContentFrameLayout) subDecor
            .findViewById(R.id.action_bar_activity_content);

    // There might be Views already added to the Window's content view so we need to
    // migrate them to our content view
    while (decorContent.getChildCount() > 0) {
        final View child = decorContent.getChildAt(0);
        decorContent.removeViewAt(0);
        abcContent.addView(child);
    }

    // Now set the Window's content view with the decor
    mWindow.setContentView(subDecor);

    // Change our content FrameLayout to use the android.R.id.content id.
    // Useful for fragments.
    decorContent.setId(View.NO_ID);
    abcContent.setId(android.R.id.content);

    // The decorContent may have a foreground drawable set (windowContentOverlay).
    // Remove this as we handle it ourselves
    if (decorContent instanceof FrameLayout) {
        decorContent.setForeground(null);
    }

    abcContent.setAttachListener(new ContentFrameLayout.OnAttachListener() {
        @Override
        public void onAttachedFromWindow() {
        }

        @Override
        public void onDetachedFromWindow() {
            dismissPopups();
        }
    });

    return subDecor;
}

From source file:com.drextended.actionhandler.action.CompositeAction.java

/**
 * Show menu with list of actions, which can handle this {@param model}.
 *
 * @param context    The Context, which generally get from view by {@link View#getContext()}
 * @param view       The View, which can be used for prepare any visual effect (like animation),
 *                   Generally it is that view which was clicked and initiated action to fire.
 * @param actionType The action type/*www  .  j  a  v a 2 s  . c om*/
 * @param model      The model which should be handled by the action.
 */
private void showMenu(final Context context, final View view, String actionType, final M model) {

    // prepare menu items
    final List<ActionItem> menuItems = prepareMenuListItems(model);

    if (mShowAsPopupMenuEnabled) {
        //show as popup menu
        PopupMenu popupMenu = buildPopupMenu(context, view, actionType, model, menuItems);
        popupMenu.show();

    } else {
        //show as alert dialog with single choice items
        String title = mTitleProvider.getTitle(context, model);
        AlertDialog.Builder builder = buildAlertDialog(context, view, actionType, model, title, menuItems);
        final AlertDialog dialog = builder.create();
        if (mShowNonAcceptedActions) {
            final AdapterView.OnItemClickListener clickListener = dialog.getListView().getOnItemClickListener();
            if (clickListener != null) {
                dialog.getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        if (menuItems.get(position).action.isModelAccepted(model)) {
                            clickListener.onItemClick(parent, view, position, id);
                        }
                    }
                });
            }
        }
        if (title == null) {
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        }
        dialog.show();
    }
}

From source file:com.borax12.materialdaterangepicker.date.DatePickerDialog.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    View view = inflater.inflate(R.layout.range_date_picker_dialog, container, false);

    tabHost = (TabHost) view.findViewById(R.id.tabHost);
    tabHost.findViewById(R.id.tabHost);//from w  w w .j  av  a  2  s  . c o  m
    tabHost.setup();

    final Activity activity = getActivity();

    TabHost.TabSpec startDatePage = tabHost.newTabSpec("start");
    startDatePage.setContent(R.id.start_date_group);
    startDatePage.setIndicator((startTitle != null && !startTitle.isEmpty()) ? startTitle
            : activity.getResources().getString(R.string.mdtrp_from));

    TabHost.TabSpec endDatePage = tabHost.newTabSpec("end");
    endDatePage.setContent(R.id.end_date_group);
    endDatePage.setIndicator((endTitle != null && !endTitle.isEmpty()) ? endTitle
            : activity.getResources().getString(R.string.mdtrp_to));

    tabHost.addTab(startDatePage);
    tabHost.addTab(endDatePage);

    mDayOfWeekView = (TextView) view.findViewById(R.id.date_picker_header);
    mMonthAndDayView = (LinearLayout) view.findViewById(R.id.date_picker_month_and_day);
    mMonthAndDayViewEnd = (LinearLayout) view.findViewById(R.id.date_picker_month_and_day_end);
    mMonthAndDayView.setOnClickListener(this);
    mMonthAndDayViewEnd.setOnClickListener(this);

    mSelectedMonthTextView = (TextView) view.findViewById(R.id.date_picker_month);
    mSelectedMonthTextViewEnd = (TextView) view.findViewById(R.id.date_picker_month_end);

    mSelectedDayTextView = (TextView) view.findViewById(R.id.date_picker_day);
    mSelectedDayTextViewEnd = (TextView) view.findViewById(R.id.date_picker_day_end);

    mYearView = (TextView) view.findViewById(R.id.date_picker_year);
    mYearViewEnd = (TextView) view.findViewById(R.id.date_picker_year_end);
    mYearView.setOnClickListener(this);
    mYearViewEnd.setOnClickListener(this);

    int listPosition = -1;
    int listPositionOffset = 0;
    int listPositionEnd = -1;
    int listPositionOffsetEnd = 0;
    int currentView = MONTH_AND_DAY_VIEW;
    int currentViewEnd = MONTH_AND_DAY_VIEW;
    if (savedInstanceState != null) {
        mWeekStart = savedInstanceState.getInt(KEY_WEEK_START);
        mWeekStartEnd = savedInstanceState.getInt(KEY_WEEK_START_END);
        mMinYear = savedInstanceState.getInt(KEY_YEAR_START);
        mMaxYear = savedInstanceState.getInt(KEY_MAX_YEAR);
        currentView = savedInstanceState.getInt(KEY_CURRENT_VIEW);
        currentViewEnd = savedInstanceState.getInt(KEY_CURRENT_VIEW_END);
        listPosition = savedInstanceState.getInt(KEY_LIST_POSITION);
        listPositionOffset = savedInstanceState.getInt(KEY_LIST_POSITION_OFFSET);
        listPositionEnd = savedInstanceState.getInt(KEY_LIST_POSITION_END);
        listPositionOffsetEnd = savedInstanceState.getInt(KEY_LIST_POSITION_OFFSET_END);
        mMinDate = (Calendar) savedInstanceState.getSerializable(KEY_MIN_DATE);
        mMaxDate = (Calendar) savedInstanceState.getSerializable(KEY_MAX_DATE);
        mMinDateEnd = (Calendar) savedInstanceState.getSerializable(KEY_MIN_DATE_END);
        mMaxDateEnd = (Calendar) savedInstanceState.getSerializable(KEY_MAX_DATE_END);
        highlightedDays = (Calendar[]) savedInstanceState.getSerializable(KEY_HIGHLIGHTED_DAYS);
        selectableDays = (Calendar[]) savedInstanceState.getSerializable(KEY_SELECTABLE_DAYS);
        highlightedDaysEnd = (Calendar[]) savedInstanceState.getSerializable(KEY_HIGHLIGHTED_DAYS_END);
        selectableDaysEnd = (Calendar[]) savedInstanceState.getSerializable(KEY_SELECTABLE_DAYS_END);
        mThemeDark = savedInstanceState.getBoolean(KEY_THEME_DARK);
        mAccentColor = savedInstanceState.getInt(KEY_ACCENT);
        mVibrate = savedInstanceState.getBoolean(KEY_VIBRATE);
        mDismissOnPause = savedInstanceState.getBoolean(KEY_DISMISS);
    }

    mDayPickerView = new com.borax12.materialdaterangepicker.date.SimpleDayPickerView(activity, this);
    mYearPickerView = new com.borax12.materialdaterangepicker.date.YearPickerView(activity, this);
    mDayPickerViewEnd = new com.borax12.materialdaterangepicker.date.SimpleDayPickerView(activity, this);
    mYearPickerViewEnd = new com.borax12.materialdaterangepicker.date.YearPickerView(activity, this);

    Resources res = getResources();
    mDayPickerDescription = res.getString(R.string.mdtrp_day_picker_description);
    mSelectDay = res.getString(R.string.mdtrp_select_day);
    mYearPickerDescription = res.getString(R.string.mdtrp_year_picker_description);
    mSelectYear = res.getString(R.string.mdtrp_select_year);

    int bgColorResource = mThemeDark ? R.color.mdtrp_date_picker_view_animator_dark_theme
            : R.color.mdtrp_date_picker_view_animator;
    view.setBackgroundColor(ContextCompat.getColor(activity, bgColorResource));

    mAnimator = (com.borax12.materialdaterangepicker.date.AccessibleDateAnimator) view
            .findViewById(R.id.animator);
    mAnimatorEnd = (com.borax12.materialdaterangepicker.date.AccessibleDateAnimator) view
            .findViewById(R.id.animator_end);

    mAnimator.addView(mDayPickerView);
    mAnimator.addView(mYearPickerView);
    mAnimator.setDateMillis(mCalendar.getTimeInMillis());
    // TODO: Replace with animation decided upon by the design team.
    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(ANIMATION_DURATION);
    mAnimator.setInAnimation(animation);
    // TODO: Replace with animation decided upon by the design team.
    Animation animation2 = new AlphaAnimation(1.0f, 0.0f);
    animation2.setDuration(ANIMATION_DURATION);
    mAnimator.setOutAnimation(animation2);

    mAnimatorEnd.addView(mDayPickerViewEnd);
    mAnimatorEnd.addView(mYearPickerViewEnd);
    mAnimatorEnd.setDateMillis(mCalendarEnd.getTimeInMillis());
    // TODO: Replace with animation decided upon by the design team.
    Animation animationEnd = new AlphaAnimation(0.0f, 1.0f);
    animationEnd.setDuration(ANIMATION_DURATION);
    mAnimatorEnd.setInAnimation(animation);
    // TODO: Replace with animation decided upon by the design team.
    Animation animation2End = new AlphaAnimation(1.0f, 0.0f);
    animation2End.setDuration(ANIMATION_DURATION);
    mAnimatorEnd.setOutAnimation(animation2);

    Button okButton = (Button) view.findViewById(R.id.ok);
    okButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            tryVibrate();
            if (mCallBack != null) {
                mCallBack.onDateSet(DatePickerDialog.this, mCalendar.get(Calendar.YEAR),
                        mCalendar.get(Calendar.MONTH), mCalendar.get(Calendar.DAY_OF_MONTH),
                        mCalendarEnd.get(Calendar.YEAR), mCalendarEnd.get(Calendar.MONTH),
                        mCalendarEnd.get(Calendar.DAY_OF_MONTH));
            }
            dismiss();
        }
    });
    okButton.setTypeface(TypefaceHelper.get(activity, "Roboto-Medium"));

    Button cancelButton = (Button) view.findViewById(R.id.cancel);
    cancelButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            tryVibrate();
            if (getDialog() != null)
                getDialog().cancel();
        }
    });
    cancelButton.setTypeface(TypefaceHelper.get(activity, "Roboto-Medium"));
    cancelButton.setVisibility(isCancelable() ? View.VISIBLE : View.GONE);

    //If an accent color has not been set manually, try and get it from the context
    if (mAccentColor == -1) {
        int accentColor = Utils.getAccentColorFromThemeIfAvailable(getActivity());
        if (accentColor != -1) {
            mAccentColor = accentColor;
        }
    }
    if (mAccentColor != -1) {
        if (mDayOfWeekView != null)
            mDayOfWeekView.setBackgroundColor(Utils.darkenColor(mAccentColor));
        view.findViewById(R.id.day_picker_selected_date_layout).setBackgroundColor(mAccentColor);
        view.findViewById(R.id.day_picker_selected_date_layout_end).setBackgroundColor(mAccentColor);
        okButton.setTextColor(mAccentColor);
        cancelButton.setTextColor(mAccentColor);
        mYearPickerView.setAccentColor(mAccentColor);
        mDayPickerView.setAccentColor(mAccentColor);
        mYearPickerViewEnd.setAccentColor(mAccentColor);
        mDayPickerViewEnd.setAccentColor(mAccentColor);
    }

    updateDisplay(false);
    setCurrentView(currentView);

    if (listPosition != -1) {
        if (currentView == MONTH_AND_DAY_VIEW) {
            mDayPickerView.postSetSelection(listPosition);
        } else if (currentView == YEAR_VIEW) {
            mYearPickerView.postSetSelectionFromTop(listPosition, listPositionOffset);
        }
    }

    if (listPositionEnd != -1) {
        if (currentViewEnd == MONTH_AND_DAY_VIEW) {
            mDayPickerViewEnd.postSetSelection(listPositionEnd);
        } else if (currentViewEnd == YEAR_VIEW) {
            mYearPickerViewEnd.postSetSelectionFromTop(listPositionEnd, listPositionOffsetEnd);
        }
    }

    mHapticFeedbackController = new HapticFeedbackController(activity);

    tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            com.borax12.materialdaterangepicker.date.MonthAdapter.CalendarDay calendarDay;
            if (tabId.equals("start")) {
                calendarDay = new com.borax12.materialdaterangepicker.date.MonthAdapter.CalendarDay(
                        mCalendar.getTimeInMillis());
                mDayPickerView.goTo(calendarDay, true, true, false);
            } else {
                calendarDay = new com.borax12.materialdaterangepicker.date.MonthAdapter.CalendarDay(
                        mCalendarEnd.getTimeInMillis());
                mDayPickerViewEnd.goTo(calendarDay, true, true, false);

            }
        }
    });
    return view;
}

From source file:system.info.reader.java

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

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    //getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    DisplayMetrics dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(dm);
    resolutions = Properties.resolution(dm);
    Properties.resolution = resolutions[0] + "*" + resolutions[1];
    int tabHeight = 30, tabWidth = 80;
    if (dm.widthPixels >= 480) {
        tabHeight = 40;/*from  ww w .  j  a  v  a2s .  com*/
        tabWidth = 120;
    }

    tabHost = getTabHost();
    LayoutInflater.from(this).inflate(R.layout.main, tabHost.getTabContentView(), true);
    tabHost.addTab(
            tabHost.newTabSpec("tab1").setIndicator(getString(R.string.brief)).setContent(R.id.PropertyList));
    tabHost.addTab(
            tabHost.newTabSpec("tab2").setIndicator(getString(R.string.online)).setContent(R.id.ViewServer));
    tabHost.addTab(
            tabHost.newTabSpec("tab3").setIndicator(getString(R.string.apps)).setContent(R.id.sViewApps));
    tabHost.addTab(
            tabHost.newTabSpec("tab4").setIndicator(getString(R.string.process)).setContent(R.id.sViewProcess));
    tabHost.addTab(tabHost.newTabSpec("tab5").setIndicator("Services").setContent(R.id.sViewCpu));
    tabHost.addTab(tabHost.newTabSpec("tab6").setIndicator("Tasks").setContent(R.id.sViewMem));
    //tabHost.addTab(tabHost.newTabSpec("tab7")
    //        .setIndicator("Vending")
    //        .setContent(R.id.sViewDisk));
    AppsText = (TextView) findViewById(R.id.TextViewApps);
    ProcessText = (TextView) findViewById(R.id.TextViewProcess);
    ServiceText = (TextView) findViewById(R.id.TextViewCpu);
    TaskText = (TextView) findViewById(R.id.TextViewMem);

    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(tabWidth, tabHeight);
    for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++)
        tabHost.getTabWidget().getChildAt(i).setLayoutParams(lp);

    properList = (ListView) findViewById(R.id.PropertyList);
    Properties.properListItem = new ArrayList<HashMap<String, Object>>();
    properListItemAdapter = new SimpleAdapter(this, Properties.properListItem, R.layout.property_list,
            new String[] { "ItemTitle", "ItemText" }, new int[] { R.id.ItemTitle, R.id.ItemText });
    properList.setAdapter(properListItemAdapter);
    properList.setOnItemClickListener(mpropertyCL);

    //will support app list later
    //appList = (ListView)findViewById(R.id.AppList);
    //Properties.appListItem = new ArrayList<HashMap<String, Object>>();  
    //SimpleAdapter appListItemAdapter = new SimpleAdapter(this, Properties.appListItem,   
    //             R.layout.app_list,  
    //             new String[] {"ItemTitle", "ItemText"},   
    //             new int[] {R.id.ItemTitle, R.id.ItemText}  
    //         );  
    //appList.setAdapter(appListItemAdapter);

    serverWeb = (WebView) findViewById(R.id.ViewServer);
    WebSettings webSettings = serverWeb.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setUserAgentString("sys.info.trial" + versionCode);
    webSettings.setTextSize(WebSettings.TextSize.SMALLER);
    serverWeb.setWebViewClient(new WebViewClient() {
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return false;//this will not launch browser when redirect.
        }

        public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
            handler.proceed();
        }
    });

    PackageManager pm = getPackageManager();
    try {
        PackageInfo pi = pm.getPackageInfo("sys.info.trial", 0);
        version = "v" + pi.versionName;
        versionCode = pi.versionCode;

        List<PackageInfo> apps = getPackageManager().getInstalledPackages(0);
        nApk = Integer.toString(apps.size());
        apklist = "";
        for (PackageInfo app : apps) {
            apklist += app.packageName + "\t(" + app.versionName + ")\n";
        }
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }

    showDialog(0);
    initPropList();
    //refresh();
    PageTask task = new PageTask();
    task.execute("");
}

From source file:com.corporatetaxi.TaxiArrived_Acitivity.java

private void initiatePopupWindowsendmesage() {
    try {// www . j a v  a  2s.com
        dialog = new Dialog(TaxiArrived_Acitivity.this);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // before
        dialog.setContentView(R.layout.sendmesssage_popup);

        Button mbtn_sendmesssage = (Button) dialog.findViewById(R.id.btn_acceptor);
        Button mbtn_cancel = (Button) dialog.findViewById(R.id.btn_cancel);
        rd1 = (RadioButton) dialog.findViewById(R.id.radioButton1);
        rd2 = (RadioButton) dialog.findViewById(R.id.radioButton2);
        rd3 = (RadioButton) dialog.findViewById(R.id.radioButton3);
        mcross = (ImageButton) dialog.findViewById(R.id.cross);
        txt_header = (TextView) dialog.findViewById(R.id.popup_text);
        mcross.setOnClickListener(cancle_btn_click_listener);
        mbtn_cancel.setOnClickListener(cancle_btn_click_listener);
        Typeface tf = Typeface.createFromAsset(this.getAssets(), "Montserrat-Regular.ttf");
        rd1.setTypeface(tf);
        rd2.setTypeface(tf);
        rd3.setTypeface(tf);
        mbtn_sendmesssage.setTypeface(tf);
        txt_header.setTypeface(tf);
        mbtn_cancel.setTypeface(tf);
        mbtn_sendmesssage.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub

                if (rd1.isChecked()) {
                    sendmessage = getResources().getString(R.string.prompt_message_one);

                } else if (rd2.isChecked()) {
                    sendmessage = getResources().getString(R.string.prompt_message_two);

                } else if (rd3.isChecked()) {
                    sendmessage = getResources().getString(R.string.prompt_message_three);

                }

                Allbeans allbeans = new Allbeans();

                allbeans.setSendmessage(sendmessage);

                new SendmessageAsynch(allbeans).execute();

            }
        });
        dialog.show();

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.example.mydemos.view.RingtonePickerActivity.java

private void setViewPager() {
    // need cancel these feature in onCreate
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    final ActionBar bar = getActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    mViewPager = (ViewPager) findViewById(R.id.pager);
    //using TabsPageAdapter
    mTabsAdapter = new TabsPageAdapter(this, mViewPager);

    mViewPager.setAdapter(mTabsAdapter);
    mViewPager.setOnPageChangeListener(mTabsAdapter);

    ActionBar actionBar = this.getActionBar();
    Tab tab1 = actionBar.newTab();/*from ww w.j  a  va 2 s . co m*/
    mTabsAdapter.addTab(tab1, TabContentFragment.class, null);
    Tab tab2 = actionBar.newTab();
    mTabsAdapter.addTab(tab2, TabContentFragment.class, null);
}

From source file:bizapps.com.healthforusPatient.activity.RegisterActivity.java

public void displayProgress() {
    if (progressDialog == null) {
        progressDialog = new ProgressDialog(this);
        progressDialog.getWindow().addFlags(Window.FEATURE_NO_TITLE);
        progressDialog.setMessage("Loading wait...");
    }/*from   w w  w.ja  v a2s. c om*/

    if (!progressDialog.isShowing()) {
        progressDialog.show();
    }
}

From source file:com.t2.compassionMeditation.MeditationActivity.java

/** Called when the activity is first created. */
@Override//  w ww . j  a v a  2  s  .co m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.i(TAG, this.getClass().getSimpleName() + ".onCreate()");

    mInstance = this;
    mRateOfChange = new RateOfChange(mRateOfChangeSize);

    mIntroFade = 255;

    // We don't want the screen to timeout in this activity
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE); // This needs to happen BEFORE setContentView

    setContentView(R.layout.buddah_activity_layout);

    sharedPref = PreferenceManager.getDefaultSharedPreferences(getBaseContext());

    currentMindsetData = new MindsetData(this);
    mSaveRawWave = SharedPref.getBoolean(this, BioZenConstants.PREF_SAVE_RAW_WAVE,
            BioZenConstants.PREF_SAVE_RAW_WAVE_DEFAULT);

    mShowAGain = SharedPref.getBoolean(this, BioZenConstants.PREF_SHOW_A_GAIN,
            BioZenConstants.PREF_SHOW_A_GAIN_DEFAULT);

    mAllowComments = SharedPref.getBoolean(this, BioZenConstants.PREF_COMMENTS,
            BioZenConstants.PREF_COMMENTS_DEFAULT);

    mShowForeground = SharedPref.getBoolean(this, "show_lotus", true);
    mShowToast = SharedPref.getBoolean(this, "show_toast", true);

    mAudioTrackResourceName = SharedPref.getString(this, "audio_track", "None");
    mBaseImageResourceName = SharedPref.getString(this, "background_images", "Sunset");

    mBioHarnessParameters = getResources().getStringArray(R.array.bioharness_parameters_array);

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    String s = SharedPref.getString(this, BioZenConstants.PREF_SESSION_LENGTH, "10");
    mSecondsRemaining = Integer.parseInt(s) * 60;
    mSecondsTotal = mSecondsRemaining;

    s = SharedPref.getString(this, BioZenConstants.PREF_ALPHA_GAIN, "5");
    mAlphaGain = Float.parseFloat(s);

    mMovingAverage = new TMovingAverageFilter(mMovingAverageSize);
    mMovingAverageROC = new TMovingAverageFilter(mMovingAverageSizeROC);

    View v1 = findViewById(R.id.buddahView);
    v1.setOnTouchListener(this);

    Resources resources = this.getResources();
    AssetManager assetManager = resources.getAssets();

    // Set up member variables to UI Elements
    mTextInfoView = (TextView) findViewById(R.id.textViewInfo);
    mTextBioHarnessView = (TextView) findViewById(R.id.textViewBioHarness);
    mCountdownTextView = (TextView) findViewById(R.id.countdownTextView);
    mCountdownImageView = (ImageView) findViewById(R.id.imageViewCountdown);

    mPauseButton = (ImageButton) findViewById(R.id.buttonPause);
    mSignalImage = (ImageView) findViewById(R.id.imageView1);
    mTextViewInstructions = (TextView) findViewById(R.id.textViewInstructions);

    // Note that the seek bar is a debug thing - used only to set the
    // alpha of the buddah image manually for visual testing
    mSeekBar = (SeekBar) findViewById(R.id.seekBar1);
    mSeekBar.setOnSeekBarChangeListener(this);

    // Scale such that values to the right of center are scaled 1 - 10
    // and values to the left of center are scaled 0 = .99999
    if (mAlphaGain > 1.0) {
        mSeekBar.setProgress(50 + (int) (mAlphaGain * 5));
    } else {
        int i = (int) (mAlphaGain * 50);
        mSeekBar.setProgress(i);
    }
    //      mSeekBar.setProgress((int) mAlphaGain * 10);      

    // Controls start as invisible, need to touch screen to activate them
    mCountdownTextView.setVisibility(View.INVISIBLE);
    mCountdownImageView.setVisibility(View.INVISIBLE);
    mTextInfoView.setVisibility(View.INVISIBLE);
    mTextBioHarnessView.setVisibility(View.INVISIBLE);
    mPauseButton.setVisibility(View.INVISIBLE);
    mPauseButton.setVisibility(View.VISIBLE);
    mSeekBar.setVisibility(View.INVISIBLE);

    mBackgroundImage = (ImageView) findViewById(R.id.buddahView);
    mForegroundImage = (ImageView) findViewById(R.id.lotusView);
    mBaseImage = (ImageView) findViewById(R.id.backgroundView);

    if (!mShowForeground) {
        mForegroundImage.setVisibility(View.INVISIBLE);
    }

    int resource = 0;
    if (mBaseImageResourceName.equalsIgnoreCase("Buddah")) {
        mBackgroundImage.setImageResource(R.drawable.buddha);
        mForegroundImage.setImageResource(R.drawable.lotus_flower);
        mBaseImage.setImageResource(R.drawable.none_bg);
    } else if (mBaseImageResourceName.equalsIgnoreCase("Bob")) {
        mBackgroundImage.setImageResource(R.drawable.bigbob);
        mForegroundImage.setImageResource(R.drawable.red_nose);
        mBaseImage.setImageResource(R.drawable.none_bg);
    } else if (mBaseImageResourceName.equalsIgnoreCase("Sunset")) {
        mBackgroundImage.setImageResource(R.drawable.eeg_layer);
        mForegroundImage.setImageResource(R.drawable.breathing_rate);
        mBaseImage.setImageResource(R.drawable.meditation_bg);
    }

    // Initialize SPINE by passing the fileName with the configuration properties
    try {
        mManager = SPINEFactory.createSPINEManager("SPINETestApp.properties", resources);
    } catch (InstantiationException e) {
        Log.e(TAG, "Exception creating SPINE manager: " + e.toString());
        e.printStackTrace();
    }

    // Since Mindset is a static node we have to manually put it in the active node list
    // Note that the sensor id 0xfff1 (-15) is a reserved id for this particular sensor
    Node mindsetNode = null;
    mindsetNode = new Node(new Address("" + Constants.RESERVED_ADDRESS_MINDSET));
    mManager.getActiveNodes().add(mindsetNode);

    Node zepherNode = null;
    zepherNode = new Node(new Address("" + Constants.RESERVED_ADDRESS_ZEPHYR));
    mManager.getActiveNodes().add(zepherNode);

    // The arduino node is programmed to look like a static Spine node
    // Note that currently we don't have  to turn it on or off - it's always streaming
    // Since Spine (in this case) is a static node we have to manually put it in the active node list
    // Since the 
    final int RESERVED_ADDRESS_ARDUINO_SPINE = 1; // 0x0001
    mSpineNode = new Node(new Address("" + RESERVED_ADDRESS_ARDUINO_SPINE));
    mManager.getActiveNodes().add(mSpineNode);

    // Create a broadcast receiver. Note that this is used ONLY for command messages from the service
    // All data from the service goes through the mail SPINE mechanism (received(Data data)).
    // See public void received(Data data)
    this.mCommandReceiver = new SpineReceiver(this);

    try {
        PackageManager packageManager = this.getPackageManager();
        PackageInfo info = packageManager.getPackageInfo(this.getPackageName(), 0);
        mApplicationVersion = info.versionName;
        Log.i(TAG, "BioZen Application Version: " + mApplicationVersion + ", Activity Version: "
                + mActivityVersion);
    } catch (NameNotFoundException e) {
        Log.e(TAG, e.toString());
    }

    // First create GraphBioParameters for each of the ECG static params (ie mindset)      
    int itemId = 0;
    eegPos = itemId; // eeg always comes first
    mBioParameters.clear();

    for (itemId = 0; itemId < MindsetData.NUM_BANDS + 2; itemId++) { // 2 extra, for attention and meditation
        GraphBioParameter param = new GraphBioParameter(itemId, MindsetData.spectralNames[itemId], "", true);
        param.isShimmer = false;
        mBioParameters.add(param);
    }

    // Now create all of the potential dynamic GBraphBioParameters (GSR, EMG, ECG, HR, Skin Temp, Resp Rate
    String[] paramNamesStringArray = getResources().getStringArray(R.array.parameter_names);

    for (String paramName : paramNamesStringArray) {
        if (paramName.equalsIgnoreCase("not assigned"))
            continue;

        if (paramName.equalsIgnoreCase("EEG"))
            continue;

        GraphBioParameter param = new GraphBioParameter(itemId, paramName, "", true);

        if (paramName.equalsIgnoreCase("gsr")) {
            gsrPos = itemId;
            param.isShimmer = true;
            param.shimmerSensorConstant = SPINESensorConstants.SHIMMER_GSR_SENSOR;
            param.shimmerNode = getShimmerNode();
        }

        if (paramName.equalsIgnoreCase("emg")) {
            emgPos = itemId;
            param.isShimmer = true;
            param.shimmerSensorConstant = SPINESensorConstants.SHIMMER_EMG_SENSOR;
            param.shimmerNode = getShimmerNode();
        }

        if (paramName.equalsIgnoreCase("ecg")) {
            ecgPos = itemId;
            param.isShimmer = true;
            param.shimmerSensorConstant = SPINESensorConstants.SHIMMER_ECG_SENSOR;
            param.shimmerNode = getShimmerNode();
        }

        if (paramName.equalsIgnoreCase("heart rate")) {
            heartRatePos = itemId;
            param.isShimmer = false;
        }

        if (paramName.equalsIgnoreCase("resp rate")) {
            respRatePos = itemId;
            param.isShimmer = false;
        }

        if (paramName.equalsIgnoreCase("skin temp")) {
            skinTempPos = itemId;
            param.isShimmer = false;
        }

        if (paramName.equalsIgnoreCase("EHealth Airflow")) {
            eHealthAirFlowPos = itemId;
            param.isShimmer = false;
        }

        if (paramName.equalsIgnoreCase("EHealth Temp")) {
            eHealthTempPos = itemId;
            param.isShimmer = false;
        }

        if (paramName.equalsIgnoreCase("EHealth SpO2")) {
            eHealthSpO2Pos = itemId;
            param.isShimmer = false;
        }

        if (paramName.equalsIgnoreCase("EHealth Heartrate")) {
            eHealthHeartRatePos = itemId;
            param.isShimmer = false;
        }

        if (paramName.equalsIgnoreCase("EHealth GSR")) {
            eHealthGSRPos = itemId;
            param.isShimmer = false;
        }

        itemId++;
        mBioParameters.add(param);
    }

    // The session start time will be used as session id
    // Note this also sets session start time
    // **** This session ID will be prepended to all JSON data stored
    //      in the external database until it's changed (by the start
    //      of a new session.
    Calendar cal = Calendar.getInstance();
    SharedPref.setBioSessionId(sharedPref, cal.getTimeInMillis());

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss", Locale.US);
    String sessionDate = sdf.format(new Date());
    long sessionId = SharedPref.getLong(this, "bio_session_start_time", 0);

    mUserId = SharedPref.getString(this, "SelectedUser", "");

    // Now get the database object associated with this user

    try {
        mBioUserDao = getHelper().getBioUserDao();
        mBioSessionDao = getHelper().getBioSessionDao();

        QueryBuilder<BioUser, Integer> builder = mBioUserDao.queryBuilder();
        builder.where().eq(BioUser.NAME_FIELD_NAME, mUserId);
        builder.limit(1);
        //         builder.orderBy(ClickCount.DATE_FIELD_NAME, false).limit(30);
        List<BioUser> list = mBioUserDao.query(builder.prepare());

        if (list.size() == 1) {
            mCurrentBioUser = list.get(0);
        } else if (list.size() == 0) {
            try {
                mCurrentBioUser = new BioUser(mUserId, System.currentTimeMillis());
                mBioUserDao.create(mCurrentBioUser);
            } catch (SQLException e1) {
                Log.e(TAG, "Error creating user " + mUserId, e1);
            }
        } else {
            Log.e(TAG, "General Database error" + mUserId);
        }

    } catch (SQLException e) {
        Log.e(TAG, "Can't find user: " + mUserId, e);

    }

    mSignalImage.setImageResource(R.drawable.signal_bars0);

    // Check to see of there a device configured for EEG, if so then show the skin conductance meter
    String tmp = SharedPref.getString(this, "EEG", null);

    if (tmp != null) {
        mSignalImage.setVisibility(View.VISIBLE);
        mTextViewInstructions.setVisibility(View.VISIBLE);

    } else {
        mSignalImage.setVisibility(View.INVISIBLE);
        mTextViewInstructions.setVisibility(View.INVISIBLE);
    }

    mDataOutHandler = new DataOutHandler(this, mUserId, sessionDate, mAppId,
            DataOutHandler.DATA_TYPE_EXTERNAL_SENSOR, sessionId);

    if (mDatabaseEnabled) {
        TelephonyManager telephonyManager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
        String myNumber = telephonyManager.getLine1Number();

        String remoteDatabaseUri = SharedPref.getString(this, "database_sync_name",
                getString(R.string.database_uri));
        //            remoteDatabaseUri += myNumber; 

        Log.d(TAG, "Initializing database at " + remoteDatabaseUri); // TODO: remove
        try {
            mDataOutHandler.initializeDatabase(dDatabaseName, dDesignDocName, dDesignDocId, byDateViewName,
                    remoteDatabaseUri);
        } catch (DataOutHandlerException e) {
            Log.e(TAG, e.toString());
            e.printStackTrace();
        }
        mDataOutHandler.setRequiresAuthentication(false);
    }

    mBioDataProcessor.initialize(mDataOutHandler);

    mLoggingEnabled = SharedPref.getBoolean(this, "enable_logging", true);
    mDatabaseEnabled = SharedPref.getBoolean(this, "database_enabled", false);
    mAntHrmEnabled = SharedPref.getBoolean(this, "enable_ant_hrm", false);

    mInternalSensorMonitoring = SharedPref.getBoolean(this, "inernal_sensor_monitoring_enabled", false);

    if (mAntHrmEnabled) {
        mHeartRateSource = HEARTRATE_ANT;
    } else {
        mHeartRateSource = HEARTRATE_ZEPHYR;
    }

    if (mLoggingEnabled) {
        mDataOutHandler.enableLogging(this);
    }

    if (mLogCatEnabled) {
        mDataOutHandler.enableLogCat();
    }

    // Log the version
    try {
        PackageManager packageManager = getPackageManager();
        PackageInfo info = packageManager.getPackageInfo(getPackageName(), 0);
        mApplicationVersion = info.versionName;
        String versionString = mAppId + " application version: " + mApplicationVersion;

        DataOutPacket packet = new DataOutPacket();
        packet.add(DataOutHandlerTags.version, versionString);
        try {
            mDataOutHandler.handleDataOut(packet);
        } catch (DataOutHandlerException e) {
            Log.e(TAG, e.toString());
            e.printStackTrace();
        }

    } catch (NameNotFoundException e) {
        Log.e(TAG, e.toString());
    }

    if (mInternalSensorMonitoring) {
        // IntentSender Launches our service scheduled with with the alarm manager 
        mBigBrotherService = PendingIntent.getService(MeditationActivity.this, 0,
                new Intent(MeditationActivity.this, BigBrotherService.class), 0);

        long firstTime = SystemClock.elapsedRealtime();
        // Schedule the alarm!
        AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
        am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstTime, mPollingPeriod * 1000,
                mBigBrotherService);

        // Tell the user about what we did.
        Toast.makeText(MeditationActivity.this, R.string.service_scheduled, Toast.LENGTH_LONG).show();

    }

}

From source file:edu.mit.viral.shen.DroidFish.java

/** Called when the activity is first created. */
@Override//from   w  ww  .  j  a v a  2s  .com
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    game_number = getIntent().getExtras().getInt("game_id", 0);

    // sendGame();
    Pair<String, String> pair = getPgnOrFenIntent();
    String intentPgnOrFen = pair.first;
    String intentFilename = pair.second;

    createDirectories();

    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
    settings = PreferenceManager.getDefaultSharedPreferences(this);
    settings.registerOnSharedPreferenceChangeListener(new OnSharedPreferenceChangeListener() {
        @Override
        public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
            handlePrefsChange();
        }
    });

    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    setWakeLock(false);
    wakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "droidfish");
    wakeLock.setReferenceCounted(false);

    custom1ButtonActions = new ButtonActions("custom1", CUSTOM1_BUTTON_DIALOG, R.string.select_action);
    custom2ButtonActions = new ButtonActions("custom2", CUSTOM2_BUTTON_DIALOG, R.string.select_action);
    custom3ButtonActions = new ButtonActions("custom3", CUSTOM3_BUTTON_DIALOG, R.string.select_action);

    figNotation = Typeface.createFromAsset(getAssets(), "fonts/DroidFishChessNotationDark.otf");
    setPieceNames(PGNOptions.PT_LOCAL);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    initUI();

    gameTextListener = new PgnScreenText(pgnOptions);
    if (ctrl != null)
        ctrl.shutdownEngine();
    ctrl = new DroidChessController(this, gameTextListener, pgnOptions);
    egtbForceReload = true;
    readPrefs();
    TimeControlData tcData = new TimeControlData();
    mDatabase = new SudokuDatabase(getApplicationContext());
    game_id = Long.valueOf(game_number);
    ctrl = mDatabase.getSudoku(ctrl, game_id);
    startPosition = ctrl.getData();

    tcData.setTimeControl(timeControl, movesPerSession, timeIncrement);
    int version = 1;
    version = settings.getInt("gameStateVersion", version);
    // System.out.println("this is the version" + version);
    ctrl.newGame(gameMode, tcData);

    if (game_number >= 37 && (startPosition.equals("8/8/8/8/8/8/8/8 w - - 0 1")
            | startPosition.equals("8/8/8/8/8/8/8/8 w KQkq - 0 1"))) {
        // System.out.println("greater than 37");
        startEditBoard("8/8/8/8/8/8/8/8 w KQkq - 0 1");
    }

    if (ctrl.getState() == DroidChessController.GAME_STATE_NOT_STARTED) {

        ctrl.start();
        System.out.println("GAME_STATE_NOT_STARTED");
    } else if (ctrl.getState() == DroidChessController.GAME_STATE_PLAYING) {

        System.out.println("GAME_STATE_PLAYING");
        String dataStr = ctrl.getNote();
        // System.out.println(ctrl.getNote());

        byte[] data = strToByteArr(dataStr);
        // ctrl.newGame(gameMode, tcData, "8/8/8/8/8/8/8/8 w KQkq - 0 1");

        ctrl.fromByteArray(data, 3);
    }

    ctrl.setGuiPaused(true);
    ctrl.setGuiPaused(false);
    ctrl.startGame();

    if (intentPgnOrFen != null) {
        try {
            ctrl.setFENOrPGN(intentPgnOrFen);
            setBoardFlip(true);
        } catch (ChessParseError e) {
            // If FEN corresponds to illegal chess position, go into edit board mode.
            try {
                TextIO.readFEN(intentPgnOrFen);
            } catch (ChessParseError e2) {
                if (e2.pos != null)
                    startEditBoard(intentPgnOrFen);
            }
        }
    } else if (intentFilename != null) {
        if (intentFilename.toLowerCase(Locale.US).endsWith(".fen")
                || intentFilename.toLowerCase(Locale.US).endsWith(".epd"))
            loadFENFromFile(intentFilename);
        else
            loadPGNFromFile(intentFilename);
    }
    // commented out 04/12/15
    // sendDataone(startPosition, 1);
    utils = new Utils(getApplicationContext());
    client = new WebSocketClient(URI.create(Const.URL_WEBSOCKET + URLEncoder.encode(name)),
            new WebSocketClient.Listener() {
                @Override
                public void onConnect() {

                }

                /**
                 * On receiving the message from web socket server
                 * */
                @Override
                public void onMessage(String message) {
                    Log.d(TAG, String.format("Got string message! %s", message));
                    parseMessage(message);
                }

                @Override
                public void onMessage(byte[] data) {
                    Log.d(TAG, String.format("Got binary message! %s", bytesToHex(data)));
                    parseMessage(bytesToHex(data));
                    // Message will be in JSON format
                }

                /**
                 * Called when the connection is terminated
                 * */
                @Override
                public void onDisconnect(int code, String reason) {

                    String message = String.format(Locale.US, "Disconnected! Code: %d Reason: %s", code,
                            reason);
                    //                showToast(message);

                    // clear the session id from shared preferences
                    utils.storeSessionId(null);
                }

                @Override
                public void onError(Exception error) {
                    Log.e(TAG, "Error! : " + error);

                }
            }, null);
    client.connect();
}

From source file:com.corporatetaxi.TaxiOntheWay_Activity.java

private void initiatePopupWindowcanceltaxi() {
    try {//from  w  w  w  . j  av a2  s.c om
        dialog = new Dialog(TaxiOntheWay_Activity.this);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // before
        dialog.setContentView(R.layout.canceltaxi_popup);

        cross = (ImageButton) dialog.findViewById(R.id.cross);
        cross.setOnClickListener(cancle_btn_click_listener);
        rd1 = (RadioButton) dialog.findViewById(R.id.radioButton);
        rd2 = (RadioButton) dialog.findViewById(R.id.radioButton2);
        rd3 = (RadioButton) dialog.findViewById(R.id.radioButton3);
        btn_confirm = (Button) dialog.findViewById(R.id.btn_acceptor);
        TextView txt = (TextView) dialog.findViewById(R.id.textView);
        textheader = (TextView) dialog.findViewById(R.id.popup_text);
        Typeface tf = Typeface.createFromAsset(this.getAssets(), "Montserrat-Regular.ttf");
        rd1.setTypeface(tf);
        rd2.setTypeface(tf);
        rd3.setTypeface(tf);
        btn_confirm.setTypeface(tf);
        txt.setTypeface(tf);
        textheader.setTypeface(tf);
        btn_confirm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if (rd1.isChecked()) {
                    canceltaxirequest = getResources().getString(R.string.prompt_cancel_reason_one);

                } else if (rd2.isChecked()) {
                    canceltaxirequest = getResources().getString(R.string.prompt_cancel_reason_two);

                } else if (rd3.isChecked()) {
                    canceltaxirequest = getResources().getString(R.string.prompt_cancel_reason_three);

                }

                Allbeans allbeans = new Allbeans();

                allbeans.setCanceltaxirequest(canceltaxirequest);

                new CancelTaxiAsynch(allbeans).execute();

            }
        });

        dialog.show();
    } catch (Exception e) {
        e.printStackTrace();
    }
}