FileDocCategorySizeDatePackage
EditTextActivityDialog.javaAPI DocAndroid 5.1 API3590Thu Mar 12 22:22:44 GMT 2015com.android.imftest.samples

EditTextActivityDialog

public class EditTextActivityDialog extends android.app.Activity

Fields Summary
private static final int
SCROLLABLE_DIALOG_ID
private static final int
NONSCROLLABLE_DIALOG_ID
private android.widget.LinearLayout
mLayout
private android.widget.ScrollView
mScrollView
private android.view.LayoutInflater
mInflater
private android.widget.Button
mButton1
private android.widget.Button
mButton2
Constructors Summary
Methods Summary
protected android.app.DialogcreateDialog(boolean scrollable)

        View layout;
        EditText editText;
        
        if (scrollable) {
            layout = new ScrollView(EditTextActivityDialog.this);
            ((ScrollView) layout).setMinimumHeight(mLayout.getHeight());
            
            ((ScrollView) layout).addView((
                    LinearLayout) View.inflate(EditTextActivityDialog.this, 
                    R.layout.dialog_edit_text_no_scroll, null));
        } else {
            layout = View.inflate(EditTextActivityDialog.this, 
                    R.layout.dialog_edit_text_no_scroll, null);
        }
        
        Dialog d = new Dialog(EditTextActivityDialog.this);
        d.setTitle(getString(R.string.test_dialog));
        d.setCancelable(true);
        d.setContentView(layout);
        return d;
    
protected voidonCreate(android.os.Bundle icicle)

    
    
    
        
        super.onCreate(icicle);
        
        mLayout = new LinearLayout(this);
        mLayout.setOrientation(LinearLayout.VERTICAL);
        mLayout.setLayoutParams(new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        
        mButton1 = new Button(this);
        mButton1.setText(R.string.open_dialog_scrollable);
        mButton1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                showDialog(SCROLLABLE_DIALOG_ID);
            }
        });
        
        mButton2 = new Button(this);
        mButton2.setText(R.string.open_dialog_nonscrollable);
        mButton2.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                showDialog(NONSCROLLABLE_DIALOG_ID);
            }
        });
        
        mLayout.addView(mButton1);
        mLayout.addView(mButton2);
        
        setContentView(mLayout);
    
protected android.app.DialogonCreateDialog(int id)

        switch (id) {
            case SCROLLABLE_DIALOG_ID:
                return createDialog(true);
            case NONSCROLLABLE_DIALOG_ID:
                return createDialog(false);
        }

        return super.onCreateDialog(id);