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:com.jbsoft.farmtotable.FarmToTableActivity.java

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

    getSupportActionBar().setSelectedNavigationItem(savedInstanceState.getInt(STATE_NAV));
}

From source file:com.irccloud.android.fragment.BufferOptionsFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Context ctx = getActivity();//from  w  ww.  j  a  v  a2 s.c  o m
    if (ctx == null)
        return null;
    LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View v = inflater.inflate(R.layout.dialog_buffer_options, null);
    unread = (SwitchCompat) v.findViewById(R.id.unread);
    joinpart = (SwitchCompat) v.findViewById(R.id.joinpart);
    collapse = (SwitchCompat) v.findViewById(R.id.collapse);
    expandDisco = (SwitchCompat) v.findViewById(R.id.expandDisco);

    if (savedInstanceState != null && bid == -1 && savedInstanceState.containsKey("bid")) {
        bid = savedInstanceState.getInt("bid");
        cid = savedInstanceState.getInt("cid");
        type = savedInstanceState.getString("type");
    }

    if (type != null && type.equalsIgnoreCase("console")) {
        joinpart.setVisibility(View.GONE);
        collapse.setVisibility(View.GONE);
    } else {
        expandDisco.setVisibility(View.GONE);
    }

    return new AlertDialog.Builder(ctx)
            .setInverseBackgroundForced(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB)
            .setTitle("Display Options").setView(v).setPositiveButton("Save", new SaveClickListener())
            .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).create();
}

From source file:com.nextgis.maplibui.activity.ModifyAttributesActivity.java

protected void createView(final IGISApplication app, Bundle savedState) {
    //create and fill controls
    Bundle extras = getIntent().getExtras();

    if (extras != null) {
        int layerId = extras.getInt(KEY_LAYER_ID);
        MapBase map = app.getMap();/* w  w w  .j  ava  2  s .  c  o  m*/
        mLayer = (VectorLayer) map.getLayerById(layerId);

        if (null != mLayer) {
            mSharedPreferences = mLayer.getPreferences();

            mFields = new HashMap<>();
            mFeatureId = extras.getLong(KEY_FEATURE_ID);
            mIsViewOnly = extras.getBoolean(KEY_VIEW_ONLY, false);
            mIsGeometryChanged = extras.getBoolean(KEY_GEOMETRY_CHANGED, true);
            mGeometry = (GeoGeometry) extras.getSerializable(KEY_GEOMETRY);
            LinearLayout layout = (LinearLayout) findViewById(R.id.controls_list);
            fillControls(layout, savedState);
        } else {
            Toast.makeText(this, R.string.error_layer_not_inited, Toast.LENGTH_SHORT).show();
            finish();
        }
    }
}

From source file:no.olav.samples.facedetect.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    enableDebugLog(ENABLE_DEBUG, TAG);/*from w w w  .  j a v  a  2  s.c  om*/
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    //initialize database for saving events and timestamp
    datasource = new CommentsDataSource(this);
    datasource.open();

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        String datas = extras.getString("EXTRA_ID");
        int mScore2 = extras.getInt("Game_Score");
        int mScore = extras.getInt("Tot_Game_Score");
        mode = extras.getString("game_mode");
        timeExpired = extras.getInt("time_expired");

        Log.i("Score", "Put String MainAct time long  " + datas);
        Log.i("Score", "Put int MainAct score   " + mScore);
        Log.i("Score", "TotGameScore MainAct   " + mScore);
        Log.i("Score", " gameMode MainAct   " + mode);
        Log.i("Score", "time expired   " + timeExpired);

        int requestedScore = 1;
        if (mode != null) {
            Log.i("Score", "AfterPut String MainAct time long  " + datas);
            Log.i("Score", "afterPut int MainAct score   " + mScore);
            Log.i("Score", "afterTotGameScore MainAct   " + mScore);
            Log.i("Score", "after gameMode MainAct   " + mode);
            Log.i("Score", "aftertime expired   " + timeExpired);

            //TODO send in putExtra form easy or hard
            mHardMode = false;

            // check for achievements
            checkForAchievements(requestedScore, mScore);

            //update leaderboards
            updateLeaderboards(mScore, timeExpired);

            // push those accomplishments to the cloud, if signed in
            pushAccomplishments();
        }
    }

    // create fragments
    mMainMenuFragment = new MainMenuFragment();
    mGameplayFragment = new GameplayFragment();
    mWinFragment = new WinFragment();

    // listen to fragment events
    mMainMenuFragment.setListener(this);
    mGameplayFragment.setListener(this);
    mWinFragment.setListener(this);

    // add initial fragment (welcome fragment)
    getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, mMainMenuFragment).commit();

    // IMPORTANT: if this Activity supported rotation, we'd have to be
    // more careful about adding the fragment, since the fragment would
    // already be there after rotation and trying to add it again would
    // result in overlapping fragments. But since we don't support rotation,
    // we don't deal with that for code simplicity.

    // load outbox from file
    mOutbox.loadLocal(this);
}

From source file:de.fahrgemeinschaft.RideDetailsFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);//from  w w w  .j  a va 2 s .  c  o m
    queue = Volley.newRequestQueue(getActivity());
    imageLoader = new ImageLoader(queue, ProfileRequest.imageCache);
    queue.start();
    if (savedInstanceState != null) {
        selected = savedInstanceState.getInt(SELECTED);
    }
}

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

private void bindFragment(View parent) {
    Bundle args = getArguments();
    if (args == null) {
        return;//from   w  ww .  j  a  v a2s .co  m
    }

    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));
    listView = (ListView) parent.findViewById(R.id.list);

    sp1 = (Spinner) parent.findViewById(R.id.spinner1);
    sp2 = (Spinner) parent.findViewById(R.id.spinner2);
    sp3 = (Spinner) parent.findViewById(R.id.spinner3);

    final String[] sp1_data = getResources().getStringArray(R.array.areaCode_1);
    ArrayAdapter<String> sp1_adapter = new ArrayAdapter<String>(context,
            android.R.layout.simple_spinner_dropdown_item, sp1_data);
    sp1.setAdapter(sp1_adapter);

    //First Adapter
    firstPosition = 0;

    final String[] sp2_data = getResources().getStringArray(R.array.sigunguCode_1);
    ArrayAdapter<String> sp2_adapter = new ArrayAdapter<String>(context,
            android.R.layout.simple_spinner_dropdown_item, sp2_data);
    sp2.setAdapter(sp2_adapter);
    sp2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            secondePosition = position;
            switch (position) {
            case 0:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_1);
                break;
            case 1:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_2);
                break;
            case 2:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_3);
                break;
            case 3:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_4);
                break;
            case 4:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_5);
                break;
            case 5:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_6);
                break;
            case 6:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_7);
                break;
            case 7:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_8);
                break;
            case 8:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_9);
                break;
            case 9:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_10);
                break;
            case 10:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_11);
                break;
            case 11:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_12);
                break;
            case 12:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_13);
                break;
            case 13:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_14);
                break;
            case 14:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_15);
                break;
            case 15:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_16);
                break;
            case 16:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_17);
                break;
            case 17:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_18);
                break;
            case 18:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_19);
                break;
            case 19:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_20);
                break;
            case 20:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_21);
                break;
            case 21:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_22);
                break;
            case 22:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_23);
                break;
            case 23:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_24);
                break;
            case 24:
                sp3_data = getResources().getStringArray(R.array.dongCode_1_25);
                break;

            default:
                break;
            }

            ArrayAdapter<String> sp3_adapter = new ArrayAdapter<String>(context,
                    android.R.layout.simple_spinner_dropdown_item, sp3_data);
            sp3.setAdapter(sp3_adapter);
            sp3.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                @Override
                public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

                    result = sp2_data[secondePosition] + " " + sp3_data[position];
                    Log.d("Theme", "Selected Location : " + result);
                    totalURL = makeURL(1, result);
                    placeList.clear();
                    pageCount = 1;
                    adapter.isEndFalse();
                    adapter.resetServerListSize(0);
                    adapter.notifyDataSetChanged();
                    new GetDataTask().execute();
                }

                @Override
                public void onNothingSelected(AdapterView<?> parent) {

                }
            });

        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });
    listView.setDividerHeight(0);
    adapter = new CustomListAdapter(MainActivity.mActivity, placeList) {
        @Override
        public View getDataRow(int position, View convertView, ViewGroup parent) {
            return convertView;
        }
    };
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Toast.makeText(MainActivity.mContext, placeList.get(position).getOldAddress(), 0).show();
            moveFragment(position);
        }
    });
    listView.setOnScrollListener(new EndlessScrollListener() {
        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            super.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
            //lastListitem = (totalItemCount - 1 > 0) && (firstVisibleItem + visibleItemCount >= totalItemCount - 1);
        }

        @Override
        public void onLoadMore(int page, int totalItemsCount) {
            // Triggered only when new data needs to be appended to the list
            // Add whatever code is needed to append new items to your AdapterView

            Log.d(TAG, "==ListView Information==");
            Log.d(TAG, "PageNumber : " + page);
            Log.d(TAG, "TotalCount : " + totalItemsCount);
            Log.d(TAG, "adpaterCount : " + adapter.getCount());
            Log.d(TAG, "========================");
            new GetDataTask().execute();

        }
    });
}

From source file:org.rapidandroid.activity.FormReviewer.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setTitle(getString(R.string.app_name) + " :: Review Form");
    setContentView(R.layout.form_edit);//from  w ww.  jav  a2s  . co  m

    Bundle extras = getIntent().getExtras();
    if (extras != null) {

        if (!extras.containsKey(CallParams.REVIEW_FORM)) {
            throw new IllegalArgumentException("Error, activity was called without a Form ID to review.");
        }
        int formID = extras.getInt(CallParams.REVIEW_FORM);
        mForm = ModelTranslator.getFormById(formID);

        TextView txv_formname = (TextView) findViewById(R.id.txv_formname);
        TextView txv_prefix = (TextView) findViewById(R.id.txv_formprefix);
        TextView txv_description = (TextView) findViewById(R.id.txv_description);
        TextView txv_parsertype = (TextView) findViewById(R.id.txv_parsertype);
        ListView lsv_fields = (ListView) findViewById(R.id.lsv_fields);

        txv_formname.setText(mForm.getFormName());
        txv_prefix.setText(mForm.getPrefix());
        txv_description.setText(mForm.getDescription());
        txv_parsertype.setText(mForm.getParserType().toString());
        //         int len = mForm.getFields().length;

        // lsv_fields.setAdapter(new ArrayAdapter<String>(this,
        // android.R.layout.simple_list_item_1, fields));
        ArrayList<Field> fields = new ArrayList<Field>();
        Field[] f = mForm.getFields();
        for (Field ff : f) {
            fields.add(ff);
        }
        lsv_fields.setAdapter(new FieldViewAdapter(this, fields));

    }
}

From source file:com.best.ui.Otpdescdetail.java

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

    if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.DONUT)
        TransitionEffect.callOverridePendingTransition(this);

    me = this;/*ww w  . j ava  2 s.co m*/
    m_context = this;
    me.setContentView(com.best.ui.R.layout.routing);
    mInflater = LayoutInflater.from(m_context);

    Bundle bundle = getIntent().getExtras();

    String DESCRIP = bundle.getString("routeName"); //my description string.
    routeNames = DESCRIP.split(",");
    System.out.println("CPlan.plan.size() " + CPlan.plan.size());
    System.out.println("CPlan.plan.get(0).legs.size()" + CPlan.plan.get(0).legs.size());
    System.out.println("CPlan.plan.get(1).legs.size()" + CPlan.plan.get(1).legs.size());
    System.out.println("routeNames.length" + routeNames.length);
    position = bundle.getInt("position"); //CPlan.plan.get(position).legs.get(0).v2.size()
    System.out.println("position " + position); //legs.get(CPlan.i).v2.size()
    System.out.println(" CPlan.plan.size() " + CPlan.plan.size());

    ItineraryObject = CPlan.ItineraryListJsonObject.get(position);
    ItineraryJsonObject = (JSONObject) ItineraryObject;//legs.get(CPlan.i).v2.size()

    ctrip = CPlan.plan.get(position);
    System.out.println("CTrip.legs.size()*  " + ctrip.legs.size());

    legStartTime = new String[routeNames.length];
    legFrom_name = new String[routeNames.length];
    legEndTime = new String[routeNames.length];
    legto_name = new String[routeNames.length]; //no of legs
    for (int j = 0; j < routeNames.length; j++) {
        System.out.println("j " + j);

        legStartTime[j] = ctrip.legs.get(j).legStartTimeObject;//legStartTimeObject

        legFrom_name[j] = ctrip.legs.get(j).From_name.toString(); //From_name

        legEndTime[j] = ctrip.legs.get(j).legEndTime; //legEndTime

        legto_name[j] = ctrip.legs.get(j).To_name.toString();
    }
    System.out.println("busHead.length " + legStartTime.length);
    System.out.println("totalDist.length " + legFrom_name.length);
    System.out.println("busFreq.length " + legto_name.length);
    System.out.println("no_Stops.length " + legEndTime.length);

    init(this);
}

From source file:io.teak.sdk.Teak.java

@Override
public void onReceive(Context inContext, Intent intent) {
    final Context context = inContext.getApplicationContext();

    if (!Teak.isEnabled()) {
        Log.e(LOG_TAG, "Teak is disabled, ignoring onReceive().");
        return;/*from  w  w w  . j  ava 2 s  .  c  o m*/
    }

    String action = intent.getAction();

    if (GCM_RECEIVE_INTENT_ACTION.equals(action)) {
        final TeakNotification notif = TeakNotification.remoteNotificationFromIntent(context, intent);
        if (notif == null) {
            return;
        }

        // Send Notification Received Metric
        Session.whenUserIdIsReadyRun(new Session.SessionRunnable() {
            @Override
            public void run(Session session) {
                HashMap<String, Object> payload = new HashMap<>();
                payload.put("app_id", session.appConfiguration.appId);
                payload.put("user_id", session.userId());
                payload.put("platform_id", notif.teakNotifId);

                new Request("/notification_received", payload, session).run();
            }
        });
    } else if (action.endsWith(TeakNotification.TEAK_NOTIFICATION_OPENED_INTENT_ACTION_SUFFIX)) {
        Bundle bundle = intent.getExtras();

        // Cancel any updates pending
        TeakNotification.cancel(context, bundle.getInt("platformId"));

        // Launch the app
        if (!bundle.getBoolean("noAutolaunch")) {
            if (Teak.isDebug) {
                Log.d(LOG_TAG,
                        "Notification (" + bundle.getString("teakNotifId") + ") opened, auto-launching app.");
            }
            Intent launchIntent = context.getPackageManager()
                    .getLaunchIntentForPackage(context.getPackageName());
            launchIntent.addCategory("android.intent.category.LAUNCHER");
            launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
            launchIntent.putExtras(bundle);
            if (bundle.getString("deepLink") != null) {
                launchIntent.setData(Uri.parse(bundle.getString("deepLink")));
            }
            context.startActivity(launchIntent);
        } else {
            if (Teak.isDebug) {
                Log.d(LOG_TAG, "Notification (" + bundle.getString("teakNotifId")
                        + ") opened, NOT auto-launching app (noAutoLaunch flag present, and set to true).");
            }
        }

        // Send broadcast
        if (Teak.localBroadcastManager != null) {
            Intent broadcastEvent = new Intent(TeakNotification.LAUNCHED_FROM_NOTIFICATION_INTENT);
            broadcastEvent.putExtras(bundle);
            Teak.localBroadcastManager.sendBroadcast(broadcastEvent);
        }
    } else if (action.endsWith(TeakNotification.TEAK_NOTIFICATION_CLEARED_INTENT_ACTION_SUFFIX)) {
        Bundle bundle = intent.getExtras();
        TeakNotification.cancel(context, bundle.getInt("platformId"));
    }

}

From source file:de.stadtrallye.rallyesoft.ConnectionAssistantActivity.java

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

    // Title and Content
    supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    setTitle(R.string.connection_assistant);
    //      setContentView(R.layout.connection_assistant);

    ActionBar ab = getSupportActionBar();
    ab.setDisplayHomeAsUpEnabled(true);/*from   ww  w. j a  v a 2 s  . c o  m*/
    ab.setDisplayShowTitleEnabled(true);

    Storage.aquireStorage(getApplicationContext(), this);

    if (savedInstanceState != null) {
        step = savedInstanceState.getInt(Std.STEP);
        server = Server.load(savedInstanceState.getString(Std.SERVER));
        name = savedInstanceState.getString(Std.NAME);
    }

    //Create FragmentHandlers
    steps = new ArrayList<FragmentHandler<?>>();
    steps.add(new FragmentHandler<AssistantServerFragment>("server", AssistantServerFragment.class));
    steps.add(new FragmentHandler<AssistantGroupsFragment>("groups", AssistantGroupsFragment.class));
    steps.add(new FragmentHandler<AssistantAuthFragment>("auth", AssistantAuthFragment.class));
    steps.add(new FragmentHandler<AssistantCompleteFragment>("complete", AssistantCompleteFragment.class));

    getLoaderManager().initLoader(0, null, this);
}