当前位置: 首页>>代码示例>>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;未经允许,请勿转载。