Example usage for android.os Bundle getInt

List of usage examples for android.os Bundle getInt

Introduction

In this page you can find the example usage for android.os Bundle getInt.

Prototype

public int getInt(String key, int defaultValue) 

Source Link

Document

Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.

Usage

From source file:cz.muni.fi.japanesedictionary.entity.JapaneseCharacter.java

/**
 *   Creates new instance of JapaneseCharacter from saved instance in given bundle.
 * //from ww  w. j ava 2  s  .c  om
 * @param bundle bundle with saved JapaneseCharacter
 * @return returns new instance of JapaneseCharacter or null if bundle is null
 */
public static JapaneseCharacter newInstanceFromBundle(Bundle bundle) {
    if (bundle == null) {
        return null;
    }
    JapaneseCharacter japaneseCharacter = new JapaneseCharacter();
    japaneseCharacter.setLiteral(bundle.getString(SAVE_CHARACTER_LITERAL));
    japaneseCharacter.setRadicalClassic(bundle.getInt(SAVE_CHARACTER_RADICAL, 0));
    japaneseCharacter.setGrade(bundle.getInt(SAVE_CHARACTER_GRADE, 0));
    japaneseCharacter.setStrokeCount(bundle.getInt(SAVE_CHARACTER_STROKE_COUNT, 0));
    japaneseCharacter.setSkip(bundle.getString(SAVE_CHARACTER_SKIP));
    japaneseCharacter.parseDicRef(bundle.getString(SAVE_CHARACTER_DIC_REF));
    japaneseCharacter.parseRmGroupJaOn(bundle.getString(SAVE_CHARACTER_JA_ON));
    japaneseCharacter.parseRmGroupJaKun(bundle.getString(SAVE_CHARACTER_JA_KUN));
    japaneseCharacter.parseMeaningEnglish(bundle.getString(SAVE_CHARACTER_ENGLISH));
    japaneseCharacter.parseMeaningFrench(bundle.getString(SAVE_CHARACTER_FRENCH));
    /*
     *  dutch, german, russian aren't in current kanjidict 2
     */
    japaneseCharacter.parseMeaningDutch(bundle.getString(SAVE_CHARACTER_DUTCH));
    japaneseCharacter.parseMeaningGerman(bundle.getString(SAVE_CHARACTER_GERMAN));
    japaneseCharacter.parseMeaningRussian(bundle.getString(SAVE_CHARACTER_RUSSIAN));
    japaneseCharacter.parseNanori(bundle.getString(SAVE_CHARACTER_NANORI));

    return japaneseCharacter.getLiteral() != null && japaneseCharacter.getLiteral().length() > 0
            ? japaneseCharacter
            : null;
}

From source file:de.kirchnerei.bicycle.battery.BatteryDetailFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle args = getArguments();
    if (args != null) {
        mId = args.getInt(BatteryDefine.PARAM_BATTERY_ID, 0);
    }/*from   ww w  .j  a v  a2 s  . c o  m*/

    mHttpManager = getBicycleApplication().getHttpManager();
    mMapper = getBicycleApplication().getMapper();
    mFormatter = getBicycleApplication().getFormatter();
}

From source file:ch.fixme.status.Widget_config.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.widget_config);
    mPrefs = PreferenceManager.getDefaultSharedPreferences(Widget_config.this);
    getDirTask = new GetDirTask();
    getDirTask.execute(ParseGeneric.API_DIRECTORY);
    Intent intent = getIntent();/*w  w  w  .  j  a  v  a2 s.  c o m*/
    Bundle extras = intent.getExtras();
    mAppWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
    findViewById(R.id.choose_ok).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Editor edit = mPrefs.edit();
            edit.putBoolean(Prefs.KEY_WIDGET_TRANSPARENCY,
                    ((CheckBox) findViewById(R.id.choose_transparency)).isChecked());
            edit.commit();
            setWidgetAlarm();
            finish();
        }
    });
    ((CheckBox) findViewById(R.id.choose_transparency))
            .setChecked(mPrefs.getBoolean(Prefs.KEY_WIDGET_TRANSPARENCY, Prefs.DEFAULT_WIDGET_TRANSPARENCY));
    ((CheckBox) findViewById(R.id.choose_text))
            .setChecked(mPrefs.getBoolean(Prefs.KEY_WIDGET_TEXT, Prefs.DEFAULT_WIDGET_TEXT));
    ((EditText) findViewById(R.id.choose_update)).addTextChangedListener(new TextWatcher() {
        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            String inter = s.toString();
            if (!"".equals(inter) && !"0".equals(inter)) {
                Editor edit = mPrefs.edit();
                edit.putString(Prefs.KEY_CHECK_INTERVAL, inter);
                edit.commit();
            }
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void afterTextChanged(Editable s) {
        }
    });
}

From source file:com.gadelkareem.serverload.ServerLoadConfig.java

@Override
public void onCreate(Bundle icicle) {

    super.onCreate(icicle);

    // Set the result to CANCELED. This will cause the widget host to cancel
    // out of the widget placement if they press the back button.
    setResult(RESULT_CANCELED);/*w  ww .ja v a2s  .  c o  m*/

    // Set the view layout resource to use.
    setContentView(R.layout.serverload_config);

    // Find the EditText
    URL_Input = (EditText) findViewById(R.id.URL);
    servername_Input = (EditText) findViewById(R.id.servername);

    // Bind the action for the save button.
    findViewById(R.id.save_button).setOnClickListener(mOnClickListener);

    // Find the widget id from the intent.
    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    if (extras != null) {
        appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
    }

    // If they gave us an intent without the widget id, just bail.
    if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
        Log.d(TAG, "Widget id is invalid");
        finish();
    }

    URL_Input.setText(loadPref(ServerLoadConfig.this, appWidgetId, "URL"));
    servername_Input.setText(loadPref(ServerLoadConfig.this, appWidgetId, "servername"));

}

From source file:de.kirchnerei.bicycle.battery.BatteryEditFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle args = getArguments();
    if (args != null) {
        mId = args.getInt(BatteryDefine.PARAM_BATTERY_ID, 0);
    }//  www .  j a  va2  s  .  co  m
    mHttpManager = getBicycleApplication().getHttpManager();
    mFormatter = getBicycleApplication().getFormatter();
    mMapper = getBicycleApplication().getMapper();

}

From source file:it.scoppelletti.mobilepower.app.HelpDialogFragment.java

/**
 * Crea il dialogo./*from  w  ww .j  a  v  a 2  s . co  m*/
 * 
 * @param  savedInstanceState Stato dell’istanza.
 * @return                    Dialogo.
 */
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    int mode, resId;
    View contentView;
    AlertDialog dlg;
    AlertDialog.Builder builder;
    LayoutInflater inflater;
    TextView textControl;
    Bundle args = getArguments();

    builder = newAlertDialogBuilder();

    resId = args.getInt(HelpDialogFragment.ARG_TITLEID, 0);
    if (resId > 0) {
        builder.setTitle(resId);
    }

    inflater = getActivity().getLayoutInflater();
    contentView = inflater.inflate(R.layout.helpdialog, null);
    builder.setView(contentView);

    builder.setIcon(android.R.drawable.ic_dialog_info);

    mode = getArguments().getInt(HelpDialogFragment.ARG_MODE, HelpDialogFragment.MODE_HELP);
    switch (mode) {
    case HelpDialogFragment.MODE_CONFIRM:
        setCancelable(false);
        builder.setCancelable(false);
        builder.setPositiveButton(R.string.cmd_proceed, this);
        builder.setNegativeButton(android.R.string.cancel, this);
        break;

    default: // HelpDialogFragment.MODE_HELP
        builder.setNeutralButton(R.string.cmd_close, null);
        break;
    }

    dlg = builder.create();

    textControl = (TextView) contentView.findViewById(R.id.txt_help);
    textControl.setKeyListener(null);

    resId = args.getInt(HelpDialogFragment.ARG_TEXTID, 0);
    if (resId > 0) {
        textControl.setText(Html.fromHtml(getResources().getString(resId)));
    }

    return dlg;
}

From source file:it.scoppelletti.mobilepower.preference.ColorPreference.java

protected void onRestoreInstanceState(Bundle savedInstanceState) {
    myValue = savedInstanceState.getInt(ColorPreference.STATE_VALUE, Color.WHITE);
}

From source file:net.reichholf.dreamdroid.activities.ScreenShotActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    super.onCreate(savedInstanceState);
    setTitle(getText(R.string.app_name) + " - " + getText(R.string.screenshot));

    mImageView = new ImageView(this);
    setContentView(mImageView);/*from  ww w  .jav  a  2 s.  c o m*/
    mImageView.setBackgroundColor(Color.BLACK);

    Bundle extras = getIntent().getExtras();

    if (extras == null) {
        extras = new Bundle();
    }

    mType = extras.getInt(KEY_TYPE, TYPE_ALL);
    mFormat = extras.getInt(KEY_FORMAT, FORMAT_PNG);
    mSize = extras.getInt(KEY_SIZE, 720);
    mFilename = extras.getString(KEY_FILENAME);

    reload();
}

From source file:android.support.v17.leanback.app.BaseRowSupportFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        mSelectedPosition = savedInstanceState.getInt(CURRENT_SELECTED_POSITION, -1);
    }/*from  ww  w . j a  va 2  s .c  om*/
    if (mBridgeAdapter != null) {
        setAdapterAndSelection();
    }
    mVerticalGridView.setOnChildViewHolderSelectedListener(mRowSelectedListener);
}

From source file:it.scoppelletti.mobilepower.preference.SeekBarPreference.java

protected void onRestoreInstanceState(Bundle savedInstanceState) {
    myValue = savedInstanceState.getInt(SeekBarPreference.STATE_VALUE, 0);
}