Example usage for android.os Bundle putInt

List of usage examples for android.os Bundle putInt

Introduction

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

Prototype

public void putInt(@Nullable String key, int value) 

Source Link

Document

Inserts an int value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:com.brodev.socialapp.view.VideoPlay.java

/** Called when the activity is first created. */
@Override//from  w ww  .  j  ava2 s .  c om
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.video_player);

    if (android.os.Build.VERSION.SDK_INT > 9) {
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
    }

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    user = (User) getApplication().getApplicationContext();
    phraseManager = new PhraseManager(getApplicationContext());
    colorView = new ColorView(getApplicationContext());

    Bundle bundle = getIntent().getExtras();

    video = (Video) bundle.get("video");
    getSupportActionBar().setTitle(phraseManager.getPhrase(getApplicationContext(), "video.video"));
    if (video.getTime_stamp().equals("0")) {
        this.getVideoAdapter();
    }

    initView();
    // get comment fragment
    Bundle comment = new Bundle();
    comment.putString("type", "video");
    comment.putInt("itemId", video.getVideo_id());
    comment.putInt("totalComment", video.getTotal_comment());
    comment.putInt("total_like", video.getTotal_like());
    comment.putBoolean("is_liked", video.getIs_like());
    comment.putBoolean("can_post_comment", video.getCan_post_comment());
    CommentFragment commentFragment = new CommentFragment();
    commentFragment.setArguments(comment);
    getSupportFragmentManager().beginTransaction().add(R.id.commentfragment_wrap, commentFragment).commit();

}

From source file:com.blueverdi.rosietheriveter.PhotoViewActivity.java

@Override
public void onSaveInstanceState(Bundle out) {
    super.onSaveInstanceState(out);
    out.putInt(INDEX, index);
}

From source file:com.nextgis.uikobserver.HttpSendData.java

@Override
protected void onPostExecute(Void unused) {
    super.onPostExecute(unused);
    if (mbShowProgress) {
        mDownloadDialog.dismiss();/*from   w ww  . j av a2  s  .  co m*/
    }
    if (mError != null) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("error", true);
        bundle.putString("err_msq", mError);
        bundle.putInt("src", mnType);

        Message msg = new Message();
        msg.setData(bundle);
        if (mEventReceiver != null) {
            mEventReceiver.sendMessage(msg);
        }
    } else {
        //Toast.makeText(FireReporter.this, "Source: " + Content, Toast.LENGTH_LONG).show();
    }
}

From source file:io.v.android.apps.syncslides.NavigationDrawerFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition);
}

From source file:eu.thecoder4.gpl.pleftdroid.EditEventActivity.java

/** Called when the activity is first created. */
@Override//from  ww w. j a  v a  2 s  .  c  om
public void onCreate(Bundle savedInstanceState) {
    if (AppPreferences.INSTANCE.getUsePleftTheme()) {
        setTheme(R.style.Theme_Pleft);
    }

    super.onCreate(savedInstanceState);
    // Initialiazations
    mTHISEVENT = this;
    mDates = new ArrayList<PDate>();
    mEmails = new ArrayList<String>();
    // The View
    setContentView(R.layout.edit_event);
    // Add Invitee Button
    ((Button) findViewById(R.id.addinvitee)).setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            Intent iai = new Intent(mTHISEVENT, SelectContactsActivity.class);
            startActivityForResult(iai, ACT_INVITEE);
        }
    });

    // Add Date Button
    ((Button) findViewById(R.id.adddate)).setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            Intent iad = new Intent(mTHISEVENT, PickDateDialogActivity.class);
            // This would not work: you need a Parcelable
            //iad.putExtra(PickDateDialogActivity.DTLIST, mDates);
            iad.putParcelableArrayListExtra(PickDateDialogActivity.DTLIST, mDates);
            startActivityForResult(iad, ACT_ADDDATE);
        }
    });

    // Send Invitations Button
    ((Button) findViewById(R.id.sendinvite)).setOnClickListener(new OnClickListener() {
        private int SC;

        @SuppressWarnings("static-access")
        public void onClick(View v) {
            String desc = ((EditText) findViewById(R.id.edescription)).getText().toString();
            String invitees = ((EditText) findViewById(R.id.einvitees)).getText().toString();
            String dates = getPleftDates();//"2011-06-23T21:00:00\n2011-06-24T21:00:00\n2011-06-25T21:00:00";
            boolean proposemore = ((CheckBox) findViewById(R.id.mayproposedate)).isChecked();
            if (desc == null || desc.length() == 0 || invitees == null || invitees.length() == 0
                    || dates == null || dates.length() == 0) {
                Toast.makeText(EditEventActivity.this, R.string.event_completeform, Toast.LENGTH_LONG).show();
            } else {
                // Get Preferences

                //Toast.makeText(EditEventActivity.this, "invitees: "+invitees+"\nDesc="+desc+"\npserver="+pserver, Toast.LENGTH_LONG).show();

                SC = PleftBroker.INSTANCE.createAppointment(desc, invitees, dates,
                        AppPreferences.INSTANCE.getPleftServer().trim(), //pserver,
                        AppPreferences.INSTANCE.getName().trim(), //uname,
                        AppPreferences.INSTANCE.getEmail().trim(), //uemail,
                        proposemore);

                if (SC == HttpStatus.SC_OK) {
                    PleftDroidDbAdapter mDbAdapter = new PleftDroidDbAdapter(EditEventActivity.this);
                    mDbAdapter.open();
                    mDbAdapter.createAppointmentAsInvitor(0, desc,
                            AppPreferences.INSTANCE.getPleftServer().trim(),
                            AppPreferences.INSTANCE.getEmail().trim());
                    mDbAdapter.close();
                }

                Bundle bundle = new Bundle();
                bundle.putInt(PleftDroidActivity.SC_CREATE, SC);

                Intent i = new Intent();
                i.putExtras(bundle);
                setResult(RESULT_OK, i);
                // Close activity
                finish();
            }
        }

    });

}

From source file:com.prey.json.actions.Geofencing.java

public void start(Context ctx, List<ActionResult> lista, JSONObject parameters) {

    try {/* www .j  a v  a2s  .  c o  m*/

        String origin = parameters.getString("origin");
        String[] centralPoints = origin.split(",");
        String longitude = centralPoints[0];
        String latitude = centralPoints[1];
        String radius = parameters.getString("radius");

        Bundle bundle = new Bundle();
        bundle.putDouble("longitude", Double.parseDouble(longitude));
        bundle.putDouble("latitude", Double.parseDouble(latitude));
        bundle.putFloat("radius", Float.parseFloat(radius));
        bundle.putInt("type", ProxAlertActivity.START);

        Intent popup = new Intent(ctx, ProxAlertActivity.class);
        popup.putExtras(bundle);
        popup.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        ctx.startActivity(popup);

        PreyLogger.i("Finish Geofencing start");

    } catch (JSONException e) {
        PreyLogger.e("Error en json:" + e.getMessage(), e);
        PreyWebServices.getInstance().sendNotifyActionResultPreyHttp(ctx,
                UtilJson.makeMapParam("start", "geofence", "failed", e.getMessage()));
    }

}

From source file:com.googlecode.android_scripting.facade.CameraFacade.java

@Rpc(description = "Take a picture and save it to the specified path.", returns = "A map of Booleans autoFocus and takePicture where True "
        + "indicates success. cameraId also included.")
public Bundle cameraCapturePicture(@RpcParameter(name = "targetPath") final String targetPath,
        @RpcParameter(name = "useAutoFocus") @RpcDefault("true") Boolean useAutoFocus,
        @RpcParameter(name = "cameraId", description = "Id of camera to use. SDK 9") @RpcDefault("0") Integer cameraId)
        throws Exception {
    final BooleanResult autoFocusResult = new BooleanResult();
    final BooleanResult takePictureResult = new BooleanResult();
    Camera camera = openCamera(cameraId);
    if (camera == null) {
        String msg = String.format("can't initialize camera id %d, try to use another id", cameraId);
        Log.e(msg);/*from  w  w  w.java 2  s.c  om*/

        Bundle result = new Bundle();
        result.putInt("cameraId", cameraId);
        result.putBoolean("autoFocus", false);
        result.putBoolean("takePicture", false);
        result.putString("reason", msg + ", see logcat for details");
        return result;
    }
    Parameters prm = camera.getParameters();
    camera.setParameters(prm);

    try {
        Method method = camera.getClass().getMethod("setDisplayOrientation", int.class);
        method.invoke(camera, 90);
    } catch (Exception e) {
        Log.e(e);
    }

    try {
        FutureActivityTask<SurfaceHolder> previewTask = setPreviewDisplay(camera);
        camera.startPreview();
        if (useAutoFocus) {
            autoFocus(autoFocusResult, camera);
        }
        takePicture(new File(targetPath), takePictureResult, camera);
        previewTask.finish();
    } catch (Exception e) {
        Log.e(e);
    } finally {
        camera.release();
    }

    Bundle result = new Bundle();
    result.putBoolean("autoFocus", autoFocusResult.mmResult);
    result.putBoolean("takePicture", takePictureResult.mmResult);
    result.putInt("cameraId", cameraId);
    return result;
}

From source file:com.autoparts.buyers.activity.InquiryModelActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.putInt(STATE_URI, currentState);
    outState.putString(STATE_FRAGMENT_TAG, currentContentFragmentTag);

    super.onSaveInstanceState(outState);
}

From source file:com.chess.genesis.net.GenesisNotifier.java

private void SendNotification(final int id, final String text) {
    final Intent intent;
    if (Pref.getBool(this, R.array.pf_tabletMode)) {
        intent = new Intent(this, MainMenuTablet.class);

        final Bundle bundle = new Bundle();
        bundle.putInt("loadFrag", Enums.ONLINE_LIST);
        intent.putExtras(bundle);//  w w  w  .  j ava  2  s .c  o  m
    } else {
        intent = new Intent(this, GameListOnline.class);
    }

    final PendingIntent pintent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    final Notification note = createNotification(id, text, pintent);

    nm.notify(id, note);
}

From source file:com.dahl.brendan.wordsearch.model.HighScore.java

public Bundle toBundle() {
    Bundle bundle = new Bundle();
    bundle.putLong(Constants.KEY_HIGH_SCORE_TIME, time);
    bundle.putInt(Constants.KEY_HIGH_SCORE_SIZE, size);
    bundle.putString(Constants.KEY_HIGH_SCORE_THEME, theme);
    bundle.putInt(Constants.KEY_WORD_COUNT, wordCount);
    bundle.putString(Constants.KEY_HIGH_SCORE_NAME, name);
    bundle.putInt(Constants.KEY_GLOBAL_RANK, globalRank);
    bundle.putBoolean(Constants.KEY_GLOBAL_HIGH_SCORE, globalHighScore);
    bundle.putInt(Constants.KEY_RANK, rank);
    bundle.putLong(Constants.KEY_HIGH_SCORE, getScore());
    return bundle;
}