Example usage for android.content Intent getParcelableArrayListExtra

List of usage examples for android.content Intent getParcelableArrayListExtra

Introduction

In this page you can find the example usage for android.content Intent getParcelableArrayListExtra.

Prototype

public <T extends Parcelable> ArrayList<T> getParcelableArrayListExtra(String name) 

Source Link

Document

Retrieve extended data from the intent.

Usage

From source file:com.laevatein.Laevatein.java

/**
 * Obtains the selection result passed to your {@link Activity#onActivityResult(int, int, android.content.Intent)}.
 *
 * @param data the data./*from ww  w . j  a  v  a2 s  .c om*/
 * @return the selected {@link android.net.Uri}s.
 */
public static List<Uri> obtainResult(Intent data) {
    return data.getParcelableArrayListExtra(PhotoSelectionActivity.EXTRA_RESULT_SELECTION);
}

From source file:com.xbm.android.matisse.Matisse.java

/**
 * Obtain user selected media' {@link Uri} list in the starting Activity or Fragment.
 *
 * @param data Intent passed by {@link Activity#onActivityResult(int, int, Intent)} or
 *             {@link Fragment#onActivityResult(int, int, Intent)}.
 * @return User selected media' {@link Uri} list.
 *///from  w  w w . ja va2 s .co m
public static List<Uri> obtainResult(Intent data) {
    return data.getParcelableArrayListExtra(MatisseActivity.EXTRA_RESULT_SELECTION);
}

From source file:com.andremion.louvre.home.GalleryActivity.java

public static List<Uri> getSelection(Intent data) {
    return data.getParcelableArrayListExtra(EXTRA_SELECTION);
}

From source file:com.bilibili.boxing.Boxing.java

/**
 * get the media result.//from w w  w . ja v a  2s.com
 */
@Nullable
public static ArrayList<BaseMedia> getResult(Intent data) {
    if (data != null) {
        return data.getParcelableArrayListExtra(EXTRA_RESULT);
    }
    return null;
}

From source file:org.chromium.chrome.browser.util.IntentUtils.java

/**
 * Just link {@link Intent#getParcelableArrayListExtra(String)} but doesn't throw exceptions.
 *///from  w  w  w .  j a v  a  2s .co m
public static <T extends Parcelable> ArrayList<T> getParcelableArrayListExtra(Intent intent, String name) {
    try {
        return intent.getParcelableArrayListExtra(name);
    } catch (Throwable t) {
        // Catches un-parceling exceptions.
        Log.e(TAG, "getParcelableArrayListExtra failed on intent " + intent);
        return null;
    }
}

From source file:org.sanpra.minion.share.MediaShareActivity.java

/**
 * Checks intent action and extracts data from the intent
 * @param intent Intent from which data is to be extracted
 * @return Returns a collection of URIs extracted from the intent. If none are found, an empty list is returned.
 */// w w  w  .ja va 2  s .c  om
private static Collection<Uri> extractUriListFromIntent(final Intent intent) {
    Collection<Uri> uriList = new ArrayList<Uri>();

    if (intent.getAction().equals("android.intent.action.SEND")) {
        Uri mediaUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
        uriList.add(mediaUri);
    } else if (intent.getAction().equals("android.intent.action.SEND_MULTIPLE")) {
        uriList = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
    }

    return uriList;
}

From source file:org.solovyev.android.calculator.errors.FixableErrorsActivity.java

@Override
protected void onCreate(Bundle state) {
    super.onCreate(state);

    if (state != null) {
        errors = state.getParcelableArrayList(STATE_ERRORS);
    } else {//www  . j a  v  a  2 s . c o  m
        final Intent intent = getIntent();
        errors = intent.getParcelableArrayListExtra(EXTRA_ERRORS);
    }

    if (errors == null) {
        finish();
        return;
    }
    cast(getApplication()).getComponent().inject(this);
    if (state == null) {
        showNextError();
    }
}

From source file:com.xilconic.dominiontoolkit.Activities.Randomizer.GameSetupRandomizerActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_game_setup_randomizer);

    // Get list of DominionCards from intent:
    Intent i = getIntent();
    ArrayList<DominionCard> cardList = i.getParcelableArrayListExtra(EXTRA_CARD_LIST_KEY);

    // Create randomizer and...
    randomizer = new GameSetupRandomizer(cardList);
    // ... generate a random kingdom deck:
    if (savedInstanceState != null) {
        gameSetup = savedInstanceState.getParcelable(STATE_CURRENT_GAME_SETUP);
    } else {//from  w  ww. jav  a 2s  .  com
        generateGameSetup();
    }
    gameSetup.SetUp();

    // Set GameSetupFragment:
    FragmentManager fragmentManager = getSupportFragmentManager();
    GameSetupFragment fragment = (GameSetupFragment) fragmentManager.findFragmentByTag(GAME_SETUP_FRAGMENT_TAG);
    if (fragment == null) {
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragment = GameSetupFragment.newInstance(gameSetup);
        fragmentTransaction.add(R.id.gameSetupFragmentPlaceholder, fragment, GAME_SETUP_FRAGMENT_TAG);
        fragmentTransaction.commit();
    }
}

From source file:com.burnevsky.firu.TranslationsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_translations);

    // Instantiate a ViewPager and a PagerAdapter.
    TranslationsPagerAdapter mPagerAdapter = new TranslationsPagerAdapter(getSupportFragmentManager());

    ViewPager mPager = (ViewPager) findViewById(R.id.ta_pager);
    mPager.setAdapter(mPagerAdapter);//from   ww w . j a v a2 s  . com

    Intent intent = getIntent();
    List<Word> mWordList = intent.getParcelableArrayListExtra(INTENT_EXTRA_WORD_LIST);
    if (mWordList == null) {
        Log.d("firu", "TranslationsActivity: Unsupported intent given");
        finish();
    }
    int mWordIndex = intent.getIntExtra(TranslationsActivity.INTENT_EXTRA_WORD_IDX, 0);

    for (Word word : mWordList) {
        mFragments.add(createFragment(word));
    }

    mPagerAdapter.notifyDataSetChanged();
    mPager.setCurrentItem(mWordIndex);
}

From source file:hr.kodbiro.quickbyte.activities.TrolleyActivity.java

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

    // get Intent from MenuActivity with orderList
    Intent intent = getIntent();
    orderList = intent.getParcelableArrayListExtra("orderList");
    TrolleyListAdapter trolleyListAdapter = new TrolleyListAdapter(getApplicationContext(), orderList);

    // add list header
    View header = getLayoutInflater().inflate(R.layout.listview_header_trolley, null);
    header.setClickable(false);//  w w  w .j av a2 s  .  c om
    ListView listView = getListView();
    listView.addHeaderView(header);

    // populate ListView
    getListView().setAdapter(trolleyListAdapter);

    alertDialogBuilder = new AlertDialog.Builder(this);
}