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) 

Source Link

Document

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

Usage

From source file:org.dvbviewer.controller.ui.fragments.StreamConfig.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = getActivity().getApplicationContext();
    DVBViewerPreferences dvbvPrefs = new DVBViewerPreferences(mContext);
    prefs = dvbvPrefs.getStreamPrefs();// w w w.ja v  a 2s. c o m
    if (savedInstanceState != null) {
        title = savedInstanceState.getInt("titleRes");
    }
    mFileId = getArguments().getInt(EXTRA_FILE_ID);
    mFileType = getArguments().getInt(EXTRA_FILE_TYPE, FILE_TYPE_LIVE);
    mStreamType = getArguments().getInt(EXTRA_FILE_TYPE, STREAM_TYPE_DIRECT);
    seekable = mFileType != FILE_TYPE_LIVE && mStreamType != STREAM_TYPE_DIRECT;
    if (seekable) {
        DVBViewerPreferences prefs = new DVBViewerPreferences(getSherlockActivity());
        preTime = String.valueOf(prefs.getPrefs().getInt(DVBViewerPreferences.KEY_TIMER_TIME_BEFORE, 0));
    }
}

From source file:fr.bde_eseo.eseomega.lacommande.OrderDetailsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_order_detail);
    toolbar = (Toolbar) findViewById(R.id.tool_bar);
    toolbar.setPadding(0, Utilities.getStatusBarHeight(this), 0, 0);
    setSupportActionBar(toolbar);/*from   w w w.j  av a2  s  .  c o  m*/
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00263238")));
    getSupportActionBar().setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#550000ff")));

    // Android setup
    context = OrderDetailsActivity.this;

    // Intent recuperation
    if (savedInstanceState == null) {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            Toast.makeText(context, "Erreur de l'application (c'est pas normal)", Toast.LENGTH_SHORT).show();
            finish();
        } else {
            idcmd = extras.getInt(Constants.KEY_ORDER_ID);
        }
    }

    // Layout
    tvOrderDate = (TextView) findViewById(R.id.tvCommandDate);
    tvOrderPrice = (TextView) findViewById(R.id.tvCommandPrice);
    tvOrderDetails = (TextView) findViewById(R.id.tvOrderDetail);
    tvOrderNumero = (TextView) findViewById(R.id.tvCommandNumero);
    tvInstruction = (TextView) findViewById(R.id.tvOrderInstructions);
    tvInstrHeader = (TextView) findViewById(R.id.tvHeaderInstructions);
    progressBar = (ProgressBar) findViewById(R.id.progressDetails);
    tvDesc = (TextView) findViewById(R.id.textView3);
    imgCategory = (ImageView) findViewById(R.id.imgOrder);
    rl1 = (RelativeLayout) findViewById(R.id.relativeLayout3);
    rl2 = (RelativeLayout) findViewById(R.id.relativeLayout5);

    progressBar.setVisibility(View.VISIBLE);
    tvOrderDate.setVisibility(View.INVISIBLE);
    tvOrderPrice.setVisibility(View.INVISIBLE);
    tvOrderDetails.setVisibility(View.INVISIBLE);
    tvOrderNumero.setVisibility(View.INVISIBLE);
    tvDesc.setVisibility(View.INVISIBLE);
    imgCategory.setVisibility(View.INVISIBLE);
    rl1.setVisibility(View.INVISIBLE);
    rl2.setVisibility(View.INVISIBLE);

    // profile
    profile = new UserProfile();
    profile.readProfilePromPrefs(context);

    // Save old brightness level and set it now to 100%
    WindowManager.LayoutParams layout = getWindow().getAttributes();
    oldScreenBrightness = layout.screenBrightness;
    layout.screenBrightness = 1F;
    getWindow().setAttributes(layout);

    // Couleurs
    circle_preparing = context.getResources().getColor(R.color.circle_preparing);
    blue_light = context.getResources().getColor(R.color.blue_light);
    circle_done = context.getResources().getColor(R.color.circle_done);
    gray_light = context.getResources().getColor(R.color.gray_light);
    circle_ready = context.getResources().getColor(R.color.circle_ready);
    green_light = context.getResources().getColor(R.color.green_light);
    circle_error = context.getResources().getColor(R.color.circle_error);
    orange_light = context.getResources().getColor(R.color.orange_light);
}

From source file:com.anstar.fieldwork.CaptureSignatureFragment.java

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

    Bundle b = getArguments();
    if (b != null) {
        if (b.containsKey("cutomer")) {
            signtype = b.getString("cutomer");
        }// w w w .j  av a2 s  . c o  m
        if (b.containsKey("tech")) {
            signtype = b.getString("tech");
        }
        if (b.containsKey(Const.Appointment_Id)) {
            a_id = b.getInt(Const.Appointment_Id);
        }
    }
    m_points = new ArrayList<>();
    appointment_info = AppointmentModelList.Instance().getAppointmentById(a_id);
}

From source file:com.anstar.fieldwork.CaptureSignatureActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.capture_siganture);

    ActionBar action = getSupportActionBar();
    action = getSupportActionBar();//from w  w w.  j a v  a2 s.  c o m
    // action.setTitle("Signature");
    action.setTitle(Html
            .fromHtml("<font color='" + getString(R.string.header_text_color) + "'>Capture Signature</font>"));
    action.setHomeButtonEnabled(true);
    action.setDisplayHomeAsUpEnabled(true);

    Bundle b = getIntent().getExtras();
    if (b != null) {
        if (b.containsKey("cutomer")) {
            signtype = b.getString("cutomer");
        }
        if (b.containsKey("tech")) {
            signtype = b.getString("tech");
        }
        if (b.containsKey(Const.Appointment_Id)) {
            a_id = b.getInt(Const.Appointment_Id);
        }
    }
    appointment_info = AppointmentModelList.Instance().getAppointmentById(a_id);
    llSignCanvas = (LinearLayout) findViewById(R.id.llSignCanvas);
    txtSignType = (TextView) findViewById(R.id.txtSignatureType);
    txtSignName = (TextView) findViewById(R.id.txtSignName);
    txtLicInfo = (TextView) findViewById(R.id.txtSignLic);
    btnCancel = (Button) findViewById(R.id.btnCancel);
    btnClear = (Button) findViewById(R.id.btnClear);
    btnSave = (Button) findViewById(R.id.btnSave);
    m_points = new ArrayList<SignaturePoints>();
    loadView load = new loadView();
    load.execute();
    btnCancel.setOnClickListener(this);
    btnClear.setOnClickListener(this);
    btnSave.setOnClickListener(this);
}

From source file:com.sweetiepiggy.raspberrybusmalaysia.SubmitTripActivity.java

private void restore_saved_state(Bundle savedInstanceState) {
    int year = savedInstanceState.getInt("sched_year");
    int month = savedInstanceState.getInt("sched_month");
    int day = savedInstanceState.getInt("sched_day");
    int hour = savedInstanceState.getInt("sched_hour");
    int minute = savedInstanceState.getInt("sched_minute");
    mData.sched_time.set(year, month, day, hour, minute);

    year = savedInstanceState.getInt("depart_year");
    month = savedInstanceState.getInt("depart_month");
    day = savedInstanceState.getInt("depart_day");
    hour = savedInstanceState.getInt("depart_hour");
    minute = savedInstanceState.getInt("depart_minute");
    mData.depart_time.set(year, month, day, hour, minute);

    year = savedInstanceState.getInt("arrival_year");
    month = savedInstanceState.getInt("arrival_month");
    day = savedInstanceState.getInt("arrival_day");
    hour = savedInstanceState.getInt("arrival_hour");
    minute = savedInstanceState.getInt("arrival_minute");
    mData.arrival_time.set(year, month, day, hour, minute);
}

From source file:com.sunho.nating.fragments.DetailPlaceFragment.java

/**
 * Bind the views inside of parent with the fragment arguments.
 *
 * @param parent The parent of views to bind.
 *//*  w ww . j  a va2s  .  c om*/
private void bind(View parent) {
    Bundle args = getArguments();
    if (args == null) {
        return;
    }
    ImageView image = (ImageView) parent.findViewById(R.id.image);
    image.setImageResource(args.getInt(ARG_RESOURCE_ID));
    TextView title = (TextView) parent.findViewById(R.id.title);
    title.setText(args.getString(ARG_TITLE));

}

From source file:com.yschi.castscreen.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    if (savedInstanceState != null) {
        mResultCode = savedInstanceState.getInt(STATE_RESULT_CODE);
        mResultData = savedInstanceState.getParcelable(STATE_RESULT_DATA);
    }/*from w w  w . jav a2 s. com*/

    mContext = this;
    mMediaProjectionManager = (MediaProjectionManager) getSystemService(Context.MEDIA_PROJECTION_SERVICE);

    mDiscoverdMap = new HashMap<>();
    mDiscoverListView = (ListView) findViewById(R.id.discover_listview);
    mDiscoverAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1);
    mDiscoverAdapter.addAll(mDiscoverdMap.keySet());
    mDiscoverListView.setAdapter(mDiscoverAdapter);
    mDiscoverListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            String name = mDiscoverAdapter.getItem(i);
            String ip = mDiscoverdMap.get(name);
            Log.d(TAG, "Select receiver name: " + name + ", ip: " + ip);
            mReceiverIp = ip;
            updateReceiverStatus();
            mContext.getSharedPreferences(PREF_COMMON, 0).edit().putString(PREF_KEY_RECEIVER, mReceiverIp)
                    .commit();
        }
    });

    // add server mode option
    mDiscoverAdapter.add(mContext.getString(R.string.server_mode));
    mDiscoverdMap.put(mContext.getString(R.string.server_mode), "");

    mReceiverTextView = (TextView) findViewById(R.id.receiver_textview);
    final EditText ipEditText = (EditText) findViewById(R.id.ip_edittext);
    final Button selectButton = (Button) findViewById(R.id.select_button);
    selectButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (ipEditText.getText().length() > 0) {
                mReceiverIp = ipEditText.getText().toString();
                Log.d(TAG, "Using ip: " + mReceiverIp);
                updateReceiverStatus();
                mContext.getSharedPreferences(PREF_COMMON, 0).edit()
                        .putString(PREF_KEY_INPUT_RECEIVER, mReceiverIp).commit();
                mContext.getSharedPreferences(PREF_COMMON, 0).edit().putString(PREF_KEY_RECEIVER, mReceiverIp)
                        .commit();
            }
        }
    });
    ipEditText.setText(mContext.getSharedPreferences(PREF_COMMON, 0).getString(PREF_KEY_INPUT_RECEIVER, ""));

    Spinner formatSpinner = (Spinner) findViewById(R.id.format_spinner);
    ArrayAdapter<CharSequence> formatAdapter = ArrayAdapter.createFromResource(this, R.array.format_options,
            android.R.layout.simple_spinner_item);
    formatAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    formatSpinner.setAdapter(formatAdapter);
    formatSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            mSelectedFormat = FORMAT_OPTIONS[i];
            mContext.getSharedPreferences(PREF_COMMON, 0).edit().putInt(PREF_KEY_FORMAT, i).commit();
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {
            mSelectedFormat = FORMAT_OPTIONS[0];
            mContext.getSharedPreferences(PREF_COMMON, 0).edit().putInt(PREF_KEY_FORMAT, 0).commit();
        }
    });
    formatSpinner.setSelection(mContext.getSharedPreferences(PREF_COMMON, 0).getInt(PREF_KEY_FORMAT, 0));

    Spinner resolutionSpinner = (Spinner) findViewById(R.id.resolution_spinner);
    ArrayAdapter<CharSequence> resolutionAdapter = ArrayAdapter.createFromResource(this,
            R.array.resolution_options, android.R.layout.simple_spinner_item);
    resolutionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    resolutionSpinner.setAdapter(resolutionAdapter);
    resolutionSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            mSelectedWidth = RESOLUTION_OPTIONS[i][0];
            mSelectedHeight = RESOLUTION_OPTIONS[i][1];
            mSelectedDpi = RESOLUTION_OPTIONS[i][2];
            mContext.getSharedPreferences(PREF_COMMON, 0).edit().putInt(PREF_KEY_RESOLUTION, i).commit();
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {
            mSelectedWidth = RESOLUTION_OPTIONS[0][0];
            mSelectedHeight = RESOLUTION_OPTIONS[0][1];
            mSelectedDpi = RESOLUTION_OPTIONS[0][2];
            mContext.getSharedPreferences(PREF_COMMON, 0).edit().putInt(PREF_KEY_RESOLUTION, 0).commit();
        }
    });
    resolutionSpinner
            .setSelection(mContext.getSharedPreferences(PREF_COMMON, 0).getInt(PREF_KEY_RESOLUTION, 0));

    Spinner bitrateSpinner = (Spinner) findViewById(R.id.bitrate_spinner);
    ArrayAdapter<CharSequence> bitrateAdapter = ArrayAdapter.createFromResource(this, R.array.bitrate_options,
            android.R.layout.simple_spinner_item);
    bitrateAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    bitrateSpinner.setAdapter(bitrateAdapter);
    bitrateSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            mSelectedBitrate = BITRATE_OPTIONS[i];
            mContext.getSharedPreferences(PREF_COMMON, 0).edit().putInt(PREF_KEY_BITRATE, i).commit();
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {
            mSelectedBitrate = BITRATE_OPTIONS[0];
            mContext.getSharedPreferences(PREF_COMMON, 0).edit().putInt(PREF_KEY_BITRATE, 0).commit();
        }
    });
    bitrateSpinner.setSelection(mContext.getSharedPreferences(PREF_COMMON, 0).getInt(PREF_KEY_BITRATE, 0));

    mReceiverIp = mContext.getSharedPreferences(PREF_COMMON, 0).getString(PREF_KEY_RECEIVER, "");
    updateReceiverStatus();
    startService();
}

From source file:com.spoiledmilk.cykelsuperstier.break_rote.BreakRouteActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_break_route);
    textTitle = (TextView) findViewById(R.id.textTitle);
    textDistance = (TextView) findViewById(R.id.textDistance);
    textDistanceKm = (TextView) findViewById(R.id.textDistanceKm);
    btnBreak = (TexturedButton) findViewById(R.id.btnBreak);
    btnBreak.setBackgroundResource(R.drawable.btn_blue_selector);
    btnBreak.setTextureResource(R.drawable.btn_pattern_repeteable);
    btnBreak.setTextColor(Color.WHITE);
    btnBreak.setTextSize(getResources().getDimension(R.dimen.btn_break_text_size));
    textAAddress = (TextView) findViewById(R.id.textAAddress);
    textBAddress = (TextView) findViewById(R.id.textBAddress);
    btnRejseplanen = (Button) findViewById(R.id.btnRejseplanen);
    textARegion = (TextView) findViewById(R.id.textARegion);
    textBRegion = (TextView) findViewById(R.id.textBRegion);
    textDistance1 = (TextView) findViewById(R.id.textDistance1);
    textDistance2 = (TextView) findViewById(R.id.textDistance2);
    spinner1 = (Spinner) findViewById(R.id.spinner1);
    spinner2 = (Spinner) findViewById(R.id.spinner2);
    Bundle data = getIntent().getExtras();
    if (data != null) {
        source = data.getString("source");
        destination = data.getString("destination");
        distance = data.getInt("distance");
        startLoc = Util.locationFromCoordinates(data.getDouble("start_lat"), data.getDouble("start_lon"));
        endLoc = Util.locationFromCoordinates(data.getDouble("end_lat"), data.getDouble("end_lon"));
    }/*from   w  ww.jav  a  2 s. c  om*/

    findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
    parseStationsFromJson();
    ArrayList<String> stations = sortAndGetStationStrings();
    IssuesAdapter dataAdapter = new IssuesAdapter(this, stations, R.layout.list_row_stations,
            R.layout.spinner_layout);
    spinner1.setAdapter(dataAdapter);
    if (sortedStations.size() > 0) {
        selectedStationA = sortedStations.get(0);
    } else {
        showRouteNoBreakDialog();
    }

    spinner1.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
            aDistance = -1;
            findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
            selectedStationA = sortedStations.get(position);
            if (metroStations.contains(selectedStationA)) {
                ((ImageView) findViewById(R.id.imgStation1)).setImageResource(R.drawable.metro_logo_pin);
                ((ImageView) findViewById(R.id.imgStation2)).setImageResource(R.drawable.metro_logo_pin);
                iconId = R.drawable.metro_logo_pin;
                setBikeDistance(selectedStationA, metroStations);
            } else if (localTrainStations.contains(selectedStationA)) {
                ((ImageView) findViewById(R.id.imgStation1)).setImageResource(R.drawable.local_train_icon_blue);
                ((ImageView) findViewById(R.id.imgStation2)).setImageResource(R.drawable.local_train_icon_blue);
                iconId = R.drawable.local_train_icon_blue;
                setBikeDistance(selectedStationA, localTrainStations);
            } else {
                ((ImageView) findViewById(R.id.imgStation1)).setImageResource(R.drawable.list_subway_icon);
                ((ImageView) findViewById(R.id.imgStation2)).setImageResource(R.drawable.list_subway_icon);
                iconId = R.drawable.list_subway_icon;
                setBikeDistance(selectedStationA, sTrainStations);
            }

            IssuesAdapter dataAdapterB = new IssuesAdapter(BreakRouteActivity.this,
                    selectedStationA.getBStationsString(), R.layout.list_row_stations, R.layout.spinner_layout);
            spinner2.setAdapter(dataAdapterB);

            if (selectedStationA.BStations == null || selectedStationA.BStations.size() == 0)
                showRouteNoBreakDialog();
            else {
                selectedStationB = selectedStationA.BStations.get(0);
                new SMHttpRequest().getRoute(selectedStationA.loc, startLoc, null, BreakRouteActivity.this);

            }

        }

        @Override
        public void onNothingSelected(AdapterView<?> parentView) {
            // your code here
        }
    });
    spinner2.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
            if (selectedStationA.BStations == null || selectedStationA.BStations.size() == 0)
                showRouteNoBreakDialog();
            else {
                selectedStationB = selectedStationA.BStations.get(position);
                // aDistance = -1;
                findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
                new SMHttpRequest().getRoute(selectedStationB.loc, endLoc, null, BreakRouteActivity.this);
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> parentView) {
            // your code here
        }

    });
}

From source file:com.lepin.activity.MyOrderDetailActivity.java

/**
 * ?//w  w w.  j a v  a2  s  . c  om
 */
private void initView() {
    final Bundle bundle = getIntent().getExtras();
    this.book_id = bundle.getString(Constant.BOOK_ID);
    this.mStartLat = bundle.getInt(Constant.START_LAT);
    this.mStartLon = bundle.getInt(Constant.START_LON);
    this.mEndLat = bundle.getInt(Constant.END_LAT);
    this.mEndLon = bundle.getInt(Constant.END_LON);
    isShowCalendar = bundle.getBoolean(Constant.SHOW_CALENDAR);
    Util.printLog("bookId:" + book_id);
    this.tvTitle.setText(getResources().getString(R.string.order_details_title));// ?title
    this.btnBack.setOnClickListener(this);
    this.btnShare.setOnClickListener(this);
    this.mPhoneButton.setOnClickListener(this);
    this.mCancleDriverBtn.setOnClickListener(this);
    mTwoCancelBtn.setOnClickListener(this);
    mTwoPayOrInBtn.setOnClickListener(this);
    mapImageView.setOnClickListener(this);
    mPhotoView.setOnClickListener(this);
}