Example usage for android.text InputType TYPE_CLASS_TEXT

List of usage examples for android.text InputType TYPE_CLASS_TEXT

Introduction

In this page you can find the example usage for android.text InputType TYPE_CLASS_TEXT.

Prototype

int TYPE_CLASS_TEXT

To view the source code for android.text InputType TYPE_CLASS_TEXT.

Click Source Link

Document

Class for normal text.

Usage

From source file:br.com.carlosrafaelgn.fplay.ActivityBrowserRadio.java

@Override
public void onClick(View view) {
    if (view == btnGoBack) {
        if (isAtFavorites) {
            isAtFavorites = false;//from   www.j  av a 2s.  c o m
            doSearch();
        } else {
            finish(0, view, true);
        }
    } else if (view == btnFavorite) {
        isAtFavorites = true;
        radioStationList.cancel();
        radioStationList.fetchFavorites(getApplication());
        updateButtons();
    } else if (view == btnSearch) {
        final Context ctx = getHostActivity();
        final LinearLayout l = (LinearLayout) UI.createDialogView(ctx, null);

        LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);
        chkGenre = new RadioButton(ctx);
        chkGenre.setText(R.string.genre);
        chkGenre.setChecked(Player.lastRadioSearchWasByGenre);
        chkGenre.setOnClickListener(this);
        chkGenre.setTextSize(TypedValue.COMPLEX_UNIT_PX, UI._DLGsp);
        chkGenre.setLayoutParams(p);

        p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);
        p.topMargin = UI._DLGsppad;
        btnGenre = new Spinner(ctx);
        btnGenre.setContentDescription(ctx.getText(R.string.genre));
        btnGenre.setLayoutParams(p);

        p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);
        p.topMargin = UI._DLGsppad << 1;
        chkTerm = new RadioButton(ctx);
        chkTerm.setText(R.string.search_term);
        chkTerm.setChecked(!Player.lastRadioSearchWasByGenre);
        chkTerm.setOnClickListener(this);
        chkTerm.setTextSize(TypedValue.COMPLEX_UNIT_PX, UI._DLGsp);
        chkTerm.setLayoutParams(p);

        p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);
        p.topMargin = UI._DLGsppad;
        txtTerm = new EditText(ctx);
        txtTerm.setContentDescription(ctx.getText(R.string.search_term));
        txtTerm.setText(Player.radioSearchTerm == null ? "" : Player.radioSearchTerm);
        txtTerm.setOnClickListener(this);
        txtTerm.setTextSize(TypedValue.COMPLEX_UNIT_PX, UI._DLGsp);
        txtTerm.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
        txtTerm.setSingleLine();
        txtTerm.setLayoutParams(p);

        p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);
        p.topMargin = UI._DLGsppad;
        p.bottomMargin = UI._DLGsppad;
        final TextView lbl = new TextView(ctx);
        lbl.setAutoLinkMask(0);
        lbl.setLinksClickable(true);
        //http://developer.android.com/design/style/color.html
        lbl.setLinkTextColor(new BgColorStateList(UI.isAndroidThemeLight() ? 0xff0099cc : 0xff33b5e5));
        lbl.setTextSize(TypedValue.COMPLEX_UNIT_PX, UI._14sp);
        lbl.setGravity(Gravity.CENTER_HORIZONTAL);
        lbl.setText(SafeURLSpan.parseSafeHtml(getText(R.string.by_dir_xiph_org)));
        lbl.setMovementMethod(LinkMovementMethod.getInstance());
        lbl.setLayoutParams(p);

        l.addView(chkGenre);
        l.addView(btnGenre);
        l.addView(chkTerm);
        l.addView(txtTerm);
        l.addView(lbl);

        btnGenre.setAdapter(this);
        btnGenre.setSelection(getValidGenre(Player.radioLastGenre));
        defaultTextColors = txtTerm.getTextColors();

        UI.prepareDialogAndShow((new AlertDialog.Builder(ctx)).setTitle(getText(R.string.search)).setView(l)
                .setPositiveButton(R.string.search, this).setNegativeButton(R.string.cancel, this)
                .setOnCancelListener(this).create());
    } else if (view == btnGoBackToPlayer) {
        finish(-1, view, false);
    } else if (view == btnAdd) {
        addPlaySelectedItem(false);
    } else if (view == btnPlay) {
        addPlaySelectedItem(true);
    } else if (view == chkGenre || view == btnGenre) {
        chkGenre.setChecked(true);
        chkTerm.setChecked(false);
    } else if (view == chkTerm || view == txtTerm) {
        chkGenre.setChecked(false);
        chkTerm.setChecked(true);
    } else if (view == list) {
        if (!isAtFavorites && !loading && (radioStationList == null || radioStationList.getCount() == 0))
            onClick(btnFavorite);
    }
}

From source file:com.owncloud.android.ui.fragment.PublicShareDialogFragment.java

private void showPassword() {
    if (getView() != null) {
        mPasswordValueEdit.setInputType(InputType.TYPE_CLASS_TEXT
                | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
        showViewPasswordButton();/* www .  j  av  a2 s .  c om*/
    }
}

From source file:com.owncloud.android.ui.fragment.PublicShareDialogFragment.java

private void hidePassword() {
    if (getView() != null) {
        mPasswordValueEdit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD
                | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
        showViewPasswordButton();//w w  w.j av  a 2 s. c om
    }
}

From source file:paulscode.android.mupen64plusae.jni.CoreFragment.java

public void saveFileFromPrompt() {
    if (getActivity() != null) {
        CharSequence title = getActivity().getText(R.string.menuItem_fileSave);
        CharSequence hint = getActivity().getText(R.string.hintFileSave);
        int inputType = InputType.TYPE_CLASS_TEXT;
        Prompt.promptText(getActivity(), title, null, null, hint, inputType, new Prompt.PromptTextListener() {
            @Override//from   w  w  w.  ja  v a  2s.c o  m
            public void onDialogClosed(CharSequence text, int which) {
                if (which == DialogInterface.BUTTON_POSITIVE) {
                    saveState(text.toString());
                }
            }
        });
    }
}

From source file:com.sigilance.CardEdit.MainActivity.java

private void promptForTextDo(final int slot) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    final EditText input = new EditText(this);
    final EditText input2 = new EditText(this);
    input.setInputType(InputType.TYPE_CLASS_TEXT);
    input2.setInputType(InputType.TYPE_CLASS_TEXT);
    LinearLayout fields = new LinearLayout(this);
    fields.setOrientation(LinearLayout.VERTICAL);
    fields.addView(input);/*ww  w  .  java 2  s. c  o  m*/

    switch (slot) {
    case DO_NAME:
        builder.setTitle(R.string.lbl_cardholder_name);
        input.setHint(R.string.hint_surname);
        input2.setHint(R.string.hint_given_name);
        input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS);
        input2.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS);

        String[] names = mCardholderName.split("<<");
        if (names.length > 1) {
            input.setText(names[0].replace('<', ' '));
            input2.setText(names[1].replace('<', ' '));
        }
        fields.addView(input2);
        break;
    case DO_LANGUAGE:
        builder.setTitle(R.string.lbl_language_prefs);
        builder.setMessage("Use a two-letter ISO 639-1 language code: en for English, es for Spanish, etc.");
        input.setFilters(new InputFilter[] { new InputFilter.LengthFilter(2) });
        input.setText(mCardholderLanguage);
        break;
    case DO_LOGIN_DATA:
        builder.setTitle(R.string.lbl_login_data);
        builder.setMessage(
                "This is arbitrary text; you can use this field to store a username, email address or network logon.");
        input.setFilters(new InputFilter[] { new InputFilter.LengthFilter(254) });
        input.setText(new String(mLoginData));
        break;
    case DO_URL:
        builder.setTitle(R.string.lbl_url);
        input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI);
        input.setFilters(new InputFilter[] { new InputFilter.LengthFilter(254) });
        input.setText(mUrl);
        break;
    }

    builder.setView(fields);

    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            byte[] data;
            String text = input.getText().toString();

            switch (slot) {
            case DO_NAME:
                String surname = text.trim().replace(' ', '<');
                String givenNames = input2.getText().toString().trim().replace(' ', '<');
                data = (surname + "<<" + givenNames).getBytes(Charset.forName("ISO-8859-1"));
                if (data.length > 39) {
                    Toast.makeText(MainActivity.this, "Name is too long!", Toast.LENGTH_LONG).show();
                    return;
                }
                break;
            case DO_LANGUAGE:
                if (text.length() == 2)
                    data = text.toLowerCase().getBytes();
                else
                    data = new byte[0];
                break;
            case DO_URL:
            case DO_LOGIN_DATA:
                data = text.getBytes();
                break;
            default:
                data = new byte[0];
            }

            mPendingOperations.add(new PendingPutDataOperation(slot, data));
            hideUi();
            findTextViewById(R.id.id_action_reqiured_warning).setText(R.string.warning_tap_card_to_save);
        }
    });
    builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });

    builder.create().show();
}

From source file:com.kmshack.BusanBus.activity.SearchMainActivity.java

private void setTabChange(int tab) {

    mInputMethodManager.hideSoftInputFromWindow(mNosunEditText.getWindowToken(), 0);
    mTabMode = tab;/*from   www.  j a v a  2s . c o  m*/

    switch (tab) {

    case TAB_FAVORITE:
        mLocationManager.removeUpdates(this);
        mLayoutFavorite.setVisibility(View.VISIBLE);
        mLayoutNosun.setVisibility(View.GONE);
        mLayoutBusstop.setVisibility(View.GONE);
        mLayoutLocation.setVisibility(View.GONE);

        mTabFavorite.setBackgroundColor(Color.parseColor("#7F7F72"));
        mTabNosun.setBackgroundColor(Color.parseColor("#F7F7F0"));
        mTabBusstop.setBackgroundColor(Color.parseColor("#F7F7F0"));
        mTabLocation.setBackgroundColor(Color.parseColor("#F7F7F0"));

        mTextFavorite.setTextColor(Color.parseColor("#FFFFFF"));
        mTextNosun.setTextColor(Color.parseColor("#7F7F72"));
        mTextBusstop.setTextColor(Color.parseColor("#7F7F72"));
        mTextSetting.setTextColor(Color.parseColor("#7F7F72"));

        mImageFavorite.setImageResource(R.drawable.ic_main_tab_favorite_pressed);
        mImageNosun.setImageResource(R.drawable.ic_main_tab_search_normal);
        mImageBusstop.setImageResource(R.drawable.ic_main_tab_stop_normal);
        mImageLocation.setImageResource(R.drawable.ic_main_tab_compass_normal);

        if (mBusanBusPrefrence.getIsFavoriteLocation())
            setFavoriteTabChange(mBusanBusPrefrence.getFavoriteLocation());
        else
            setFavoriteTabChange(FAVORITE_TAB_NOSUN);

        switch (mFavoriteMode) {
        case FAVORITE_TAB_NOSUN:
            favoriteBusStop();
            favoriteNosun();
            break;

        case FAVORITE_TAB_BUSSTOP:
            favoriteNosun();
            favoriteBusStop();
            break;

        }

        tracker.trackEvent("TabClicks", // Category
                "Favorite", // Action
                "", // Label
                0); // Value
        break;

    case TAB_NOSUN:
        mLocationManager.removeUpdates(this);
        mLayoutFavorite.setVisibility(View.GONE);
        mLayoutNosun.setVisibility(View.VISIBLE);
        mLayoutBusstop.setVisibility(View.GONE);
        mLayoutLocation.setVisibility(View.GONE);
        mNosunEditText.setInputType(InputType.TYPE_CLASS_NUMBER);

        mTabFavorite.setBackgroundColor(Color.parseColor("#F7F7F0"));
        mTabNosun.setBackgroundColor(Color.parseColor("#7F7F72"));
        mTabBusstop.setBackgroundColor(Color.parseColor("#F7F7F0"));
        mTabLocation.setBackgroundColor(Color.parseColor("#F7F7F0"));

        mTextFavorite.setTextColor(Color.parseColor("#7F7F72"));
        mTextNosun.setTextColor(Color.parseColor("#FFFFFF"));
        mTextBusstop.setTextColor(Color.parseColor("#7F7F72"));
        mTextSetting.setTextColor(Color.parseColor("#7F7F72"));

        mImageFavorite.setImageResource(R.drawable.ic_main_tab_favorite_normal);
        mImageNosun.setImageResource(R.drawable.ic_main_tab_search_pressed);
        mImageBusstop.setImageResource(R.drawable.ic_main_tab_stop_normal);
        mImageLocation.setImageResource(R.drawable.ic_main_tab_compass_normal);

        tracker.trackEvent("TabClicks", // Category
                "LineSearch", // Action
                "", // Label
                0); // Value

        break;

    case TAB_BUSSTOP:
        mLocationManager.removeUpdates(this);
        mLayoutFavorite.setVisibility(View.GONE);
        mLayoutNosun.setVisibility(View.GONE);
        mLayoutBusstop.setVisibility(View.VISIBLE);
        mLayoutLocation.setVisibility(View.GONE);
        mBusStopEditText.setInputType(InputType.TYPE_CLASS_TEXT);

        mTabFavorite.setBackgroundColor(Color.parseColor("#F7F7F0"));
        mTabNosun.setBackgroundColor(Color.parseColor("#F7F7F0"));
        mTabBusstop.setBackgroundColor(Color.parseColor("#7F7F72"));
        mTabLocation.setBackgroundColor(Color.parseColor("#F7F7F0"));

        mTextFavorite.setTextColor(Color.parseColor("#7F7F72"));
        mTextNosun.setTextColor(Color.parseColor("#7F7F72"));
        mTextBusstop.setTextColor(Color.parseColor("#FFFFFF"));
        mTextSetting.setTextColor(Color.parseColor("#7F7F72"));

        mImageFavorite.setImageResource(R.drawable.ic_main_tab_favorite_normal);
        mImageNosun.setImageResource(R.drawable.ic_main_tab_search_normal);
        mImageBusstop.setImageResource(R.drawable.ic_main_tab_stop_pressed);
        mImageLocation.setImageResource(R.drawable.ic_main_tab_compass_normal);

        tracker.trackEvent("TabClicks", // Category
                "BusStopSearch", // Action
                "", // Label
                0); // Value

        break;

    case TAB_LOCATION:
        mLayoutFavorite.setVisibility(View.GONE);
        mLayoutNosun.setVisibility(View.GONE);
        mLayoutBusstop.setVisibility(View.GONE);
        mLayoutLocation.setVisibility(View.VISIBLE);

        mTabFavorite.setBackgroundColor(Color.parseColor("#F7F7F0"));
        mTabNosun.setBackgroundColor(Color.parseColor("#F7F7F0"));
        mTabBusstop.setBackgroundColor(Color.parseColor("#F7F7F0"));
        mTabLocation.setBackgroundColor(Color.parseColor("#7F7F72"));

        mTextFavorite.setTextColor(Color.parseColor("#7F7F72"));
        mTextNosun.setTextColor(Color.parseColor("#7F7F72"));
        mTextBusstop.setTextColor(Color.parseColor("#7F7F72"));
        mTextSetting.setTextColor(Color.parseColor("#FFFFFF"));

        mImageFavorite.setImageResource(R.drawable.ic_main_tab_favorite_normal);
        mImageNosun.setImageResource(R.drawable.ic_main_tab_search_normal);
        mImageBusstop.setImageResource(R.drawable.ic_main_tab_stop_normal);
        mImageLocation.setImageResource(R.drawable.ic_main_tab_compass_pressed);

        tracker.trackEvent("TabClicks", // Category
                "Information", // Action
                "", // Label
                0); // Value

        if (!mBusanBusPrefrence.getIsLocationAgree()) {

            DialogInterface.OnClickListener cancel = new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {

                    setTabChange(TAB_NOSUN);

                }
            };
            DialogInterface.OnClickListener ok = new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    mBusanBusPrefrence.setLocationAgree();

                    initilizeMap();
                    loadLocation();
                }
            };

            new AlertDialog.Builder(this).setTitle("  ").setMessage(
                    "Google         .              .")
                    .setPositiveButton("", ok).setNegativeButton("", cancel).show();

        } else {
            initilizeMap();
            loadLocation();
        }

        break;
    }

}

From source file:com.eugene.fithealthmaingit.UI.ChooseAddMealSearchFragment.java

/**
 * Set the text based on google voice then implement search
 *//*from   w ww  . j a  v  a 2s .  c o m*/
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQ_CODE_SPEECH_INPUT) {
        if (resultCode == Activity.RESULT_OK && null != data) {
            ArrayList<String> result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
            mEtSearch.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
            mEtSearch.setText(result.get(0));
            searchFood(mEtSearch.getText().toString(), 0);
            mItem.clear();
            mEtSearchAdapter.notifyDataSetChanged();
            mEtSearch.clearFocus();
        }
    }
}

From source file:research.sg.edu.edapp.kb.KbSoftKeyboard.java

/**
 * This is the main point where we do our initialization of the input method
 * to begin operating on an application.  At this point we have been
 * bound to the client, and are now receiving all of the detailed information
 * about the target of our edits./* w  ww. ja va  2s .co  m*/
 */
@Override
public void onStartInput(EditorInfo attribute, boolean restarting) {
    super.onStartInput(attribute, restarting);

    // Reset our state.  We want to do this even if restarting, because
    // the underlying state of the text editor could have changed in any way.
    mComposing.setLength(0);
    updateCandidates();

    if (!restarting) {
        // Clear shift states.
        mMetaState = 0;
    }

    mPredictionOn = false;
    mCompletionOn = false;
    mCompletions = null;

    // We are now going to initialize our state based on the type of
    // text being edited.
    switch (attribute.inputType & InputType.TYPE_MASK_CLASS) {
    case InputType.TYPE_CLASS_NUMBER:
    case InputType.TYPE_CLASS_DATETIME:
        // Numbers and dates default to the symbols keyboard, with
        // no extra features.
        mCurKeyboard = mSymbolsKeyboard;
        break;

    case InputType.TYPE_CLASS_PHONE:
        // Phones will also default to the symbols keyboard, though
        // often you will want to have a dedicated phone keyboard.
        mCurKeyboard = mSymbolsKeyboard;
        break;

    case InputType.TYPE_CLASS_TEXT:
        // This is general text editing.  We will default to the
        // normal alphabetic keyboard, and assume that we should
        // be doing predictive text (showing candidates as the
        // user types).
        mCurKeyboard = mQwertyKeyboard;
        mPredictionOn = true;
        //mPredictionOn = false;

        // We now look for a few special variations of text that will
        // modify our behavior.
        int variation = attribute.inputType & InputType.TYPE_MASK_VARIATION;
        if (variation == InputType.TYPE_TEXT_VARIATION_PASSWORD
                || variation == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {
            // Do not display predictions / what the user is typing
            // when they are entering a password.
            mPredictionOn = false;
        }

        if (variation == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS
                || variation == InputType.TYPE_TEXT_VARIATION_URI
                || variation == InputType.TYPE_TEXT_VARIATION_FILTER) {
            // Our predictions are not useful for e-mail addresses
            // or URIs.
            mPredictionOn = false;
        }

        if ((attribute.inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE) != 0) {
            // If this is an auto-complete text view, then our predictions
            // will not be shown and instead we will allow the editor
            // to supply their own.  We only show the editor's
            // candidates when in fullscreen mode, otherwise relying
            // own it displaying its own UI.
            mPredictionOn = false;
            mCompletionOn = isFullscreenMode();
        }

        // We also want to look at the current state of the editor
        // to decide whether our alphabetic keyboard should start out
        // shifted.
        updateShiftKeyState(attribute);
        break;

    default:
        // For all unknown input types, default to the alphabetic
        // keyboard with no special features.
        mCurKeyboard = mQwertyKeyboard;
        updateShiftKeyState(attribute);
    }

    // Update the label on the enter key, depending on what the application
    // says it will do.
    mCurKeyboard.setImeOptions(getResources(), attribute.imeOptions);
}

From source file:com.wit.and.dialog.LoginDialog.java

/**
 * //www  . j av  a2 s. c  o  m
 */
@Override
protected View onCreateBodyView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = inflater.getContext();

    RelativeLayout layout = new RelativeLayout(context);
    // Apply neutral layout params.
    layout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    // Do not allow to apply style to body view.
    // layout.setId(R.id.Dialog_Layout_Body);

    // Create layout for loading view.
    LinearLayout loadingLayout = new LinearLayout(context);
    loadingLayout.setOrientation(LinearLayout.HORIZONTAL);
    loadingLayout.setGravity(Gravity.CENTER_VERTICAL);
    // Allow styling of loading layout as body layout.
    loadingLayout.setId(R.id.And_Dialog_Layout_Body);

    // Create text view for message.
    TextView msgTextView = new TextView(context);
    msgTextView.setId(R.id.And_Dialog_TextView_Message);

    // Create circle progress bar.
    ProgressBar circleProgressBar = new ProgressBar(context);
    circleProgressBar.setId(R.id.And_Dialog_ProgressBar);

    // Build loading view.
    loadingLayout.addView(circleProgressBar, new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    loadingLayout.addView(msgTextView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    loadingLayout.setVisibility(View.GONE);

    // Insert loading layout into main body layout.
    RelativeLayout.LayoutParams loadingLayoutParams = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    loadingLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    layout.addView(loadingLayout, loadingLayoutParams);

    // Create layout for edit texts.
    LinearLayout editLayout = new LinearLayout(context);
    editLayout.setOrientation(LinearLayout.VERTICAL);
    editLayout.setId(R.id.And_Dialog_Layout_LoginDialog_EditView);

    // Create edit texts for username and password.
    EditText userEdit = new EditText(context);
    userEdit.setId(R.id.And_Dialog_EditText_Username);
    userEdit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
    EditText passEdit = new EditText(context);
    passEdit.setId(R.id.And_Dialog_EditText_Password);
    passEdit.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);

    // Create edit texts divider.
    DialogDivider divider = new DialogDivider(context);
    divider.setId(R.id.And_Dialog_Divider_LoginDialog_EditTexts);

    // Build edit layout.
    editLayout.addView(userEdit, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    editLayout.addView(divider, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    editLayout.addView(passEdit, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));

    // Add custom layout.
    View customView = onCreateCustomView(inflater, editLayout, savedInstanceState);
    if (customView != null) {
        editLayout.addView(this.mCustomView = customView);
    }

    // Insert edit layout into main body layout.
    RelativeLayout.LayoutParams editLayoutParams = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    editLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    layout.addView(editLayout, editLayoutParams);

    return layout;
}

From source file:com.safecell.ManageProfile_Activity.java

private int setInputTypeKeyBoard(int position) {
    int inputType = 0;
    switch (position) {
    case 0://w w  w  .  j a  v a  2  s. c  o  m

        inputType = InputType.TYPE_MASK_CLASS | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS;
        break;

    case 1:

        inputType = InputType.TYPE_MASK_CLASS | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS;
        break;

    case 2:
        inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
        break;

    case 3:
        inputType = InputType.TYPE_CLASS_PHONE;
        break;
    }

    return inputType;

}