Example usage for android.os Bundle putDouble

List of usage examples for android.os Bundle putDouble

Introduction

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

Prototype

public void putDouble(@Nullable String key, double value) 

Source Link

Document

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

Usage

From source file:com.mirasense.scanditsdk.plugin.ScanditSDK.java

private void setOptionsOnBundle(JSONObject options, Bundle bundle) {
    @SuppressWarnings("unchecked")
    Iterator<String> iter = (Iterator<String>) options.keys();
    while (iter.hasNext()) {
        String key = iter.next();
        Object obj = options.opt(key);
        if (obj != null) {
            if (obj instanceof Float) {
                bundle.putFloat(key.toLowerCase(), (Float) obj);
            } else if (obj instanceof Double) {
                bundle.putDouble(key.toLowerCase(), (Double) obj);
            } else if (obj instanceof Integer) {
                bundle.putInt(key.toLowerCase(), (Integer) obj);
            } else if (obj instanceof Boolean) {
                bundle.putBoolean(key.toLowerCase(), (Boolean) obj);
            } else if (obj instanceof String) {
                bundle.putString(key.toLowerCase(), (String) obj);
            }//from  w ww  .j  a  va2  s . co m
        }
    }
}

From source file:uk.org.rivernile.edinburghbustracker.android.fragments.general.BusStopMapFragment.java

/**
 * Refresh the bus stop marker icons on the map. This may be because the
 * camera has moved, a configuration change has happened or the user has
 * selected services to filter by./*from  www.jav a  2  s .c o  m*/
 * 
 * @param position If a CameraPosition is available, send it in so that it
 * doesn't need to be looked up again. If it's not available, use null.
 */
private void refreshBusStops(CameraPosition position) {
    if (map == null || !isAdded()) {
        return;
    }

    // Populate the CameraPosition if it wasn't given.
    if (position == null) {
        position = map.getCameraPosition();
    }

    // Get the visible bounds.
    final LatLngBounds lastVisibleBounds = map.getProjection().getVisibleRegion().latLngBounds;
    final Bundle b = new Bundle();

    // Populate the Bundle of arguments for the bus stops Loader.
    b.putDouble(LOADER_ARG_MIN_X, lastVisibleBounds.southwest.latitude);
    b.putDouble(LOADER_ARG_MIN_Y, lastVisibleBounds.southwest.longitude);
    b.putDouble(LOADER_ARG_MAX_X, lastVisibleBounds.northeast.latitude);
    b.putDouble(LOADER_ARG_MAX_Y, lastVisibleBounds.northeast.longitude);
    b.putFloat(LOADER_ARG_ZOOM, position.zoom);

    // If there are chosen services, then set the filtered services
    // argument.
    if (chosenServices != null && chosenServices.length > 0) {
        b.putStringArray(LOADER_ARG_FILTERED_SERVICES, chosenServices);
    }

    // Start the bus stops Loader.
    getLoaderManager().restartLoader(LOADER_ID_BUS_STOPS, b, this);
}

From source file:com.binomed.showtime.android.screen.results.tablet.CineShowTimeResultsTabletActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    if ((getModelActivity().getNearResp() != null) || (fragmentMovie != null)) {
        outState.putBoolean(ParamIntent.BUNDLE_SAVE, true);
        // Save results state
        if (getModelActivity().getNearResp() != null) {
            outState.putParcelable(ParamIntent.NEAR_RESP, getModelActivity().getNearResp());
        } else {/*ww w  . j a  v a2 s .com*/
            outState.putBoolean(ParamIntent.ACTIVITY_SEARCH_FORCE_REQUEST,
                    getModelActivity().isForceResearch());
        }
        if (getModelActivity().getLocalisation() != null) {
            outState.putDouble(ParamIntent.ACTIVITY_SEARCH_LATITUDE,
                    getModelActivity().getLocalisation().getLatitude());
            outState.putDouble(ParamIntent.ACTIVITY_SEARCH_LONGITUDE,
                    getModelActivity().getLocalisation().getLongitude());
        }
        outState.putString(ParamIntent.ACTIVITY_SEARCH_THEATER_ID, getModelActivity().getFavTheaterId());
        outState.putInt(ParamIntent.ACTIVITY_SEARCH_DAY, getModelActivity().getDay());
        outState.putString(ParamIntent.ACTIVITY_SEARCH_CITY, getModelActivity().getCityName());
        outState.putString(ParamIntent.ACTIVITY_SEARCH_MOVIE_NAME, getModelActivity().getMovieName());
        outState.putIntegerArrayList(ParamIntent.ACTIVITY_SEARCH_GROUP_EXPAND,
                new ArrayList<Integer>(getModelActivity().getGroupExpanded()));

        // Save movie state
        if ((fragmentMovie != null) && (getModelActivity().getMovie() != null)) {
            outState.putParcelable(ParamIntent.MOVIE, getModelActivity().getMovie());
            outState.putParcelable(ParamIntent.THEATER, getModelActivity().getTheater());
            outState.putDouble(ParamIntent.ACTIVITY_MOVIE_LATITUDE,
                    (getModelActivity().getLocalisation() != null)
                            ? getModelActivity().getLocalisation().getLatitude()
                            : -1);
            outState.putDouble(ParamIntent.ACTIVITY_MOVIE_LONGITUDE,
                    (getModelActivity().getLocalisation() != null)
                            ? getModelActivity().getLocalisation().getLongitude()
                            : -1);
        }
    }
    super.onSaveInstanceState(outState);
}

From source file:me.xiaopan.android.inject.sample.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    listView = new ListView(getBaseContext());
    setContentView(listView);//from w ww. j ava 2  s .c om

    // SharedPreferences?
    PreferenceUtils.putBoolean(getBaseContext(), KEY_BOOLEAN, true);
    PreferenceUtils.putFloat(getBaseContext(), KEY_FLOAT, 10000f);
    PreferenceUtils.putInt(getBaseContext(), KEY_INT, 2000);
    PreferenceUtils.putLong(getBaseContext(), KEY_LONG, 50000);
    PreferenceUtils.putString(getBaseContext(), KEY_STRING, "Preference String");
    Set<String> stringSet = new HashSet<String>();
    stringSet.add("String Set 1");
    stringSet.add("String Set 2");
    stringSet.add("String Set 3");
    stringSet.add("String Set 4");
    PreferenceUtils.putStringSet(getBaseContext(), KEY_STRING_SET, stringSet);
    MyBean bean2 = new MyBean();
    bean2.setEmail("sky@xiaopan.me2");
    bean2.setName("?2");
    bean2.setSex("2");
    PreferenceUtils.putObject(getBaseContext(), KEY_JSON, bean2);
    PreferenceUtils.putString(getBaseContext(), KEY_ENUM, Sex.WOMAN.name());

    // ??
    String[] items = new String[] { "", "?", "FragmentDialog",
            "InjectAdapter", "InjectExpandableListAdapter" };
    listView.setAdapter(new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1,
            android.R.id.text1, items));
    listView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position <= 2) {
                Bundle bundle = new Bundle();
                bundle.putBoolean(MainActivity.PARAM_BOOLEAN, true);
                bundle.putBooleanArray(MainActivity.PARAM_BOOLEAN_ARRAY, new boolean[] { true, false, true });
                bundle.putByte(MainActivity.PARAM_BYTE, (byte) 110);
                bundle.putByteArray(MainActivity.PARAM_BYTE_ARRAY, new byte[] { 111, 112, 113 });
                bundle.putChar(MainActivity.PARAM_CHAR, 'R');
                bundle.putCharArray(MainActivity.PARAM_CHAR_ARRAY, new char[] { 'c', 'h', 'a', 'r' });
                bundle.putCharSequence(MainActivity.PARAM_CHAR_SEQUENCE, "CharSequence");
                bundle.putCharSequenceArray(MainActivity.PARAM_CHAR_SEQUENCE_ARRAY,
                        new CharSequence[] { "Char", " ", "Sequence" });
                bundle.putDouble(MainActivity.PARAM_DOUBLE, 12.00d);
                bundle.putDoubleArray(MainActivity.PARAM_DOUBLE_ARRAY, new double[] { 12.01d, 12.02d, 12.03d });
                bundle.putFloat(MainActivity.PARAM_FLOAT, 13.00f);
                bundle.putFloatArray(MainActivity.PARAM_FLOAT_ARRAY, new float[] { 13.01f, 13.02f, 13.03f });
                bundle.putInt(MainActivity.PARAM_INT, 120);
                bundle.putIntArray(MainActivity.PARAM_INT_ARRAY, new int[] { 121, 122, 123, });
                bundle.putLong(MainActivity.PARAM_LONG, 12345);
                bundle.putLongArray(MainActivity.PARAM_LONG_ARRAY, new long[] { 12346, 12347, 12348 });
                bundle.putShort(MainActivity.PARAM_SHORT, (short) 2);
                bundle.putShortArray(MainActivity.PARAM_SHORT_ARRAY, new short[] { 3, 4, 5 });
                bundle.putString(MainActivity.PARAM_STRING, "String");
                bundle.putStringArray(MainActivity.PARAM_STRING_ARRAY,
                        new String[] { "String1", "String2", "String3" });

                // ??JSONBundle
                MyBean bean = new MyBean();
                bean.setEmail("sky@xiaopan.me");
                bean.setName("?");
                bean.setSex("");
                bundle.putString(PARAM_STRING_JSON, new Gson().toJson(bean));

                bundle.putString(MainActivity.PARAM_STRING_ENUM, Sex.WOMAN.name());

                // 
                ArrayList<String> stringList = new ArrayList<String>();
                stringList.add("ArrayList String 1");
                stringList.add("ArrayList String 2");
                stringList.add("ArrayList String 3");
                bundle.putStringArrayList(MainActivity.PARAM_STRING_ARRAY_LIST, stringList);
                switch (position) {
                case 0:
                    Second.SECOND_CHRONOGRAPH.lap();
                    Intent intent = new Intent(getBaseContext(), InjectTestActivity.class);
                    intent.putExtras(bundle);
                    startActivity(intent);
                    break;
                case 1:
                    Second.SECOND_CHRONOGRAPH.lap();
                    Intent intent2 = new Intent(getBaseContext(), NormalActivity.class);
                    intent2.putExtras(bundle);
                    startActivity(intent2);
                    break;
                case 2:
                    Second.SECOND_CHRONOGRAPH.lap();
                    new TestDialogFragment().show(getSupportFragmentManager(), "");
                    break;
                }
            } else {
                Class<?> targetClass = null;
                if (position == 3) {
                    targetClass = InjectAdapterActivity.class;
                } else if (position == 4) {
                    targetClass = InjectExpandableListAdapterActivity.class;
                }
                if (targetClass != null) {
                    startActivity(new Intent(getBaseContext(), targetClass));
                }
            }
        }
    });
}

From source file:org.croudtrip.fragments.join.JoinSearchFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    /*//from w  w  w.  j  av a  2  s  .co  m
    Set up the autocomplete textView
     */
    tv_destination.setOnItemClickListener(mAutocompleteClickListener);
    tv_destination.setThreshold(0);
    LatLngBounds bounds = null;
    if (locationUpdater.getLastLocation() != null) {
        bounds = LatLngBounds.builder().include(new LatLng(locationUpdater.getLastLocation().getLatitude(),
                locationUpdater.getLastLocation().getLongitude())).build();

    }
    adapter = new PlaceAutocompleteAdapter(getActivity(), android.R.layout.simple_list_item_1, bounds, null);
    tv_destination.setAdapter(adapter);
    adapter.setGoogleApiClient(googleApiClient);
    tv_destination.clearFocus();
    tv_destination.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View view, boolean hasFocus) {
            if (hasFocus) {
                tv_destination.showDropDown();
            }
        }
    });

    /*
    Populate the autocomplete textView
     */
    try {
        List<org.croudtrip.db.Place> savedPlaces = dbHelper.getPlaceDao().queryForAll();
        ArrayList<PlaceAutocompleteAdapter.PlaceAutocomplete> history = new ArrayList<>();
        for (int i = savedPlaces.size() - 1; i >= 0; i--) {
            if (history.size() == 5) {
                break;
            }
            PlaceAutocompleteAdapter.PlaceAutocomplete a = adapter.new PlaceAutocomplete(
                    savedPlaces.get(i).getId(), savedPlaces.get(i).getDescription());
            history.add(a);
        }
        adapter.setHistory(history);
    } catch (SQLException e) {
        CrashPopup.show(getActivity(), e);
        e.printStackTrace();
    }

    /*
    Insert the last known location as soon as it is known
     */
    ReactiveLocationProvider locationProvider = new ReactiveLocationProvider(getActivity());
    Subscription subscription = locationProvider.getLastKnownLocation().observeOn(Schedulers.io())
            .subscribe(new Action1<Location>() {
                @Override
                public void call(Location location) {
                    LatLngBounds bounds = LatLngBounds.builder()
                            .include(new LatLng(location.getLatitude(), location.getLongitude())).build();
                    adapter.setBounds(bounds);
                }
            });
    subscriptions.add(subscription);

    /*
    Open the placepicker on button click
     */
    btn_destination.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            try {
                PlacePicker.IntentBuilder intentBuilder = new PlacePicker.IntentBuilder();
                Intent intent = intentBuilder.build(getActivity().getApplicationContext());

                startActivityForResult(intent, REQUEST_PLACE_PICKER);
            } catch (GooglePlayServicesRepairableException e) {
                CrashPopup.show(getActivity(), e);
                e.printStackTrace();
            } catch (GooglePlayServicesNotAvailableException e) {
                CrashPopup.show(getActivity(), e);
                e.printStackTrace();
            }
        }
    });

    /*
    Load and set the maximum waiting time
     */
    final SharedPreferences prefs = getActivity().getSharedPreferences(Constants.SHARED_PREF_FILE_PREFERENCES,
            Context.MODE_PRIVATE);
    int waitingTime = prefs.getInt(Constants.SHARED_PREF_KEY_WAITING_TIME, 10);
    tv_waitingTime.setText(getString(R.string.join_max_waiting) + " " + waitingTime);
    slider_waitingTime.setValue(waitingTime);

    slider_waitingTime.setOnValueChangedListener(new Slider.OnValueChangedListener() {
        @Override
        public void onValueChanged(int i) {
            tv_waitingTime.setText(getString(R.string.join_max_waiting) + " " + i);
        }
    });

    /*
    Retrieve starting position, save destination and try to join a trip
     */
    btn_join.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            /*
            Save maximum waiting time
             */
            SharedPreferences.Editor editor = prefs.edit();
            editor.putInt(Constants.SHARED_PREF_KEY_WAITING_TIME, slider_waitingTime.getValue());
            editor.apply();

            org.croudtrip.db.Place tempPlace = lastSelected;
            lastSelected = null;

            /*
            Get the starting position either by placepicker or GPS data
             */
            Location currentLocation;
            if (specifiedLocation == null) {
                // retrieve current position
                currentLocation = locationUpdater.getLastLocation();
                if (currentLocation == null) {
                    Toast.makeText(getActivity().getApplicationContext(), R.string.offer_trip_no_location,
                            Toast.LENGTH_SHORT).show();

                    AlertDialog.Builder adb = new AlertDialog.Builder(getActivity());
                    adb.setTitle(getResources().getString(R.string.enable_gps_title));
                    adb.setMessage(getResources().getString(R.string.gpd_not_available));
                    adb.setPositiveButton(getResources().getString(R.string.redirect_to_placepicker),
                            new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int which) {

                                    try {
                                        PlacePicker.IntentBuilder intentBuilder = new PlacePicker.IntentBuilder();
                                        Intent intent = intentBuilder
                                                .build(getActivity().getApplicationContext());

                                        startActivityForResult(intent, REQUEST_PLACE_PICKER);
                                    } catch (GooglePlayServicesRepairableException e) {
                                        CrashPopup.show(getActivity(), e);
                                        e.printStackTrace();
                                    } catch (GooglePlayServicesNotAvailableException e) {
                                        CrashPopup.show(getActivity(), e);
                                        e.printStackTrace();
                                    }

                                    return;
                                }
                            });
                    adb.show();
                    return;
                }
            } else {
                currentLocation = specifiedLocation;
                specifiedLocation = null;
            }

            // get destination from string
            LatLng destination = null;
            try {
                List<Address> addresses = null;
                if (tv_address.getText() == null || tv_address.getText().equals("")) {
                    addresses = geocoder.getFromLocationName(tv_destination.getText().toString(), 1);
                } else {
                    addresses = geocoder.getFromLocationName(tv_address.getText().toString(), 1);
                }
                if (addresses != null && addresses.size() > 0)
                    destination = new LatLng(addresses.get(0).getLatitude(), addresses.get(0).getLongitude());
            } catch (IOException e) {
                Toast.makeText(getActivity().getApplicationContext(), R.string.join_trip_no_destination,
                        Toast.LENGTH_SHORT).show();
                return;
            }
            // no destination received
            if (destination == null) {
                Toast.makeText(getActivity().getApplicationContext(), R.string.offer_trip_no_destination,
                        Toast.LENGTH_SHORT).show();
                return;
            }

            if (currentLocation == null) {
                Toast.makeText(getActivity().getApplicationContext(), R.string.offer_trip_no_location,
                        Toast.LENGTH_SHORT).show();
                return;
            }

            /*
            Save or update destination in database
             */
            try {
                if (tempPlace != null) {
                    dbHelper.getPlaceDao().delete(tempPlace);
                    dbHelper.getPlaceDao().create(tempPlace);
                } else {
                    tempPlace = new org.croudtrip.db.Place();
                    tempPlace.setId(tv_destination.getText().toString());
                    tempPlace.setDescription(tv_destination.getText().toString());
                    dbHelper.getPlaceDao().delete(tempPlace);
                    dbHelper.getPlaceDao().create(tempPlace);
                }
            } catch (SQLException e) {
                CrashPopup.show(getActivity(), e);
                e.printStackTrace();
            }

            /*
            Set status to "searching"
             */
            editor.putBoolean(Constants.SHARED_PREF_KEY_SEARCHING, true);
            editor.apply();

            /*
            Add trip information to extras and update UI
             */
            Bundle extras = new Bundle();
            //extras.putString(JoinDispatchFragment.KEY_ACTION_TO_RUN, JoinDispatchFragment.ACTION_START_BACKGROUND_SEARCH);
            extras.putInt(JoinDispatchFragment.KEY_MAX_WAITING_TIME, slider_waitingTime.getValue() * 60); // max waiting time in seconds
            extras.putDouble(JoinDispatchFragment.KEY_CURRENT_LOCATION_LATITUDE, currentLocation.getLatitude());
            extras.putDouble(JoinDispatchFragment.KEY_CURRENT_LOCATION_LONGITUDE,
                    currentLocation.getLongitude());
            extras.putDouble(JoinDispatchFragment.KEY_DESTINATION_LATITUDE, destination.latitude);
            extras.putDouble(JoinDispatchFragment.KEY_DESTINATION_LONGITUDE, destination.longitude);

            Intent startingIntent = new Intent(Constants.EVENT_CHANGE_JOIN_UI);
            startingIntent.putExtras(extras);
            LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(startingIntent);
        }
    });

    /*
    Open the "Offer Trip" Fragment on click at the floating action button
     */
    FloatingActionButton btn_offer = (FloatingActionButton) view.findViewById(R.id.btn_offer_trip);
    btn_offer.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            MaterialNavigationDrawer drawer = (MaterialNavigationDrawer) getActivity();
            drawer.setFragment(new DispatchOfferTripFragment(), getString(R.string.menu_offer_trip));
            MaterialSection section = drawer.getSectionByTitle(getString(R.string.menu_offer_trip));

            if (section == null) {
                drawer.getSectionByTitle(getString(R.string.menu_my_trip));
            }

            drawer.setSection(section);
        }
    });

    // if there is currently no position available disable the offer trip button
    if (locationUpdater.getLastLocation() == null && specifiedLocation == null) {
        btn_join.setEnabled(false);
        loadLocationLayout.setVisibility(View.VISIBLE);
        Subscription sub = locationProvider.getLastKnownLocation()
                /* JUST FOR TESTING!!!
                        .observeOn( Schedulers.newThread() )
                        .subscribeOn(Schedulers.newThread())
                        .flatMap(new Func1<Location, Observable<Location>>() {
                            @Override
                            public Observable<Location> call(Location location) {
                                try {
                                    Thread.sleep(4000);
                                } catch (InterruptedException e) {
                                    e.printStackTrace();
                                }
                                return Observable.just(location);
                            }
                        })*/
                .compose(new DefaultTransformer<Location>()).subscribe(new Action1<Location>() {
                    @Override
                    public void call(Location location) {
                        if (location == null)
                            return;

                        locationUpdater.setLastLocation(location);
                        btn_join.setEnabled(true);
                        loadLocationLayout.setVisibility(View.GONE);
                    }
                });

        subscriptions.add(sub);
    }

}

From source file:me.chenjiayang.myleancloud.Main2Activity.java

/**
 * ToolBar ?//from   ww w .  j a  v a 2  s.  co m
 */
private void ToolBarOperation() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    //?

    //
    toolbar.setTitle("Autoer");
    //
    toolbar.setTitleTextColor(getResources().getColor(android.R.color.white));
    //?
    toolbar.setTitleTextAppearance(this, R.style.Theme_ToolBar_Base_Title);
    //???
    toolbar.inflateMenu(R.menu.main2);

    //???
    //scanQRCodeTextView = (TextView) findViewById(R.id.scanQRCodeTextView);

    toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            int menuItemId = item.getItemId();
            if (menuItemId == R.id.action_search) {

                Bundle around_gas = new Bundle();
                around_gas.putDouble("around_gas_lat", 31.022371);
                around_gas.putDouble("around_gas_lon", 121.442491);
                Intent intent = new Intent(Main2Activity.this, AroundGasActivity.class);
                intent.putExtra("around_gas", around_gas);
                startActivity(intent);
            } else if (menuItemId == R.id.action_notification) {
                //Toast.makeText(Main2Activity.this, R.string.menu_notifications, Toast.LENGTH_SHORT).show();
                startActivity(new Intent(Main2Activity.this, NotificationActivity.class));
            } else if (menuItemId == R.id.action_item2) {
                /**
                 *  Mylibrary ???
                 */
                Intent scanStart = new Intent(Main2Activity.this, CaptureActivity.class);
                startActivityForResult(scanStart, 0);
            } else if (menuItemId == R.id.action_item3) {
                SharedPreferences sp = getSharedPreferences("userInfo", 0);
                sp.edit().putBoolean("autologin", false).commit();
                sp.edit().putBoolean("isFirst", true).commit();
                startActivity(new Intent(Main2Activity.this, me.chenjiayang.myleancloud.MainActivity.class));
                finish();
            }

            return true;
        }
    });

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    assert fab != null;
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent(Main2Activity.this, OrderActivity.class);
            startActivity(intent);
        }
    });

    final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar,
            R.string.navigation_drawer_open, R.string.navigation_drawer_close);

    toggle.setDrawerIndicatorEnabled(false);
    toolbar.setNavigationIcon(R.mipmap.head_portrait_80);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            drawer.openDrawer(Gravity.LEFT);
        }
    });
    //toggle.setHomeAsUpIndicator(R.mipmap.head_portrait_64);
    drawer.setDrawerListener(toggle);
    toggle.syncState();

    navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);

    View headerLayout = navigationView.inflateHeaderView(R.layout.nav_header_main2);

    head_Iv = (BootstrapCircleThumbnail) headerLayout.findViewById(R.id.HeadimageView);
    head_tv = (TextView) headerLayout.findViewById(R.id.Head_name);
    collector = (BootstrapButton) headerLayout.findViewById(R.id.collector);
    head_Iv.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Main2Activity.this, EditInfoActivity.class));
        }
    });
    head_Iv.setImageDrawable(getResources().getDrawable(R.mipmap.head_portrait));
    head_tv.setText(AVUser.getCurrentUser().get("username").toString());
    collector.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Main2Activity.this, CollectActivity.class));
        }
    });

    /*View garage = navigationView.getMenu().findItem(0).getActionView();
    car_num_tv = (TextView) garage.findViewById(R.id.msg);
    car_num_tv.setText("2");*/

}

From source file:org.path.episample.android.fragments.NavigateFragment.java

private void sortCensus(Sort sort) {
    mSort = sort;/*from  w w  w  . ja  v a2 s  . c  o  m*/
    Bundle bundle = new Bundle();
    // bundle.putInt(SORT, mSort.ordinal());

    if (mDirectionProvider.getCurrentLocation() != null) {
        bundle.putDouble(CURRENT_LATITUDE, mDirectionProvider.getCurrentLocation().getLatitude());
        bundle.putDouble(CURRENT_LONGITUDE, mDirectionProvider.getCurrentLocation().getLongitude());
    }
    getLoaderManager().restartLoader(CENSUS_LIST_LOADER, bundle, this);
}

From source file:com.bonsai.wallet32.SendBitcoinActivity.java

private DialogFragment showSendConfirmDialog(int acctId, String acctStr, String addrStr, long amount, long fee,
        double rate) {
    DialogFragment df = new SendConfirmDialogFragment();
    Bundle args = new Bundle();
    args.putInt("acctId", acctId);
    args.putString("acctStr", acctStr);
    args.putString("addr", addrStr);
    args.putLong("amount", amount);
    args.putLong("fee", fee);
    args.putDouble("rate", rate);
    df.setArguments(args);//from ww  w. ja v  a2 s .  c  o  m
    df.show(getSupportFragmentManager(), "sendconfirm");
    return df;
}

From source file:com.bonsai.wallet32.SendBitcoinActivity.java

private DialogFragment showFeeAdjustDialog(String msg, int acctId, String acctStr, String addrStr, long amount,
        long fee, double rate) {
    DialogFragment df = new FeeAdjustDialogFragment();
    Bundle args = new Bundle();
    args.putString("msg", msg);
    args.putInt("acctId", acctId);
    args.putString("acctStr", acctStr);
    args.putString("addr", addrStr);
    args.putLong("amount", amount);
    args.putLong("fee", fee);
    args.putDouble("rate", rate);
    df.setArguments(args);//from w  ww  .j a v a  2s  .c  o  m
    df.show(getSupportFragmentManager(), "sendconfirm");
    return df;
}

From source file:org.onebusaway.android.map.googlemapsv2.BaseMapFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    if (mController != null) {
        mController.onSaveInstanceState(outState);
    }//from  ww  w  . ja va  2  s  . c  o m
    outState.putString(MapParams.MODE, getMapMode());
    outState.putString(MapParams.STOP_ID, mFocusStopId);
    Location center = getMapCenterAsLocation();
    if (mMap != null) {
        outState.putDouble(MapParams.CENTER_LAT, center.getLatitude());
        outState.putDouble(MapParams.CENTER_LON, center.getLongitude());
        outState.putFloat(MapParams.ZOOM, getZoomLevelAsFloat());
    }
    outState.putInt(MapParams.MAP_PADDING_LEFT, mMapPaddingLeft);
    outState.putInt(MapParams.MAP_PADDING_TOP, mMapPaddingTop);
    outState.putInt(MapParams.MAP_PADDING_RIGHT, mMapPaddingRight);
    outState.putInt(MapParams.MAP_PADDING_BOTTOM, mMapPaddingBottom);
}