Example usage for android.os Bundle getParcelableArrayList

List of usage examples for android.os Bundle getParcelableArrayList

Introduction

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

Prototype

@Nullable
public <T extends Parcelable> ArrayList<T> getParcelableArrayList(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:com.android.msahakyan.fma.fragment.TrackDetailFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle args = getArguments();

    mTracks = args.getParcelableArrayList(KEY_ITEM_LIST);
    mListPosition = args.getInt(KEY_ITEM_POSITION);

    mNetworkRequestListener = new NetworkRequestListener<Item>() {
        @Override/*from   ww w  .j av a2 s  .c  o  m*/
        public void onSuccess(@Nullable Item response, int statusCode) {
            if (response != null && statusCode == HttpURLConnection.HTTP_OK) {
                Timber.d("Received response for track details: " + response);
                setItem((Track) response);
                showBasicView();
                onItemLoaded(item);
            }
        }

        @Override
        public void onError(int statusCode, String errorMessage) {
            Timber.w(errorMessage);
            showErrorView();
        }
    };
}

From source file:de.gruenewald.udacity.spotifystreamer.ArtistFragment.java

@Nullable
@Override/*  w w  w  . ja  va2 s  . c o m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_artist, container, false);

    ButterKnife.inject(this, rootView);
    // fetch existing artistlist entries from the saved instance state to prevent
    // and empty list after rotating the device
    if (savedInstanceState != null) {
        mArtlistPosition = savedInstanceState.getInt(KEY_ARTLIST_POSITION);
        mArtistListEntries = savedInstanceState.getParcelableArrayList(KEY_ARTLIST_ENTRIES);
        repopulateListView(mArtistListEntries);
    } else {
        mArtlistPosition = -1;
        repopulateListView(null);
    }

    return rootView;
}

From source file:com.jrummyapps.busybox.fragments.ScriptsFragment.java

public void onRestoreInstanceState(@Nullable Bundle savedInstanceState) {
    if (savedInstanceState == null || !savedInstanceState.containsKey("scripts")) {
        new ScriptLoader().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } else {//  ww w .jav  a 2  s .c  o  m
        ArrayList<ShellScript> scripts = savedInstanceState.getParcelableArrayList("scripts");
        adapter = new Adapter(scripts);
        listView.setAdapter(adapter);
    }
}

From source file:com.sababado.support.v4.app.SearchableSupportListFragment.java

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

    //check for saved list
    if (savedInstanceState != null) {
        mSavedListData = savedInstanceState.getParcelableArrayList("list");
    }/*  w  w w . ja  va2 s .  c  om*/
}

From source file:pl.poznan.put.cs.ify.app.MainActivity.java

@Override
public void onActiveRecipesListReceiverd(Bundle data) {
    data.setClassLoader(getClassLoader());
    ArrayList<ActiveRecipeInfo> activeRecipeInfos = data.getParcelableArrayList(YRecipesService.Recipe_INFOS);
    getActiveRecipesFrag().updateData(activeRecipeInfos);

}

From source file:com.ultramegasoft.flavordex2.fragment.ViewFlavorsFragment.java

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    if (savedInstanceState != null) {
        mData = savedInstanceState.getParcelableArrayList(STATE_DATA);
        mEditMode = savedInstanceState.getBoolean(STATE_EDIT_MODE, false);
        mRadarView.setVisibility(View.VISIBLE);
    } else if (mData == null) {
        getLoaderManager().initLoader(LOADER_FLAVOR, null, this);
    } else {//  w  w w  . j a  v  a2 s  .c  o m
        mRadarView.setVisibility(View.VISIBLE);
    }
}

From source file:it.geosolutions.android.map.fragment.GetFeatureInfoFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onViewCreated(view, savedInstanceState);

    ListView list = (ListView) getActivity().findViewById(android.R.id.list);
    Bundle b = getArguments().getBundle("data");
    if (b == null) {
        return;//TODO notify problem
    }/*  w w w  . java2s.  c  om*/
    String[] from = { "name", "value" };
    int[] to = { R.id.attribute_name, R.id.attribute_value };
    Set<String> layerNameSet = b.keySet();
    for (String layerName : layerNameSet) {

        // Bundle layerBundle = b.getBundle(layerName);
        ArrayList<Bundle> layerBundleList = b.getParcelableArrayList(layerName);
        if (layerBundleList != null) {
            //if some data from the current section
            int featureListSize = layerBundleList.size();
            if (featureListSize != 0) {

                FeatureSectionAdapter fsa = new FeatureSectionAdapter();

                //create a section for every feature
                for (Bundle feature : layerBundleList) {

                    //Crete an array do display a list of strings...
                    //TODO improve this with a table

                    ArrayList<Map<String, String>> attributeList = new ArrayList<Map<String, String>>();
                    for (String attributeName : feature.keySet()) {
                        HashMap<String, String> attribute = new HashMap<String, String>();
                        attribute.put("name", attributeName);
                        attribute.put("value", feature.getString(attributeName));
                        attributeList.add(attribute);
                    }

                    //tableLayout.addView(adapter.getView(i, null, tableLayout))
                    Adapter adapter = new SimpleAdapter(view.getContext(), attributeList,
                            R.layout.feature_info_attribute_row, from, to);
                    //new ArrayAdapter<String>(view.getContext(), R.layout.feature_info_header,attributes)
                    fsa.addSection("", adapter);

                }
                ;

                layerSection.addSection(layerName, fsa);

            }
        }
    }
    // TODO init adapter with headers and data
    // 
    list.setAdapter(layerSection);

}

From source file:com.nbplus.vbroadlauncher.fragment.LoadIoTDevicesDialogFragmentStatus.java

private void handleDeviceList(Bundle b) {
    if (b == null) {
        return;// w  w  w .  j  a v a2  s .  c  o  m
    }
    ArrayList<IoTDevice> iotDevicesList = b.getParcelableArrayList(IoTServiceCommand.KEY_DATA);
    if (iotDevicesList != null) {
        mIoTDevicesList = iotDevicesList;
    } else {
        mIoTDevicesList = new ArrayList<>();
    }
    mDisabledDeviceList.clear();

    if (mGridAdapter == null) {
        mGridAdapter = new StickyGridHeadersIoTDevicesAdapter(getActivity(), mIoTDevicesList,
                R.layout.grid_iot_devices_header, R.layout.grid_iot_devices_item);

        mGridView.setAdapter(mGridAdapter);
    } else {
        mGridAdapter.setItems(mIoTDevicesList);
    }
    if (mGridAdapter.isEmpty()) {
        mSendButton.setEnabled(false);
        mSendButton.setClickable(false);
    } else {
        mSendButton.setEnabled(true);
        mSendButton.setClickable(true);
    }

    mHandler.postDelayed(new Runnable() {
        @Override
        public void run() {
            ((BaseActivity) getActivity()).dismissProgressDialog();
        }
    }, 500);
}

From source file:com.lloydtorres.stately.telegrams.TelegramReadActivity.java

@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
    // Restore state
    super.onRestoreInstanceState(savedInstanceState);
    id = savedInstanceState.getInt(ID_DATA);
    if (savedInstanceState != null) {
        if (title == null) {
            title = savedInstanceState.getString(TITLE_DATA);
        }//from w  ww . j  a  va  2 s .  com
        if (telegrams == null) {
            telegrams = savedInstanceState.getParcelableArrayList(TELEGRAM_DATA);
        }
    }
}

From source file:com.amaze.filemanager.fragments.CompressedExplorerFragment.java

private void onRestoreInstanceState(Bundle savedInstanceState) {
    compressedFile = new File(Uri.parse(savedInstanceState.getString(KEY_URI)).getPath());
    files = savedInstanceState.getParcelableArrayList(KEY_CACHE_FILES);
    isOpen = savedInstanceState.getBoolean(KEY_OPEN);
    elements = savedInstanceState.getParcelableArrayList(KEY_ELEMENTS);
    relativeDirectory = savedInstanceState.getString(KEY_PATH, "");

    decompressor = CompressedHelper.getCompressorInstance(getContext(), compressedFile);
    createViews(elements, relativeDirectory);
}