Example usage for android.os Bundle putLong

List of usage examples for android.os Bundle putLong

Introduction

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

Prototype

public void putLong(@Nullable String key, long value) 

Source Link

Document

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

Usage

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

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putParcelable("account", mAccount);
    outState.putLong("titleId", mTitleId);
}

From source file:edu.mit.media.funf.funfohmage.MainPipeline.java

@Override
public void onDataReceived(Bundle data) {
    String dataJson = getBundleSerializer().serialize(data);
    String probeName = data.getString(Probe.PROBE);
    long timestamp = data.getLong(Probe.TIMESTAMP, 0L);
    Bundle b = new Bundle();
    b.putString(NameValueDatabaseService.DATABASE_NAME_KEY, getPipelineName());
    b.putLong(NameValueDatabaseService.TIMESTAMP_KEY, timestamp);
    b.putString(NameValueDatabaseService.NAME_KEY, probeName);
    b.putString(NameValueDatabaseService.VALUE_KEY, dataJson);

    //Funf Ohmage
    //Log.w("dony","ts:"+timestamp);
    Log.w("dony", "name:" + probeName);
    //Log.w("dony","data:"+dataJson);

    if (probeName.endsWith("LocationProbe"))
        locationProbe_data = dataJson;//from ww  w  .j  a v  a 2  s  .  c o m
    else if (probeName.endsWith("WifiProbe"))
        wifiProbe_data = dataJson;
    else if (probeName.endsWith("AccelerometerSensorProbe"))
        accelerometerSensorProbe_data = dataJson;
    else
        Log.w("dony", "Received:" + probeName);

    if (locationProbe_data != null && wifiProbe_data != null && accelerometerSensorProbe_data != null) {
        Log.w("dony", "ts: All data received");
        uploadRequest(accelerometerSensorProbe_data, locationProbe_data, wifiProbe_data);
        Log.v("dony", "location:" + locationProbe_data);
        Log.v("dony", "wifi:" + wifiProbe_data);
        Log.v("dony", "acc:" + accelerometerSensorProbe_data);
        locationProbe_data = null;
        wifiProbe_data = null;
        accelerometerSensorProbe_data = null;
    }

    //Intent i = new Intent(this, getDatabaseServiceClass());
    //i.setAction(DatabaseService.ACTION_RECORD);
    //i.putExtras(b);
    //startService(i);
}

From source file:com.andrew.apolloMod.activities.QueryBrowserActivity.java

@Override
public void onServiceConnected(ComponentName name, IBinder service) {
    if (mAdapter != null) {
        getQueryCursor(mAdapter.getQueryHandler(), null);
    }/*from  w  w w  . j a v  a  2  s.  co  m*/

    Intent intent = getIntent();
    String action = intent != null ? intent.getAction() : null;

    if (Intent.ACTION_VIEW.equals(action)) {
        // this is something we got from the search bar
        Uri uri = intent.getData();
        String path = uri.toString();
        if (path.startsWith("content://media/external/audio/media/")) {
            // This is a specific file
            String id = uri.getLastPathSegment();
            long[] list = new long[] { Long.valueOf(id) };
            MusicUtils.playAll(this, list, 0);
            finish();
            return;
        } else if (path.startsWith("content://media/external/audio/albums/")) {
            // This is an album, show the songs on it
            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track");
            i.putExtra("album", uri.getLastPathSegment());
            startActivity(i);
            finish();
            return;
        } else if (path.startsWith("content://media/external/audio/artists/")) {
            intent = new Intent(Intent.ACTION_VIEW);

            Bundle bundle = new Bundle();
            bundle.putString(MIME_TYPE, Audio.Artists.CONTENT_TYPE);
            bundle.putString(ARTIST_KEY, uri.getLastPathSegment());
            bundle.putLong(BaseColumns._ID, ApolloUtils.getArtistId(uri.getLastPathSegment(), ARTIST_ID, this));

            intent.setClass(this, TracksBrowser.class);
            intent.putExtras(bundle);
            startActivity(intent);
            return;
        }
    }

    mFilterString = intent.getStringExtra(SearchManager.QUERY);
    if (MediaStore.INTENT_ACTION_MEDIA_SEARCH.equals(action)) {
        String focus = intent.getStringExtra(MediaStore.EXTRA_MEDIA_FOCUS);
        String artist = intent.getStringExtra(MediaStore.EXTRA_MEDIA_ARTIST);
        String album = intent.getStringExtra(MediaStore.EXTRA_MEDIA_ALBUM);
        String title = intent.getStringExtra(MediaStore.EXTRA_MEDIA_TITLE);
        if (focus != null) {
            if (focus.startsWith("audio/") && title != null) {
                mFilterString = title;
            } else if (focus.equals(Audio.Albums.ENTRY_CONTENT_TYPE)) {
                if (album != null) {
                    mFilterString = album;
                    if (artist != null) {
                        mFilterString = mFilterString + " " + artist;
                    }
                }
            } else if (focus.equals(Audio.Artists.ENTRY_CONTENT_TYPE)) {
                if (artist != null) {
                    mFilterString = artist;
                }
            }
        }
    }

    setContentView(R.layout.listview);
    mTrackList = getListView();
    mTrackList.setTextFilterEnabled(true);
    if (mAdapter == null) {
        mAdapter = new QueryListAdapter(getApplication(), this, R.layout.listview_items, null, // cursor
                new String[] {}, new int[] {}, 0);
        setListAdapter(mAdapter);
        if (TextUtils.isEmpty(mFilterString)) {
            getQueryCursor(mAdapter.getQueryHandler(), null);
        } else {
            mTrackList.setFilterText(mFilterString);
            mFilterString = null;
        }
    } else {
        mAdapter.setActivity(this);
        setListAdapter(mAdapter);
        mQueryCursor = mAdapter.getCursor();
        if (mQueryCursor != null) {
            init(mQueryCursor);
        } else {
            getQueryCursor(mAdapter.getQueryHandler(), mFilterString);
        }
    }

    LinearLayout emptyness = (LinearLayout) findViewById(R.id.empty_view);
    emptyness.setVisibility(View.GONE);
}

From source file:biz.bokhorst.bpt.BPTService.java

private void sendActivity(String name, int confidence, long time) {
    Bundle b = new Bundle();
    b.putString("Name", name);
    b.putInt("Confidence", confidence);
    b.putLong("Time", time);
    sendMessage(BackPackTrack.MSG_ACTIVITY, b);
}

From source file:com.rks.musicx.base.BasePlayingFragment.java

/**
 * Queue Menu/*from ww w.ja  va2 s . co  m*/
 *
 * @param view
 * @param position
 */
public void qeueMenu(QueueAdapter queueAdapter, View view, int position) {
    if (getActivity() == null) {
        return;
    }
    PopupMenu popupMenu = new PopupMenu(getContext(), view);
    MenuInflater menuInflater = popupMenu.getMenuInflater();
    menuInflater.inflate(R.menu.playing_menu, popupMenu.getMenu());
    Song queue = queueAdapter.getItem(position);
    popupMenu.getMenu().findItem(R.id.action_lyrics).setVisible(false);
    popupMenu.getMenu().findItem(R.id.action_eq).setVisible(false);
    popupMenu.getMenu().findItem(R.id.clear_queue).setVisible(false);
    popupMenu.getMenu().findItem(R.id.action_changeArt).setVisible(false);
    popupMenu.getMenu().findItem(R.id.action_settings).setVisible(false);
    popupMenu.getMenu().findItem(R.id.action_savequeue).setVisible(false);
    popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
            case R.id.action_playlist:
                PlaylistHelper.PlaylistChooser(BasePlayingFragment.this, getContext(), queue.getId());
                break;
            case R.id.action_edit_tags:
                Extras.getInstance().saveMetaData(queue);
                Bundle tag = new Bundle();
                goToMain(SHOW_TAG, tag);
                break;
            case R.id.action_ringtone:
                Helper.setRingTone(getContext(), queue.getmSongPath());
                break;
            case R.id.action_trackdetails:
                Helper.detailMusic(getContext(), queue.getTitle(), queue.getAlbum(), queue.getArtist(),
                        queue.getTrackNumber(), queue.getmSongPath());
                break;
            case R.id.action_share:
                Helper.shareMusic(musicXService.getsongId(), getContext());
                break;
            case R.id.go_to_album:
                Bundle data = new Bundle();
                data.putLong(ALBUM_ID, queue.getAlbumId());
                data.putString(ALBUM_NAME, queue.getAlbum());
                data.putString(ALBUM_ARTIST, queue.getArtist());
                data.putInt(ALBUM_TRACK_COUNT, queue.getTrackNumber());
                goToMain(SHOW_ALBUM, data);
                break;
            case R.id.go_to_artist:
                Bundle data1 = new Bundle();
                data1.putLong(ARTIST_ARTIST_ID, queue.getArtistId());
                data1.putString(ARTIST_NAME, queue.getArtist());
                goToMain(SHOW_ARTIST, data1);
                break;
            }
            return false;
        }
    });
    popupMenu.show();
}

From source file:com.rks.musicx.base.BasePlayingFragment.java

/**
 * Playing Menu// w  w w  . j av a  2 s .  com
 *
 * @param view
 */
public void playingMenu(Queue queue, View view, boolean torf) {
    if (getActivity() == null) {
        return;
    }
    PopupMenu popupMenu = new PopupMenu(getContext(), view);
    MenuInflater menuInflater = popupMenu.getMenuInflater();
    menuInflater.inflate(R.menu.playing_menu, popupMenu.getMenu());
    popupMenu.getMenu().findItem(R.id.action_share).setVisible(torf);
    popupMenu.getMenu().findItem(R.id.action_eq).setVisible(torf);
    popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
            case R.id.clear_queue:
                queue.clearStuff();
                break;
            case R.id.action_changeArt:
                pickupArtwork();
                break;
            case R.id.action_playlist:
                PlaylistHelper.PlaylistChooser(BasePlayingFragment.this, getContext(),
                        musicXService.getsongId());
                break;
            case R.id.action_lyrics:
                LyricsHelper.searchLyrics(getContext(), musicXService.getsongTitle(),
                        musicXService.getsongArtistName(), musicXService.getsongAlbumName(),
                        musicXService.getsongData(), lyricsView());
                break;
            case R.id.action_edit_tags:
                Extras.getInstance().saveMetaData(musicXService.getCurrentSong());
                Bundle tag = new Bundle();
                goToMain(SHOW_TAG, tag);
                break;
            case R.id.action_ringtone:
                Helper.setRingTone(getContext(), musicXService.getsongData());
                break;
            case R.id.action_trackdetails:
                Helper.detailMusic(getContext(), musicXService.getsongTitle(), musicXService.getsongAlbumName(),
                        musicXService.getsongArtistName(), musicXService.getsongNumber(),
                        musicXService.getsongData());
                break;
            case R.id.action_eq:
                ((PlayingActivity) getActivity()).returnEq();
                break;
            case R.id.action_share:
                Helper.shareMusic(musicXService.getsongId(), getContext());
                break;
            case R.id.action_settings:
                ((PlayingActivity) getActivity()).returnSettings();
                break;
            case R.id.action_savequeue:
                saveQueue();
                break;
            case R.id.go_to_album:
                Bundle data = new Bundle();
                data.putLong(ALBUM_ID, getMusicXService().getsongAlbumID());
                data.putString(ALBUM_NAME, getMusicXService().getsongAlbumName());
                data.putString(ALBUM_ARTIST, getMusicXService().getsongArtistName());
                data.putInt(ALBUM_TRACK_COUNT, getMusicXService().getsongNumber());
                goToMain(SHOW_ALBUM, data);
                Log.e("Move", "Go_to_Main");
                break;
            case R.id.go_to_artist:
                Bundle data1 = new Bundle();
                data1.putLong(ARTIST_ARTIST_ID, getMusicXService().getArtistID());
                data1.putString(ARTIST_NAME, getMusicXService().getsongArtistName());
                goToMain(SHOW_ARTIST, data1);
                break;
            }
            return false;
        }
    });
    popupMenu.show();
}

From source file:com.app.uafeed.fragment.EntryFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putParcelable(STATE_BASE_URI, mBaseUri);
    outState.putLongArray(STATE_ENTRIES_IDS, mEntriesIds);
    outState.putLong(STATE_INITIAL_ENTRY_ID, mInitialEntryId);
    outState.putInt(STATE_CURRENT_PAGER_POS, mCurrentPagerPos);
    outState.putFloat(STATE_SCROLL_PERCENTAGE, mEntryPagerAdapter.getScrollPercentage());

    super.onSaveInstanceState(outState);
}

From source file:at.jclehner.rxdroid.ui.ScheduleGridFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    //final Fraction[][] doses = new Fraction[mHolders.length][4];

    for (int i = 0; i != mHolders.length; ++i) {
        final Fraction[] doses = new Fraction[Schedule.DOSE_TIME_COUNT];

        for (int j = 0; j != Schedule.DOSE_TIME_COUNT; ++j)
            doses[j] = mHolders[i].doseViews[j].getDose();

        outState.putParcelableArray("doses_" + i, doses);
    }/*w w  w .  j a  va  2 s .  co m*/

    outState.putLong("day_status", mDayStatus.longValue());
}

From source file:com.example.app_2.activities.ImageGridActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.putLong("actual_category_fk", actual_category_fk.getCategoryId());
}

From source file:cat.wuyingren.rorhelper.activities.MainActivity.java

private Fragment prepareFactionFragment(long factionID) {
    Fragment fragment = new GameFactionFragment();
    Bundle args = new Bundle();
    args.putLong(GameFactionFragment.ARG_GAME_ID, currentGameId);
    args.putLong(GameFactionFragment.ARG_FACTION_ID, factionID);
    fragment.setArguments(args);/*from  w  w w  . ja  v  a  2 s  .  com*/
    return fragment;
}