當前位置: 首頁>>代碼示例>>Java>>正文


Java Bundle.getLongArray方法代碼示例

本文整理匯總了Java中android.os.Bundle.getLongArray方法的典型用法代碼示例。如果您正苦於以下問題:Java Bundle.getLongArray方法的具體用法?Java Bundle.getLongArray怎麽用?Java Bundle.getLongArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.os.Bundle的用法示例。


在下文中一共展示了Bundle.getLongArray方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onResult

import android.os.Bundle; //導入方法依賴的package包/類
@Override
protected Bundle onResult(int which) {
    Bundle b = super.onResult(which);
    int color = (int) b.getLong(SELECTED_SINGLE_ID);
    if (color == PICKER){
        b.putInt(COLOR, mCustomColor);
    } else {
        b.putInt(COLOR, color);
    }

    long[] ids = b.getLongArray(SELECTED_IDS);
    if (ids != null) {
        int[] colors = new int[ids.length];
        for (int i = 0; i < ids.length; i++) {
            if (ids[i] == PICKER) {
                colors[i] = mCustomColor;
            } else {
                colors[i] = (int) ids[i];
            }
        }
        b.putIntArray(COLORS, colors);
    }
    return b;
}
 
開發者ID:eltos,項目名稱:SimpleDialogFragments,代碼行數:25,代碼來源:SimpleColorDialog.java

示例2: restoreSelectedMessages

import android.os.Bundle; //導入方法依賴的package包/類
/**
 * Restore selected messages from a {@link Bundle}.
 */
private void restoreSelectedMessages(Bundle savedInstanceState) {
    long[] selected = savedInstanceState.getLongArray(STATE_SELECTED_MESSAGES);
    if (selected != null) {
        for (long id : selected) {
            this.selected.add(id);
        }
    }
}
 
開發者ID:philipwhiuk,項目名稱:q-mail,代碼行數:12,代碼來源:MessageListFragment.java

示例3: restoreState

import android.os.Bundle; //導入方法依賴的package包/類
@Override
public void restoreState(@Nullable Parcelable state, ClassLoader loader) {
    if (state != null) {
        Bundle bundle = (Bundle) state;
        bundle.setClassLoader(loader);
        long[] fss = bundle.getLongArray("states");
        mSavedStates.clear();
        mFragments.clear();
        if (fss != null) {
            for (long fs : fss) {
                mSavedStates.put(fs, (Fragment.SavedState) bundle.getParcelable(Long.toString(fs)));
            }
        }
        Iterable<String> keys = bundle.keySet();
        for (String key : keys) {
            if (key.startsWith("f")) {
                Fragment f = mFragmentManager.getFragment(bundle, key);
                if (f != null) {
                    f.setMenuVisibility(false);
                    mFragments.put(Long.parseLong(key.substring(1)), f);
                } else {
                    Log.w(TAG, "Bad fragment at key " + key);
                }
            }
        }
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:28,代碼來源:UpdatableFragmentPagerAdapter.java

示例4: onCreate

import android.os.Bundle; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  final Bundle args = getArguments();
  if (args != null) {
    long[] bookmarkIds = args.getLongArray(EXTRA_BOOKMARK_IDS);

    if (bookmarkIds != null) {
      mTagBookmarkPresenter.setBookmarksMode(bookmarkIds);
    }
  }
}
 
開發者ID:Elias33,項目名稱:Quran,代碼行數:14,代碼來源:TagBookmarkDialog.java

示例5: restoreInstanceState

import android.os.Bundle; //導入方法依賴的package包/類
/**
 * This method should be called from your {@link AppCompatActivity} or
 * {@link android.support.v4.app.Fragment Fragment} to allow the controller to restore any
 * instance state.
 *
 * @param savedInstanceState - The state passed to your Activity or Fragment.
 */
public void restoreInstanceState(Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        long[] checkedIds = savedInstanceState.getLongArray(getStateKey());
        if (checkedIds != null && checkedIds.length > 0) {
            HashSet<Long> idsToCheckOnRestore = new HashSet<Long>();
            for (long id : checkedIds) {
                idsToCheckOnRestore.add(id);
            }
            tryRestoreInstanceState(idsToCheckOnRestore);
        }
    }
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:20,代碼來源:MultiSelectionUtil.java

示例6: restoreIds

import android.os.Bundle; //導入方法依賴的package包/類
/**
 * Restore selected items.
 * Saved with {@link Selection#saveIds(android.os.Bundle)}.
 */
public void restoreIds(Bundle bundle) {
    mSelectedIds.clear();

    if (bundle != null && bundle.containsKey(SAVED_BUNDLE_KEY)) {
        long[] ids = bundle.getLongArray(SAVED_BUNDLE_KEY);
        if (ids != null) {
            for (long id : ids) {
                mSelectedIds.add(id);
            }
        }
    }
}
 
開發者ID:orgzly,項目名稱:orgzly-android,代碼行數:17,代碼來源:Selection.java

示例7: onRestoreInstanceState

import android.os.Bundle; //導入方法依賴的package包/類
public void onRestoreInstanceState(Bundle bundle) {
    String[] keys = bundle.getStringArray("channel_ids_keys");
    long[] values = bundle.getLongArray("channel_ids_values");
    if (keys != null && values != null && keys.length == values.length) {
        for (int i = keys.length - 1; i >= 0; --i) {
            channelIds.put(keys[i], values[i]);
            nextChannelId = Math.max(nextChannelId, values[i] + 1);
        }
    }
    updateChannelList();
}
 
開發者ID:MCMrARM,項目名稱:revolution-irc,代碼行數:12,代碼來源:ChatPagerAdapter.java

示例8: onCreate

import android.os.Bundle; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_move_albums);

    unbinder = ButterKnife.bind(this);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(Intent.ACTION_MEDIA_MOUNTED);
    intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
    intentFilter.addDataScheme("file");

    Bundle bundle = getIntent().getExtras();
    sourceId = bundle.getLong("sourceId", 0);
    ids.clear();

    for (long item : bundle.getLongArray("ids")) {
        ids.add(item);
    }

    whatFragment = bundle.getInt("what", FragmentType.ALBUM_PHOTOS.ordinal());
    if (whatFragment == FragmentType.ALBUM_PHOTOS.ordinal()) {
        setTitle(getText(R.string.title_activity_move_albums));
    }
    else {
        setTitle(getText(R.string.title_activity_move_faces));
    }


    adapter = new MoveAdapter(this, cols);
    adapter.addHeader(new View(this));

    gridLayoutManager = new GridLayoutManager(this, cols);

    recyclerView.setLayoutManager(gridLayoutManager);
    recyclerView.setAdapter(adapter);
    gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
        @Override
        public int getSpanSize(int position) {
            return adapter.getSpanSize(position);
        }
    });
}
 
開發者ID:aliyun,項目名稱:aliyun-cloudphotos-android-demo,代碼行數:48,代碼來源:MoveActivity.java

示例9: getLongArray

import android.os.Bundle; //導入方法依賴的package包/類
public long[] getLongArray(Bundle state, String key) {
    return state.getLongArray(key + baseKey);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:4,代碼來源:Injector.java

示例10: getLongArray

import android.os.Bundle; //導入方法依賴的package包/類
public long[] getLongArray(Bundle state, String key) {
    return state.getLongArray(key + mBaseKey);
}
 
開發者ID:evernote,項目名稱:android-state,代碼行數:4,代碼來源:InjectionHelper.java


注:本文中的android.os.Bundle.getLongArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。