本文整理汇总了Java中android.content.Intent.putParcelableArrayListExtra方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.putParcelableArrayListExtra方法的具体用法?Java Intent.putParcelableArrayListExtra怎么用?Java Intent.putParcelableArrayListExtra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.putParcelableArrayListExtra方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: share
import android.content.Intent; //导入方法依赖的package包/类
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);
}
示例2: start
import android.content.Intent; //导入方法依赖的package包/类
@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);
}
示例3: onCalculateRoute2Home
import android.content.Intent; //导入方法依赖的package包/类
@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);
}
}
}
示例4: shareMultipleFiles
import android.content.Intent; //导入方法依赖的package包/类
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);
}
}
示例5: prepareEditContactIntentWithSipAddress
import android.content.Intent; //导入方法依赖的package包/类
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;
}
示例6: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
@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();
}
示例7: ShareImagesToAssignAPP
import android.content.Intent; //导入方法依赖的package包/类
/**
* 分享多图到指定软件,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, "分享到"));
}
}
示例8: drop
import android.content.Intent; //导入方法依赖的package包/类
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);
}
示例9: launchForResult
import android.content.Intent; //导入方法依赖的package包/类
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);
}
示例10: onClick
import android.content.Intent; //导入方法依赖的package包/类
@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();
}
}
示例11: onCreate
import android.content.Intent; //导入方法依赖的package包/类
/** 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);
}
}
}
}
示例12: getShareIntent
import android.content.Intent; //导入方法依赖的package包/类
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;
}
示例13: start
import android.content.Intent; //导入方法依赖的package包/类
/**
* 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);
}
示例14: showDepartureStationList
import android.content.Intent; //导入方法依赖的package包/类
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);
}
示例15: onOptionsItemSelected
import android.content.Intent; //导入方法依赖的package包/类
/**
* 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);
}