Java Code Examples for android.content.Intent.putParcelableArrayListExtra()

The following are Jave code examples for showing how to use putParcelableArrayListExtra() of the android.content.Intent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: android-util2   File: IntentHelper.java   View Source Code Vote up 8 votes
public static void share(AppCompatActivity context, List<String> paths) {

        if (paths == null || paths.size() == 0) {
            return;
        }
        ArrayList<Uri> uris = new ArrayList<>();
        Intent intent = new Intent();
        intent.setAction(android.content.Intent.ACTION_SEND_MULTIPLE);
        intent.setType("*/*");
        for (String path : paths) {
            File file = new File(path);
            uris.add(Uri.fromFile(file));
        }
        intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
        context.startActivity(intent);
    }
 
Example 2
Project: GravityBox   File: WifiPriorityActivity.java   View Source Code Vote up 8 votes
public void drop(int from, int to) {
    if (from == to) return;

    // Sort networks by user selection
    List<WifiNetwork> networks = mAdapter.getNetworks();
    WifiNetwork o = networks.remove(from);
    networks.add(to, o);

    // Set the new priorities of the networks
    int cc = networks.size();
    ArrayList<WifiConfiguration> configList = new ArrayList<>();
    for (int i = 0; i < cc; i++) {
        WifiNetwork network = networks.get(i);
        network.config.priority = cc - i;
        configList.add(network.config);
    }

    mNetworksListView.invalidateViews();

    Intent intent = new Intent(ModHwKeys.ACTION_UPDATE_WIFI_CONFIG);
    intent.putParcelableArrayListExtra(ModHwKeys.EXTRA_WIFI_CONFIG_LIST, configList);
    intent.putExtra("receiver", mReceiver);
    WifiPriorityActivity.this.sendBroadcast(intent);
}
 
Example 3
Project: Recognize-it   File: VideoMultipleWrapper.java   View Source Code Vote up 7 votes
@Override
public void start() {
    AlbumActivity.mSizeFilter = mSizeFilter;
    AlbumActivity.mMimeFilter = mMimeTypeFilter;
    AlbumActivity.mDurationFilter = mDurationFilter;
    AlbumActivity.sResult = mResult;
    AlbumActivity.sCancel = mCancel;
    Intent intent = new Intent(mContext, AlbumActivity.class);
    intent.putExtra(Album.KEY_INPUT_REQUEST_CODE, mRequestCode);
    intent.putExtra(Album.KEY_INPUT_WIDGET, mWidget);
    intent.putParcelableArrayListExtra(Album.KEY_INPUT_CHECKED_LIST, mChecked);

    intent.putExtra(Album.KEY_INPUT_FUNCTION, Album.FUNCTION_CHOICE_VIDEO);
    intent.putExtra(Album.KEY_INPUT_CHOICE_MODE, Album.MODE_MULTIPLE);
    intent.putExtra(Album.KEY_INPUT_COLUMN_COUNT, mColumnCount);
    intent.putExtra(Album.KEY_INPUT_ALLOW_CAMERA, mHasCamera);
    intent.putExtra(Album.KEY_INPUT_LIMIT_COUNT, mLimitCount);
    intent.putExtra(Album.KEY_INPUT_FILTER_VISIBILITY, mFilterVisibility);
    mContext.startActivity(intent);
}
 
Example 4
Project: AssistantBySDK   File: AssistantService.java   View Source Code Vote up 7 votes
@Override
public void onCalculateRoute2Home(boolean showInRouteGuide) {
    if (showInRouteGuide) {
        showRouteGuide();
    } else {
        BaiduAddress ad = BaiduNaviDao.getInstance().getHomeOrCompanyAddress(getResources().getString(R.string.home));
        BaiduAddress nad = BaiduNaviDao.getInstance().get(((AppConfig) getApplication()).address);
        ArrayList<BaiduAddress> list = new ArrayList<>();
        if (ad != null)
            list.add(ad);
        list.add(nad);
        if (EventBus.getDefault().hasSubscriberForEvent(MapCmdEvent.class)) {
            EventBus.getDefault().post(new MapCmdEvent(MapCmdEvent.SHOW_TRAFFIC, list));
        } else {
            Intent intent = new Intent(AssistantService.this, TrafficShowActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.putParcelableArrayListExtra("addresses", list);
            startActivity(intent);
        }
    }
}
 
Example 5
Project: Android-FileBrowser-FilePicker   File: FileIO.java   View Source Code Vote up 7 votes
public void shareMultipleFiles(List<FileItem> filesToBeShared){

        ArrayList<Uri> uris = new ArrayList<>();
        for(FileItem file: filesToBeShared){
            uris.add(Uri.fromFile(file.getFile()));
        }
        final Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
        intent.setType("*/*");
        intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
        PackageManager manager = mContext.getPackageManager();
        List<ResolveInfo> infos = manager.queryIntentActivities(intent, 0);
        if (infos.size() > 0) {
            mContext.startActivity(Intent.createChooser(intent, mContext.getString(R.string.share)));
        } else {
            UIUtils.ShowToast("No app found to handle sharing",mContext);
        }
    }
 
Example 6
Project: Linphone4Android   File: ApiElevenPlus.java   View Source Code Vote up 7 votes
public static Intent prepareEditContactIntentWithSipAddress(int id, String sipUri) {
	Intent intent = new Intent(Intent.ACTION_EDIT, Contacts.CONTENT_URI);
	Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, id);
	intent.setData(contactUri);
	
	ArrayList<ContentValues> data = new ArrayList<ContentValues>();
	ContentValues sipAddressRow = new ContentValues();
	sipAddressRow.put(Contacts.Data.MIMETYPE, SipAddress.CONTENT_ITEM_TYPE);
	sipAddressRow.put(SipAddress.SIP_ADDRESS, sipUri);
	data.add(sipAddressRow);
	intent.putParcelableArrayListExtra(Insert.DATA, data);
	
	return intent;
}
 
Example 7
Project: RxGallery   File: RxGalleryActivity.java   View Source Code Vote up 7 votes
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    Intent intent = new Intent(FINISHED_ACTION);
    ArrayList<Uri> uris = new ArrayList<>();

    if (resultCode == Activity.RESULT_OK) {
        switch (requestCode) {
            case RC_GALLERY:
                uris = handleGallery(data);
                break;
            case RC_TAKE_VIDEO:
                uris.add(data.getData());
                break;
            case RC_TAKE_PHOTO:
                uris.add(outputUri);
                break;
        }
    } else if (requestCode == RC_TAKE_PHOTO) {
        getContentResolver().delete(outputUri, null, null);
    }

    intent.putParcelableArrayListExtra(EXTRA_URIS, uris);
    sendBroadcast(intent);

    finishAll();
}
 
Example 8
Project: BaseCore   File: LocalShareUtils.java   View Source Code Vote up 7 votes
/**
 * 分享多图到指定软件,QQ,微信,新浪微博
 */
public static void ShareImagesToAssignAPP(Context context, List<File> fileList,String type) {
    boolean found = false;
    ArrayList<Uri> uriList = new ArrayList<>();
    Intent share = new Intent(Intent.ACTION_SEND_MULTIPLE);
    share.setType("image/*");
    for (int i = 0; i < fileList.size(); i++) {
        uriList.add(Uri.fromFile(fileList.get(i)));
    }
    List<ResolveInfo> resInfo = context.getPackageManager().queryIntentActivities(share, 0);
    if (!resInfo.isEmpty()){
        for (ResolveInfo info : resInfo) {
            if (info.activityInfo.packageName.toLowerCase().contains(type) ||
                    info.activityInfo.name.toLowerCase().contains(type) ) {
                share.setPackage(info.activityInfo.packageName);
                share.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uriList);
                found = true;
                break;
            }
        }
        if (!found)
            return;
        context.startActivity(Intent.createChooser(share, "分享到"));
    }
}
 
Example 9
Project: GitHub   File: BigPhotoActivity.java   View Source Code Vote up 6 votes
public static void launchForResult(Fragment fragment, ArrayList<BeautyPhotoInfo> datas, int index) {
    Intent intent = new Intent(fragment.getContext(), BigPhotoActivity.class);
    intent.putParcelableArrayListExtra(BIG_PHOTO_KEY, datas);
    intent.putExtra(PHOTO_INDEX_KEY, index);
    intent.putExtra(FROM_LOVE_ACTIVITY, true);
    fragment.startActivityForResult(intent, CommonConstant.REQUEST_CODE);
    fragment.getActivity().overridePendingTransition(R.anim.expand_vertical_entry, R.anim.hold);
}
 
Example 10
Project: VanGogh   File: VanMediaActivity.java   View Source Code Vote up 6 votes
@Override
public void onClick(View v) {
    if (v.getId() == R.id.tv_media_preview) {
        Intent intent = new Intent(this, VanFiltratePreviewActivity.class);
        intent.putExtra(BasePreviewActivity.EXTRA_DEFAULT_BUNDLE, mSelectedCollection.getDataWithBundle());
        startActivityForResult(intent, REQUEST_CODE_PREVIEW);

    } else if (v.getId() == R.id.tv_media_apply) {
        Intent result = new Intent();
        ArrayList<Uri> selectedUris = (ArrayList<Uri>) mSelectedCollection.asListOfUri();
        result.putParcelableArrayListExtra(EXTRA_RESULT_SELECTION, selectedUris);
        setResult(RESULT_OK, result);
        finish();
    }
}
 
Example 11
Project: buildAPKsSamples   File: SendReduced.java   View Source Code Vote up 6 votes
/** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      
Intent i = getIntent();
Bundle e = i.getExtras();
if (i.getAction().equals(Intent.ACTION_SEND)) {
	if (e != null &&
		e.containsKey(Intent.EXTRA_STREAM))  {
		new Utils(this).sendReduced(
				(Uri)e.getParcelable(Intent.EXTRA_STREAM));
	}
	finish();
}
else if (i.getAction().equals(Intent.ACTION_SEND_MULTIPLE)) {
	if (e != null &&
			e.containsKey(Intent.EXTRA_STREAM)) {
		ArrayList<Uri> in = e.getParcelableArrayList(Intent.EXTRA_STREAM);
		ArrayList<Uri> out = new ArrayList<Uri>();
		Utils utils = new Utils(this);
		
		for (Uri uri: in) {
			Uri reduced = utils.reduce(uri);
			if (reduced != null)
				out.add(reduced);
		}
		
		if (out.size()>0) {
			Intent go = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
			go.setType(Utils.MIME_TYPE);
			go.putParcelableArrayListExtra(android.content.Intent.EXTRA_STREAM, out);
			startActivity(go);
		}
	}
}
  }
 
Example 12
Project: Ships   File: ShowMapFragment.java   View Source Code Vote up 6 votes
private Intent getShareIntent() {
    final ArrayList<Uri> uris = new ArrayList<>();
    uris.add(FileProvider.getUriForFile(getActivity(),getActivity().getApplicationContext().getPackageName() + getString(R.string.dot_provider),fileMap));

    final Intent shareIntent = new Intent();
    shareIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
    shareIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_subject));
    shareIntent.putExtra(Intent.EXTRA_TEXT, "\n\n" + getString(R.string.share_text) + " " + getString(R.string.app_name) + " - " + getString(R.string.app_url));
    shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
    shareIntent.setType("*/*");

    return shareIntent;
}
 
Example 13
Project: Bridge   File: ChooserActivity.java   View Source Code Vote up 6 votes
/**
 * Start target select
 *
 * @param context
 */
public static void start(Context context) {
    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    shareIntent.setDataAndType(Uri.parse("content://example"), "*/*");
    List<ResolveInfo> resolveInfo = context.getPackageManager().queryIntentActivities(shareIntent, 0);

    Intent intent = new Intent(context, ChooserActivity.class);
    intent.putParcelableArrayListExtra(EXTRA_RESOLVE_INFO, ResolveInfoHelper.filter(resolveInfo, true));
    context.startActivity(intent);
}
 
Example 14
Project: TrainPonctuality   File: EditTravelActivity.java   View Source Code Vote up 6 votes
public void showDepartureStationList(View view) {
    if (stationList == null)
        return;
    Intent showList = new Intent(this, ShowStationListActivity.class);
    showList.putExtra("title", R.string.txtLocationHint);
    showList.putExtra("color", R.color.stationSelection);
    showList.putParcelableArrayListExtra("stops", stationList);
    startActivityForResult(showList, Utils.RESULT_GET_DEPARTURE_STATION);
}
 
Example 15
Project: Sega   File: ImagePickerActivity.java   View Source Code Vote up 6 votes
/**
 * Handle option menu's click event
 */
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();

    if (id == android.R.id.home) {
        onBackPressed();
        return true;
    }

    if (id == menuDoneId) {
        if (selectedImages != null && selectedImages.size() > 0) {

            /** Scan selected images which not existed */
            for (int i = 0; i < selectedImages.size(); i++) {
                Image image = selectedImages.get(i);
                File file = new File(image.getPath());
                if (!file.exists()) {
                    selectedImages.remove(i);
                    i--;
                }
            }

            Intent data = new Intent();
            data.putParcelableArrayListExtra(ImagePickerActivity.INTENT_EXTRA_SELECTED_IMAGES, selectedImages);
            setResult(RESULT_OK, data);
            finish();
        }
        return true;
    }
    if (id == menuCameraId) {
        //captureImage();
        captureImageWithPermission();
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 16
Project: boxing   File: BoxingViewActivity.java   View Source Code Vote up 6 votes
private void finishByBackPressed(boolean value) {
    Intent intent = new Intent();
    intent.putParcelableArrayListExtra(Boxing.EXTRA_SELECTED_MEDIA, mSelectedImages);
    intent.putExtra(EXTRA_TYPE_BACK, value);
    setResult(RESULT_OK, intent);
    finish();
}
 
Example 17
Project: AddressChecker   File: AddressCheckActivity.java   View Source Code Vote up 6 votes
/**
 * 选中。
 */
private void setResultFinish(City province, City city, City district) {
    ArrayList<City> cityArrayList = new ArrayList<>();
    cityArrayList.add(province);
    if (city != null)
        cityArrayList.add(city);
    if (district != null)
        cityArrayList.add(district);

    Intent intent = new Intent();
    intent.putParcelableArrayListExtra(KEY_OUTPUT_PROVINCE_CITY_DISTRICT, cityArrayList);
    setResult(RESULT_OK, intent);
    finish();
}
 
Example 18
Project: letv   File: KVUtils.java   View Source Code Vote up 5 votes
public static void putArrayList(Intent i, String key, ArrayList<Bundle> mArrayList) {
    if (i != null && !TextUtils.empty(key)) {
        i.putParcelableArrayListExtra(key, mArrayList);
    }
}
 
Example 19
Project: Android-Music-Player   File: libreryBtns.java   View Source Code Vote up 5 votes
public void onBtn(String name){
    if(name.equals("PLAY")){
        Ui.ef.MusicPlayer.handler.playByPlaylistId(data[1]);
        Ui.bk.back();
    } else if(name.equals("RENAME")){
        Ui.bk.back();
        final getText gt = new getText(getContext(), Ui.cd.DPW, Ui.cd.DPH,"ENTER TEXT FOR PLAYLIST"){
            @Override
            public boolean onEnter(String str) {
                if(-1 == playlistHandler.getPlaylistIdByName(Ui.ef.getContentResolver(),str)){
                    playlistHandler.updateName(Ui.ef.getContentResolver(),str,data[0]);
                    needReload();
                    return  true;
                }
                return super.onEnter(str);
            }
        };
        ContentHome.This.addPopup(gt);
        gt.setClickable(true);
        Ui.bk.add(new call() {
            @Override
            public void onCall(boolean bl) {
                ContentHome.This.removePopup(gt);
                InputMethodManager imm = (InputMethodManager) Ui.ef.getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(ContentHome.This.getWindowToken(), 0);
            }
        });
    }else if(name.equals("DELETE")){
        Ui.bk.back();
        getContext().getContentResolver().delete(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, MediaStore.Audio.Playlists._ID +" = ?", new String[]{data[1]});
        needReload();
    }else if(name.equals("SHARE")){
        Ui.bk.back();

        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_SEND_MULTIPLE);
        intent.putExtra(Intent.EXTRA_SUBJECT, "All Songs from this Albums...");
        intent.setType("image/jpeg"); /* This example is sharing jpeg images. */

        intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, getAlbumsFiles());
        Ui.ef.startActivity(intent);
    }
}
 
Example 20
Project: EasyTransition   File: EasyTransition.java   View Source Code Vote up 4 votes
/**
 * Start Activity for result, with transition options
 *
 * @param intent      The intent to start
 * @param requestCode If >= 0, this code will be returned in onActivityResult() when the activity exits,
 *                    see {@link Activity#startActivityForResult(Intent, int)}
 * @param options     Transition options, using {@link EasyTransitionOptions#makeTransitionOptions(Activity, View...)}
 *                    to build your options
 */
public static void startActivityForResult(Intent intent, int requestCode, EasyTransitionOptions options) {
    options.update();
    intent.putParcelableArrayListExtra(EASY_TRANSITION_OPTIONS, options.getAttrs());
    Activity activity = options.getActivity();
    activity.startActivityForResult(intent, requestCode);
    activity.overridePendingTransition(0, 0);
}