Example usage for android.os Bundle getLong

List of usage examples for android.os Bundle getLong

Introduction

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

Prototype

public long getLong(String key) 

Source Link

Document

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

Usage

From source file:com.android.calendar.event.CreateEventDialogFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        mDateString = savedInstanceState.getString(KEY_DATE_STRING);
        mDateInMillis = savedInstanceState.getLong(KEY_DATE_IN_MILLIS);
    }//  w  w  w .  jav a2  s .co m
}

From source file:cz.maresmar.sfm.view.menu.day.DayMenuPagerFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getArguments() != null) {
        mUserUri = getArguments().getParcelable(ARG_USER_URI);

        if (savedInstanceState == null) {
            mDay = MenuUtils.getTodayDate();
        } else {/*from  ww w.j  av  a  2 s .  co  m*/
            mDay = savedInstanceState.getLong(ARG_PAGER_PAGE_ID);
        }

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

From source file:br.org.funcate.dynamicforms.FragmentDetailActivity.java

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

    // don't permit rotation
    int currentOrientation = getResources().getConfiguration().orientation;
    if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else {//from   ww  w.j  ava2  s.  c  om
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

    String tags = "";
    String defaultSectionName = FormUtilities.DEFAULT_SESSION_NAME;

    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    String geojsonTags = "";
    if (extras != null) {
        pointId = extras.getLong(LibraryConstants.SELECTED_POINT_ID);
        formName = extras.getString(FormUtilities.ATTR_FORMNAME);
        tags = extras.getString(FormUtilities.ATTR_JSON_TAGS);

        if (extras.containsKey(FormUtilities.ATTR_GEOJSON_TAGS)) {
            geojsonTags = extras.getString(FormUtilities.ATTR_GEOJSON_TAGS);
        }
        // here are the attribute values from feature to populate form in edit operation
        if (extras.containsKey(FormUtilities.ATTR_DATA_VALUES)) {
            existingFeatureData = extras.getBundle(FormUtilities.ATTR_DATA_VALUES);
        }
        workingDirectory = extras.getString(FormUtilities.MAIN_APP_WORKING_DIRECTORY);
    }

    try {
        sectionObject = TagsManager.getInstance(tags).getSectionByName(defaultSectionName);

        if (sectionObject == null) {
            Toast.makeText(getApplicationContext(), "Failure on get form session.", Toast.LENGTH_LONG).show();
            System.out.println("Failure on load JSON form from database.");
            this.finish();
        }

        JSONObject geojson = new JSONObject(geojsonTags);
        sectionObject.put(FormUtilities.ATTR_GEOJSON_TAGS, geojson);

    } catch (JSONException e) {
        Toast.makeText(getApplicationContext(), "Incorrect form configuration.", Toast.LENGTH_LONG).show();
        System.out.println("Failure on load JSON form from database.");
        e.printStackTrace();
        this.finish();
    }

    setContentView(R.layout.details_activity_layout);
}

From source file:com.ultramegasoft.flavordex2.fragment.ViewFlavorsFragment.java

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

    final Bundle args = getArguments();
    if (args != null) {
        mEntryId = args.getLong(ViewEntryFragment.ARG_ENTRY_ID);
    }/*w  ww .  j  a va  2  s .  c om*/

    setHasOptionsMenu(true);
}

From source file:com.github.kanata3249.ffxieq.android.AtmaSelector.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    Bundle param;

    super.onCreate(savedInstanceState);

    if (savedInstanceState != null) {
        param = savedInstanceState;//from  ww w .j a v a2  s  . c  om
    } else {
        param = getIntent().getExtras();
    }

    mCurrent = param.getLong("Current");
    mIndex = param.getInt("Index");
    mFilterID = param.getLong("Filter");

    setContentView(R.layout.atmaselector);
}

From source file:com.ultramegasoft.flavordex2.fragment.ViewFlavorsFragment.java

@SuppressWarnings("ConstantConditions")
@NonNull//from  w  ww .j  a v  a2  s  . co m
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle bundle) {
    final Context context = getContext();
    if (context == null) {
        return null;
    }

    Uri uri;
    switch (id) {
    case LOADER_FLAVOR:
        uri = Uri.withAppendedPath(Tables.Entries.CONTENT_ID_URI_BASE, mEntryId + "/flavor");
        return new CursorLoader(context, uri, null, null, null, Tables.EntriesFlavors.POS + " ASC");
    case LOADER_DEFAULT_FLAVOR:
    case LOADER_RESET_FLAVOR:
        final Bundle args = getArguments();
        final long catId = args != null ? args.getLong(ViewEntryFragment.ARG_ENTRY_CAT_ID) : 0;
        uri = Uri.withAppendedPath(Tables.Cats.CONTENT_ID_URI_BASE, catId + "/flavor");
        return new CursorLoader(context, uri, null, null, null, Tables.Flavors.POS + " ASC");
    }
    return null;
}

From source file:com.chess.genesis.data.GameDataDB.java

public void addLocalGame(final Bundle game) {
    final Object[] data = { game.getString("name"), game.getLong("ctime"), game.getLong("stime"),
            game.getInt("gametype"), game.getInt("opponent"), game.getString("history"),
            game.getString("zfen") };

    db.execSQL(//from  w w  w.ja v  a2  s.c  o m
            "INSERT INTO localgames (name, ctime, stime, gametype, opponent, history, zfen) VALUES (?, ?, ?, ?, ?, ?, ?);",
            data);
}

From source file:com.example.crudcontent.fragment.EditCityFragment.java

@Override
public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
    super.onViewStateRestored(savedInstanceState);
    if (savedInstanceState != null) {
        city = savedInstanceState.getString(STATE_CITY);
        stateId = savedInstanceState.getLong(STATE_STATE_ID);
        dateOfVisit = new Date(savedInstanceState.getLong(STATE_DATE_VISITED));
        notes = savedInstanceState.getString(STATE_NOTES);
    }//from  w  w  w. j a  v  a2  s . c om
}

From source file:com.dabay6.android.apps.carlog.ui.fuel.fragments.FuelHistoryEditFragment.java

/**
 * {@inheritDoc}/*from w ww  .j  a v  a  2  s  . co  m*/
 */
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    final Bundle bundle = getArguments();

    super.onActivityCreated(savedInstanceState);

    vehicleId = bundle.getLong(PARAMS_VEHICLE_ID);
}

From source file:com.example.android.gcncouponalert.app.CouponsFragment.java

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    Log.d(LOG_TAG, "onLoadFinished: " + data.getCount());
    mCouponsAdapter.swapCursor(data);//  ww  w  . j  ava2  s . co  m

    //Bundle extras = getActivity().getIntent().getExtras();
    Bundle extras = this.getArguments();
    if (extras != null) {
        if (extras.containsKey("coupon_id")) {
            long coupon_id = extras.getLong("coupon_id");
            Log.d(LOG_TAG, "Intent! coupon_id: " + coupon_id);
            if (null != mCouponsAdapter) {
                //Log.d(LOG_TAG,"Intent! mCouponsAdapter OK");
                Cursor c = mCouponsAdapter.getCursor();
                if (null != c) {
                    //Log.d(LOG_TAG,"Intent! Cursor c OK");
                    if (c.moveToFirst()) {
                        //Log.d(LOG_TAG,"Intent! Cursor c has data OK");
                        while (!c.isAfterLast()) {
                            //Log.d(LOG_TAG,"Intent! is "+c.getLong(COL_COUPON_ID)+" == "+coupon_id+" ?");
                            if (c.getLong(COL_COUPON_ID) == coupon_id) {
                                mPosition = c.getPosition();
                                break;
                            }
                            c.moveToNext();
                        }
                    }
                }
            }
            //getActivity().getIntent().removeExtra("coupon_id");
            extras.remove("coupon_id");
        }

    }
    //Log.d(LOG_TAG,"Intent! mPosition: "+mPosition);
    if (mPosition != ListView.INVALID_POSITION) {
        // If we don't need to restart the loader, and there's a desired position to restore
        // to, do so now.
        int offset = 0;
        //mListView.smoothScrollToPositionFromTop(mPosition, offset, 100);
        mListView.setSelection(mPosition);
    }
}