Search in sources :

Example 26 with Button

use of android.widget.Button in project cw-advandroid by commonsguy.

the class ContactsInserter method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Button btn = (Button) findViewById(R.id.insert);
    btn.setOnClickListener(onInsert);
}
Also used : Button(android.widget.Button)

Example 27 with Button

use of android.widget.Button in project cw-advandroid by commonsguy.

the class PickDemo method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    if (CONTENT_URI == null) {
        Toast.makeText(this, "We are experiencing technical difficulties...", Toast.LENGTH_LONG).show();
        finish();
        return;
    }
    setContentView(R.layout.main);
    Button btn = (Button) findViewById(R.id.pick);
    btn.setOnClickListener(new View.OnClickListener() {

        public void onClick(View view) {
            Intent i = new Intent(Intent.ACTION_PICK, CONTENT_URI);
            startActivityForResult(i, PICK_REQUEST);
        }
    });
}
Also used : Button(android.widget.Button) Intent(android.content.Intent) View(android.view.View)

Example 28 with Button

use of android.widget.Button in project cw-omnibus by commonsguy.

the class FlipperDemo2 method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
    flipper = (ViewFlipper) findViewById(R.id.details);
    for (String item : items) {
        Button btn = new Button(this);
        btn.setText(item);
        flipper.addView(btn, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
    }
    flipper.setFlipInterval(2000);
    flipper.startFlipping();
}
Also used : Button(android.widget.Button) ViewGroup(android.view.ViewGroup)

Example 29 with Button

use of android.widget.Button in project android-betterpickers by code-troopers.

the class SampleNumberMultipleReferences method onDialogNumberSet.

@Override
public void onDialogNumberSet(int reference, BigInteger number, double decimal, boolean isNegative, BigDecimal fullNumber) {
    Button buttonToSet;
    switch(reference) {
        case BUTTON_ONE_REFERENCE:
            buttonToSet = buttonOne;
            break;
        case BUTTON_TWO_REFERENCE:
            buttonToSet = buttonTwo;
            break;
        case BUTTON_THREE_REFERENCE:
            buttonToSet = buttonThree;
            break;
        case BUTTON_FOUR_REFERENCE:
            buttonToSet = buttonFour;
            break;
        default:
            buttonToSet = buttonOne;
    }
    buttonToSet.setText(getString(R.string.number_picker_result_value, number, decimal, isNegative, fullNumber));
}
Also used : Button(android.widget.Button)

Example 30 with Button

use of android.widget.Button in project android-betterpickers by code-troopers.

the class SampleNumberWithOptions method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.text_and_three_buttons);
    mResultTextView = (TextView) findViewById(R.id.text);
    Button buttonOne = (Button) findViewById(R.id.button_one);
    mButtonSetMin = (Button) findViewById(R.id.button_two);
    mButtonSetMax = (Button) findViewById(R.id.button_three);
    mResultTextView.setText(R.string.no_value);
    buttonOne.setText(R.string.number_picker_set);
    buttonOne.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NumberPickerBuilder npb = new NumberPickerBuilder().setFragmentManager(getSupportFragmentManager()).setStyleResId(R.style.BetterPickersDialogFragment_Light).setPlusMinusVisibility(View.INVISIBLE).setDecimalVisibility(View.INVISIBLE).setReference(BUTTON_ONE_REFERENCE).setLabelText("LBS.");
            if (mMin != null) {
                npb.setMinNumber(mMin);
            }
            if (mMax != null) {
                npb.setMaxNumber(mMax);
            }
            npb.show();
        }
    });
    mButtonSetMin.setText("Set Min Number");
    mButtonSetMin.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NumberPickerBuilder npb = new NumberPickerBuilder().setFragmentManager(getSupportFragmentManager()).setStyleResId(R.style.BetterPickersDialogFragment_Light).setDecimalVisibility(View.INVISIBLE).setReference(BUTTON_TWO_REFERENCE).setLabelText("MIN NUMBER");
            npb.show();
        }
    });
    mButtonSetMax.setText("Set Max Number");
    mButtonSetMax.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NumberPickerBuilder npb = new NumberPickerBuilder().setFragmentManager(getSupportFragmentManager()).setStyleResId(R.style.BetterPickersDialogFragment_Light).setDecimalVisibility(View.INVISIBLE).setReference(BUTTON_THREE_REFERENCE).setLabelText("MAX NUMBER");
            npb.show();
        }
    });
}
Also used : Button(android.widget.Button) TextView(android.widget.TextView) View(android.view.View) NumberPickerBuilder(com.codetroopers.betterpickers.numberpicker.NumberPickerBuilder)

Aggregations

Button (android.widget.Button)1427 View (android.view.View)872 TextView (android.widget.TextView)585 OnClickListener (android.view.View.OnClickListener)272 Intent (android.content.Intent)189 LinearLayout (android.widget.LinearLayout)186 ImageView (android.widget.ImageView)141 EditText (android.widget.EditText)120 ListView (android.widget.ListView)112 AdapterView (android.widget.AdapterView)74 ViewGroup (android.view.ViewGroup)62 ScrollView (android.widget.ScrollView)51 Test (org.junit.Test)51 CompoundButton (android.widget.CompoundButton)49 FrameLayout (android.widget.FrameLayout)47 Bundle (android.os.Bundle)44 CheckBox (android.widget.CheckBox)43 ImageButton (android.widget.ImageButton)43 LargeTest (android.test.suitebuilder.annotation.LargeTest)41 DialogInterface (android.content.DialogInterface)39