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.nearnotes.NoteEdit.java

@Override
public void onResume() {
    super.onResume();
    mCallback.setActionItems(NOTE_EDIT);
    if (mRowId == null) {
        Bundle extras = getArguments();
        if (!extras.containsKey(NotesDbAdapter.KEY_ROWID)) {
            mTitleText.setText("");
        }//from  w  ww  . jav  a  2 s . co m
        mRowId = extras.containsKey(NotesDbAdapter.KEY_ROWID) ? extras.getLong(NotesDbAdapter.KEY_ROWID) : null;
    }
    mTblAddLayout.removeAllViews();
    populateFields();
}

From source file:com.akop.bach.fragment.playstation.GamesFragment.java

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

    mCp = new CachePolicy();
    mCp.resizeHeight = 96;/*from w ww  .j a  v  a 2s.  c  om*/

    if (mAccount == null) {
        Bundle args = getArguments();
        ContentResolver cr = getActivity().getContentResolver();

        mAccount = (PsnAccount) args.getParcelable("account");
        mTitleId = getFirstTitleId(cr.query(Games.CONTENT_URI, new String[] { Games._ID, },
                Games.ACCOUNT_ID + "=" + mAccount.getId(), null, Games.DEFAULT_SORT_ORDER));
    }

    if (state != null && state.containsKey("account")) {
        mAccount = (PsnAccount) state.getParcelable("account");
        mTitleId = state.getLong("titleId");
    }

    setHasOptionsMenu(true);
}

From source file:com.dwdesign.tweetings.fragment.StatusFragment.java

@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
    final TweetingsApplication application = getApplication();
    mService = application.getServiceInterface();
    mLazyImageLoader = application.getImageLoaderWrapper();
    mImagesPreviewFragment = (ImagesPreviewFragment) Fragment.instantiate(getActivity(),
            ImagesPreviewFragment.class.getName());
    super.onActivityCreated(savedInstanceState);
    setRetainInstance(true);/*from  w w w  .j  a v a2s  . c o m*/
    mLoadMoreAutomatically = mPreferences.getBoolean(PREFERENCE_KEY_LOAD_MORE_AUTOMATICALLY, true);
    final Bundle bundle = getArguments();
    if (bundle != null) {
        mAccountId = bundle.getLong(INTENT_KEY_ACCOUNT_ID);
        mStatusId = bundle.getLong(INTENT_KEY_STATUS_ID);
        bundle.setClassLoader(ParcelableStatus.class.getClassLoader());
        mStatus = bundle.getParcelable(INTENT_KEY_STATUS);
        mImagesPreviewFragment.setStatus(mStatus);
    }
    mInReplyToView.setOnClickListener(this);
    mFollowButton.setOnClickListener(this);
    mProfileView.setOnClickListener(this);
    mLocationView.setOnClickListener(this);
    mRetweetedStatusView.setOnClickListener(this);
    mMenuBar.setOnMenuItemClickListener(this);
    final FragmentManager fm = getFragmentManager();
    final FragmentTransaction ft = fm.beginTransaction();
    ft.replace(R.id.images_preview, mImagesPreviewFragment);
    ft.commit();
    //if (mStatus != null) {
    //displayStatus(mStatus);
    //} else {
    //getStatus(false);
    //}

}

From source file:com.akop.bach.fragment.xboxlive.MessagesFragment.java

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

    if (mAccount == null) {
        Bundle args = getArguments();/*from w  w  w .  ja  va  2 s  . c om*/
        ContentResolver cr = getActivity().getContentResolver();

        mAccount = (XboxLiveAccount) args.getParcelable("account");
        mTitleId = getFirstTitleId(cr.query(Messages.CONTENT_URI, new String[] { Messages._ID, },
                Messages.ACCOUNT_ID + "=" + mAccount.getId(), null, Messages.DEFAULT_SORT_ORDER));
    }

    if (state != null && state.containsKey("account")) {
        mAccount = (XboxLiveAccount) state.getParcelable("account");
        mTitleId = state.getLong("titleId");
    }

    setHasOptionsMenu(true);
}

From source file:ca.rmen.android.palidamuerte.app.poem.detail.PoemDetailActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_poem_detail);
    getActionBar().setDisplayShowCustomEnabled(true);
    getActionBar().setCustomView(R.layout.poem_number);
    setVolumeControlStream(AudioManager.STREAM_MUSIC);
    mTextViewPageNumber = (TextView) getActionBar().getCustomView();
    ActionBar.setCustomFont(this);
    mViewPager = (ViewPager) findViewById(R.id.pager);

    // If this is the first time we open the activity, we will use the poem id provided in the intent.
    // If we are recreating the activity (because of a device rotation, for example), we will display the poem that the user 
    // had previously swiped to, using the ViewPager.
    final long poemId;
    if (savedInstanceState != null)
        poemId = savedInstanceState.getLong(PoemDetailFragment.ARG_ITEM_ID);
    else/*from   ww w  .  j a  va2s . c o  m*/
        poemId = getIntent().getLongExtra(PoemDetailFragment.ARG_ITEM_ID, -1);

    new AsyncTask<Void, Void, PoemPagerAdapter>() {

        private String mActivityTitle;

        @Override
        protected PoemPagerAdapter doInBackground(Void... params) {
            mActivityTitle = Poems.getActivityTitle(PoemDetailActivity.this, getIntent());
            PoemSelection poemSelection = Poems.getPoemSelection(PoemDetailActivity.this, getIntent());
            return new PoemPagerAdapter(PoemDetailActivity.this, poemSelection, getSupportFragmentManager());
        }

        @Override
        protected void onPostExecute(PoemPagerAdapter result) {
            if (isFinishing())
                return;
            try {
                mPoemPagerAdapter = result;
                mViewPager.setAdapter(mPoemPagerAdapter);
                mViewPager.setOnPageChangeListener(mOnPageChangeListener);
                findViewById(R.id.activity_loading).setVisibility(View.GONE);
                int position = mPoemPagerAdapter.getPositionForPoem(poemId);
                mViewPager.setCurrentItem(position);
                getActionBar().setTitle(mActivityTitle);
                String pageNumber = getString(R.string.page_number, position + 1, mPoemPagerAdapter.getCount());
                mTextViewPageNumber.setText(pageNumber);
                invalidateOptionsMenu();
            } catch (IllegalStateException e) {
                // Don't have time to investigate the root cause now
                //https://groups.google.com/forum/#!topic/android-developers/Zpb8YSzTltA 
                Log.e(TAG, e.getMessage(), e);
            }
        }
    }.execute();

    // Show the Up button in the action bar.
    getActionBar().setDisplayHomeAsUpEnabled(true);
}

From source file:com.akop.bach.fragment.xboxlive.GamesFragment.java

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

    if (mAccount == null) {
        Bundle args = getArguments();//from  w  ww  .ja  va  2 s. co m
        ContentResolver cr = getActivity().getContentResolver();

        mAccount = (XboxLiveAccount) args.getParcelable("account");
        mTitleId = getFirstTitleId(cr.query(Games.CONTENT_URI, new String[] { Games._ID, },
                Games.ACCOUNT_ID + "=" + mAccount.getId(), null, Games.DEFAULT_SORT_ORDER));
    }

    if (state != null && state.containsKey("account")) {
        mAccount = (XboxLiveAccount) state.getParcelable("account");
        mTitleId = state.getLong("titleId");
    }

    setHasOptionsMenu(true);
}

From source file:de.spiritcroc.ownlog.ui.fragment.LogItemEditFragment.java

private boolean restoreValues(Bundle savedInstanceState) {
    if (savedInstanceState == null) {
        return false;
    }//from   www. j a  v a 2s .c o  m
    try {
        if (savedInstanceState.containsKey(KEY_INIT_TITLE)) {
            mInitTitle = savedInstanceState.getString(KEY_INIT_TITLE);
            mEditLogTitle.setText(savedInstanceState.getString(KEY_SET_TITLE));
            mInitContent = savedInstanceState.getString(KEY_INIT_CONTENT);
            mEditLogContent.setText(savedInstanceState.getString(KEY_SET_CONTENT));
            mInitTime = savedInstanceState.getLong(KEY_INIT_TIME);
            mTime = Calendar.getInstance();
            mTime.setTimeInMillis(savedInstanceState.getLong(KEY_SET_TIME));
            mInitTags = new ArrayList<>(
                    Arrays.asList((TagItem[]) savedInstanceState.getParcelableArray(KEY_INIT_TAGS)));
            mSetTags = new ArrayList<>(
                    Arrays.asList((TagItem[]) savedInstanceState.getParcelableArray(KEY_SET_TAGS)));
            mAvailableTags = new ArrayList<>(
                    Arrays.asList((TagItem[]) savedInstanceState.getParcelableArray(KEY_AVAILABLE_TAGS)));

            updateTitle();
            mEditTagsView.updateContent();
            return true;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
}

From source file:com.rowland.moviesquire.ui.activities.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Inflate the layout
    setContentView(R.layout.activity_main);
    // Inject all the views
    ButterKnife.bind(this);
    // Check that the activity is using the layout with the fragment_container id
    if (findViewById(R.id.detail_container) != null) {
        // The detail container view will be present only in the large-screen layouts
        // (res/layout-sw600dp). If this view is present, then the activity should be
        // in two-pane mode.
        toggleShowTwoPane(true);//from   w w  w  .  j a v  a2 s.  c o  m
        // If we're being restored from a previous state, don't need to do anything
        // and should return or else we could end up with overlapping fragments.
        if (savedInstanceState != null) {
            // Recover assets
            mSelectedPosition = savedInstanceState.getInt(SELECTED_POSITION_KEY);
            mMovieId = savedInstanceState.getLong(SELECTED_MOVIE_KEY);
            // Set positions as selected
            onMovieSelected(mMovieId, mSelectedPosition);
            return;
        } else {
            // Get Facebook Stetho doing its job
            initStetho();
            // In two-pane mode, show the detail view in this activity by
            // adding or replacing the detail fragment using a fragment transaction.
            showDetailFragment(null);
        }
    } else {
        toggleShowTwoPane(false);
    }
    if (savedInstanceState == null) {
        showMainFragment(null);
    }
}

From source file:de.persoapp.android.activity.AuthenticateActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.frame_layout); // we need this empty frame, otherwise Crouton may render its croutons wrong

    // default value
    setResult(RESULT_CANCELED);/*w w w  . j  a  va2s. c o m*/

    Uri uri = getIntent().getData();
    mTcUrl = uri != null ? uri.getQueryParameter(TC_TOKEN_PARAMETER) : null;

    if (mTcUrl == null) {
        // skip whole life cycle
        Toast.makeText(this, R.string.invalid_request, Toast.LENGTH_LONG).show();
        finish();
        return;
    }

    if (savedInstanceState == null) {

        if (!mDeviceStateTester.needsToShowOtherContent(R.id.frameLayout)) {
            startAuthentication();
        }

    } else {
        mPin = savedInstanceState.getByteArray(PIN_KEY);
        mResultChat = savedInstanceState.getLong(RESULT_CHAT_KEY);
    }
}

From source file:cl.ipp.katbag.fragment.Player.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    v = inflater.inflate(R.layout.fragment_player, container, false);
    mainActivity = (MainActivity) super.getActivity();

    // rescues parameters
    Bundle bundle = getArguments();
    if (bundle != null) {
        id_app = bundle.getLong("id_app");
        editMode = bundle.getBoolean("editMode");
        name_app_text = bundle.getString("name_app");
    }/*  www . ja va  2 s  .com*/

    scorePanel = (LinearLayout) v.findViewById(R.id.player_score_panel);
    score = (TextView) v.findViewById(R.id.player_score);

    start = (Button) v.findViewById(R.id.player_button_start);
    start.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            scorePanel.setVisibility(View.VISIBLE);
            start.setVisibility(View.GONE);

            drawingUsesAccelerometer.clear();
            drawingUsesBounceThread.clear();

            conditionId.clear();
            conditionState.clear();
            conditionLevel.clear();

            iterationsId.clear();
            iterationsN.clear();
            iterationsBgn.clear();
            iterationsLst.clear();

            touchEventId.clear();
            touchEventDrawing.clear();
            touchEventBgn.clear();
            touchEventLst.clear();

            scoreEqualId.clear();
            scoreEqualToN.clear();
            scoreEqualToBgn.clear();
            scoreEqualToLst.clear();

            shakeId.clear();
            shakeBgn.clear();
            shakeLst.clear();

            develop = mainActivity.katbagHandler.selectDevelopForIdApp(id_app);

            for (int i = 0; i < develop.size(); i++) {
                String[] line = develop.get(i).split("&&");

                if (line[1].contentEquals("sensing")) {
                    switch (Integer.parseInt(line[3])) {
                    case 0:
                        conditionId.add(Integer.valueOf(line[0]));
                        conditionState.add(0);
                        conditionLevel.add(Integer.valueOf(line[8]));
                        break;

                    case 1: // shake
                        conditionId.add(Integer.valueOf(line[0]));
                        conditionState.add(0);
                        conditionLevel.add(Integer.valueOf(line[8]));
                        break;
                    }
                }
            }

            setScore(intScore);
            play(0, develop.size());

        }
    });

    playerView = (RelativeLayout) v.findViewById(R.id.player_view);
    playerView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            if (!mMeasured) {
                loc = new int[2];
                playerView.getLocationInWindow(loc);
                mMeasured = true;
                start.setVisibility(View.VISIBLE);
            }
        }
    });

    return v;
}