当前位置: 首页>>代码示例>>Java>>正文


Java Bundle.getParcelableArray方法代码示例

本文整理汇总了Java中android.os.Bundle.getParcelableArray方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.getParcelableArray方法的具体用法?Java Bundle.getParcelableArray怎么用?Java Bundle.getParcelableArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.Bundle的用法示例。


在下文中一共展示了Bundle.getParcelableArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: StackRemoteViewsFactory

import android.os.Bundle; //导入方法依赖的package包/类
public StackRemoteViewsFactory(Context applicationContext, Intent intent) {
    Log.v(TAG, "StackRemoteViewsFactory");
    intent.setExtrasClassLoader(GitHubJourneyWidgetDataEntry.class.getClassLoader());
    this.context = applicationContext;
    appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, 1);
    Bundle bundle = intent.getBundleExtra("bundle");
    Parcelable[] items = bundle.getParcelableArray("parcelables");
    Log.v(TAG, "items size = " + items.length);

    if (items.length != 0) {
        widgetDatas = new ArrayList<>(items.length);
        for (Parcelable item : items) {
            widgetDatas.add((GitHubJourneyWidgetDataEntry) item);
        }
    } else {
        widgetDatas = new ArrayList<>(0);
    }
    Log.v(TAG, "widgetDatas" + widgetDatas.size());
}
 
开发者ID:OlgaKuklina,项目名称:GitJourney,代码行数:20,代码来源:StackWidgetService.java

示例2: onCreateDialog

import android.os.Bundle; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Bundle args = getArguments();
    final AspectRatio[] ratios = (AspectRatio[]) args.getParcelableArray(ARG_ASPECT_RATIOS);
    if (ratios == null) {
        throw new RuntimeException("No ratios");
    }
    Arrays.sort(ratios);
    final AspectRatio current = args.getParcelable(ARG_CURRENT_ASPECT_RATIO);
    final AspectRatioAdapter adapter = new AspectRatioAdapter(ratios, current);
    return new AlertDialog.Builder(getActivity())
        .setAdapter(adapter, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int position) {
                mListener.onAspectRatioSelected(ratios[position]);
            }
        })
        .create();
}
 
开发者ID:lytcom,项目名称:CameraKitView,代码行数:21,代码来源:AspectRatioFragment.java

示例3: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    List<Drawable> drawables = new ArrayList<>();
    if(savedInstanceState != null) {
        Resources resources = getResources();
        Parcelable[] parcelables = savedInstanceState.getParcelableArray(BITMAPS);
        for (int i = 0, n = parcelables.length; i < n; i++) {
            drawables.add(new BitmapDrawable(resources, (Bitmap) parcelables[i]));
        }
    } else {
        addDefaultImages(drawables);
    }
    imageViewPagerAdapter = new ImageViewPagerAdapter(drawables);

    viewPager = (ViewPager) findViewById(R.id.pager);
    viewPager.setOffscreenPageLimit(3);
    viewPager.setAdapter(imageViewPagerAdapter);
}
 
开发者ID:martinwithaar,项目名称:PinchToZoom,代码行数:21,代码来源:MainActivity.java

示例4: d

import android.os.Bundle; //导入方法依赖的package包/类
public d(Bundle bundle) {
    this.h = bundle.getString("ext_to");
    this.i = bundle.getString("ext_from");
    this.j = bundle.getString("ext_chid");
    this.g = bundle.getString("ext_pkt_id");
    Parcelable[] parcelableArray = bundle.getParcelableArray("ext_exts");
    if (parcelableArray != null) {
        this.l = new ArrayList(parcelableArray.length);
        for (Parcelable parcelable : parcelableArray) {
            a a = a.a((Bundle) parcelable);
            if (a != null) {
                this.l.add(a);
            }
        }
    }
    Bundle bundle2 = bundle.getBundle("ext_ERROR");
    if (bundle2 != null) {
        this.n = new h(bundle2);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:d.java

示例5: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState == null) {
        alertAdapter = new AlertAdapter(getActivity());
    } else {
        Alert[] alerts = (Alert[]) savedInstanceState.getParcelableArray(BUNDLE_KEY);
        List<Alert> alertsList = new ArrayList<>();
        for (Alert alert : alerts) {
            alertsList.add(alert);
        }
        alertAdapter = new AlertAdapter(getActivity(), alertsList);
    }

    alertDAO = new AlertDAO(getActivity());
    alertDAO.open();
    if (alertAdapter.getCount() == 0) {
        alertAdapter.addAllItems(alertDAO.getAllAlerts());
    }
    setListAdapter(alertAdapter);

    setHasOptionsMenu(true);
}
 
开发者ID:kflauri2312lffds,项目名称:Android_watch_magpie,代码行数:24,代码来源:AlertFragment.java

示例6: restoreState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void restoreState(Parcelable state, ClassLoader loader) {
  if (state != null) {
    Bundle bundle = (Bundle) state;
    bundle.setClassLoader(loader);
    mSavedState.clear();
    mFragments.clear();

    String lastMode = bundle.getString("mode", "");
    if (!mode.equals(lastMode)) {
      cleanupOldFragments(bundle);
      return;
    }

    Parcelable[] fss = bundle.getParcelableArray("states");
    if (fss != null) {
      for (Parcelable fs : fss) {
        mSavedState.add((Fragment.SavedState) fs);
      }
    }
    Iterable<String> keys = bundle.keySet();
    for (String key : keys) {
      if (key.startsWith("f")) {
        int index = Integer.parseInt(key.substring(1));
        Fragment f = mFragmentManager.getFragment(bundle, key);
        if (f != null) {
          while (mFragments.size() <= index) {
            mFragments.add(null);
          }
          f.setMenuVisibility(false);
          mFragments.set(index, f);
        } else {
          Timber.w("Bad fragment at key %s", key);
        }
      }
    }
  }
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:39,代码来源:FragmentStatePagerAdapter.java

示例7: onRestoreInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        currentIndex = bundle.getInt("currentIndex");
        menuStatus = bundle.getInt("menuStatus");
        lastIndex = bundle.getInt("lastIndex");
        clickIndex = bundle.getInt("clickIndex");
        state = bundle.getParcelable("superState");
        runningPoints = (PathPoint[]) bundle.getParcelableArray("runningPoints");
        endPathPoints = (PathPoint[]) bundle.getParcelableArray("endPoints");
    }
    super.onRestoreInstanceState(state);
}
 
开发者ID:qinwenbo114,项目名称:CircleMenu,代码行数:15,代码来源:CircleMenu.java

示例8: onCreateView

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){

    View view = inflater.inflate(R.layout.fragment_profiletab3, container, false);

    nodata = (TextView) view.findViewById(R.id.nodata);
    recyclerView = (RecyclerView) view.findViewById(R.id.news_list);
    progress = (ProgressBar) view.findViewById(R.id.progress);
    list = new ArrayList<>();

    adapter = new NewsFeedAdapter(getContext());
    recyclerView.setAdapter(adapter);

    final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
    recyclerView.setLayoutManager(linearLayoutManager);

    sharedPref = new SharedPref(getContext());

    Log.d("id",sharedPref.getUserId());
    if(savedInstanceState==null){
        getData(1,sharedPref.getUserId());
        progress.setVisibility(View.VISIBLE);
    }

    else{
        if(savedInstanceState.getParcelableArray(USER_POST)!=null){
            recyclerView.setVisibility(View.VISIBLE);
            list = savedInstanceState.getParcelableArrayList(USER_POST);
            adapter.refresh(list);
        }
        else{
            nodata.setVisibility(View.VISIBLE);
            nodata.setText("No Post Uploaded");
        }

    }


    return view;
}
 
开发者ID:appteam-nith,项目名称:Hillffair17,代码行数:41,代码来源:ProfileTab3.java

示例9: getNotificationArrayFromBundle

import android.os.Bundle; //导入方法依赖的package包/类
private static Notification[] getNotificationArrayFromBundle(Bundle bundle, String key) {
    Parcelable[] array = bundle.getParcelableArray(key);
    if ((array instanceof Notification[]) || array == null) {
        return (Notification[]) array;
    }
    Notification[] typedArray = new Notification[array.length];
    for (int i = 0; i < array.length; i++) {
        typedArray[i] = (Notification) array[i];
    }
    bundle.putParcelableArray(key, typedArray);
    return typedArray;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:13,代码来源:NotificationCompat.java

示例10: restoreState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void restoreState(Parcelable state, ClassLoader loader) {
    if (state != null) {
        Bundle bundle = (Bundle) state;
        bundle.setClassLoader(loader);
        fragments.clear();
        if (enableSavedStates) {
            Parcelable[] fss = bundle.getParcelableArray("states");
            savedState.clear();
            if (fss != null) {
                for (Parcelable fs : fss) {
                    savedState.add((Fragment.SavedState) fs);
                }
            }
        }
        Iterable<String> keys = bundle.keySet();
        for (String key : keys) {
            if (key.startsWith("f")) {
                int index = Integer.parseInt(key.substring(1));
                Fragment f = fragmentManager.getFragment(bundle, key);
                if (f != null) {
                    setItemVisible(f, false);
                    fragments.put(index, f);
                } else {
                    Log.w(TAG, "Bad fragment at key " + key);
                }
            }
        }
    }
}
 
开发者ID:Laaidback,项目名称:A.scribe,代码行数:31,代码来源:FragmentStatePagerAdapter2.java

示例11: restoreState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void restoreState(Parcelable state, ClassLoader loader) {
    if (state != null) {
        Bundle bundle = (Bundle) state;
        bundle.setClassLoader(loader);
        Parcelable[] fss = bundle.getParcelableArray("states");
        mSavedState.clear();
        mFragments.clear();
        if (fss != null) {
            for (int i = 0; i < fss.length; i++) {
                mSavedState.add((Fragment.SavedState) fss[i]);
            }
        }
        Iterable<String> keys = bundle.keySet();
        for (String key : keys) {
            if (key.startsWith("f")) {
                int index = Integer.parseInt(key.substring(1));
                Fragment f = mFragmentManager.getFragment(bundle, key);
                if (f != null) {
                    while (mFragments.size() <= index) {
                        mFragments.add(null);
                    }
                    f.setMenuVisibility(false);
                    mFragments.set(index, f);
                } else {
                    Log.w(TAG, "Bad fragment at key " + key);
                }
            }
        }
    }
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:32,代码来源:CustomFragmentStatePagerAdapter.java

示例12: getParcelableArray

import android.os.Bundle; //导入方法依赖的package包/类
public Parcelable[] getParcelableArray(Bundle state, String key) {
    return state.getParcelableArray(key + baseKey);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:Injector.java

示例13: getParcelableArray

import android.os.Bundle; //导入方法依赖的package包/类
public Parcelable[] getParcelableArray(Bundle state, String key) {
    return state.getParcelableArray(key + mBaseKey);
}
 
开发者ID:evernote,项目名称:android-state,代码行数:4,代码来源:InjectionHelper.java

示例14: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    // save some items we use frequently
    final Intent intent = getIntent();

    if (savedInstanceState != null) {
        mPendingRequest = savedInstanceState.getInt(KEY_INSTANCE_STATE_PENDING_REQUEST);
        mExistingAccounts =
                savedInstanceState.getParcelableArray(KEY_INSTANCE_STATE_EXISTING_ACCOUNTS);

        // Makes sure that any user selection is preserved across orientation changes.
        mSelectedAccountName = savedInstanceState.getString(
                KEY_INSTANCE_STATE_SELECTED_ACCOUNT_NAME);

        mSelectedAddNewAccount = savedInstanceState.getBoolean(
                KEY_INSTANCE_STATE_SELECTED_ADD_ACCOUNT, false);
        mAccounts = savedInstanceState.getParcelableArrayList(KEY_INSTANCE_STATE_ACCOUNT_LIST);
        mCallingUserId = savedInstanceState.getInt(KEY_USER_ID);
    } else {
        mPendingRequest = REQUEST_NULL;
        mExistingAccounts = null;
        mCallingUserId = intent.getIntExtra(KEY_USER_ID, -1);
        // If the selected account as specified in the intent matches one in the list we will
        // show is as pre-selected.
        Account selectedAccount = intent.getParcelableExtra(EXTRA_SELECTED_ACCOUNT);
        if (selectedAccount != null) {
            mSelectedAccountName = selectedAccount.name;
        }
    }
    VLog.v(TAG, "selected account name is " + mSelectedAccountName);

    mSetOfAllowableAccounts = getAllowableAccountSet(intent);
    mSetOfRelevantAccountTypes = getReleventAccountTypes(intent);
    mDescriptionOverride = intent.getStringExtra(EXTRA_DESCRIPTION_TEXT_OVERRIDE);

    mAccounts = getAcceptableAccountChoices(VAccountManager.get());

    if (mDontShowPicker) {
        super.onCreate(savedInstanceState);
        return;
    }

    // In cases where the activity does not need to show an account picker, cut the chase
    // and return the result directly. Eg:
    // Single account -> select it directly
    // No account -> launch add account activity directly
    if (mPendingRequest == REQUEST_NULL) {
        // If there are no relevant accounts and only one relevant account type go directly to
        // add account. Otherwise let the user choose.
        if (mAccounts.isEmpty()) {
            setNonLabelThemeAndCallSuperCreate(savedInstanceState);
            if (mSetOfRelevantAccountTypes.size() == 1) {
                runAddAccountForAuthenticator(mSetOfRelevantAccountTypes.iterator().next());
            } else {
                startChooseAccountTypeActivity();
            }
        }
    }

    String[] listItems = getListOfDisplayableOptions(mAccounts);
    mSelectedItemIndex = getItemIndexToSelect(
            mAccounts, mSelectedAccountName, mSelectedAddNewAccount);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.choose_type_and_account);
    overrideDescriptionIfSupplied(mDescriptionOverride);
    populateUIAccountList(listItems);

    // Only enable "OK" button if something has been selected.
    mOkButton = (Button) findViewById(android.R.id.button2);
    mOkButton.setEnabled(mSelectedItemIndex != SELECTED_ITEM_NONE);
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:73,代码来源:ChooseTypeAndAccountActivity.java

示例15: onCreate

import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    if(savedInstanceState != null)
        videos = (MovieObservableResult[]) savedInstanceState.getParcelableArray(VIDEOS_KEY);

    //Dagger
    ((TgbApp) getApplication()).getAppComponent().inject(this);

    //Butter knife
    ButterKnife.bind(this);

    //Toolbar
    setSupportActionBar(toolbar);

    //Gallery adapter
    WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();

    screenDimensions = new Point();
    display.getSize(screenDimensions);

    mAdapter = new GalleryAdapter(
            this,
            screenDimensions,
            getResources().getConfiguration().orientation
    );

    //Recycler view grid
    RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(getApplicationContext(),
            getResources().getInteger(R.integer.gallery_columns));

    appbarParams = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();

    recyclerView.setLayoutManager(mLayoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.addItemDecoration(new SpacesItemDecoration(5));
    recyclerView.setAdapter(mAdapter);

    swipeRefreshLayout.setOnRefreshListener(() -> {
        videos = null;
        loadingDialog.show(view -> refresh());
    });

    refresh();
}
 
开发者ID:tgbMedia,项目名称:Android-app,代码行数:50,代码来源:MainActivity.java


注:本文中的android.os.Bundle.getParcelableArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。