本文整理了Java中android.content.Intent.<init>()
方法的一些代码示例,展示了Intent.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Intent.<init>()
方法的具体详情如下:
包路径:android.content.Intent
类名称:Intent
方法名:<init>
暂无
代码示例来源:origin: stackoverflow.com
// initialize the progress dialog like in the first example
// this is how you fire the downloader
mProgressDialog.show();
Intent intent = new Intent(this, DownloadService.class);
intent.putExtra("url", "url of the file to download");
intent.putExtra("receiver", new DownloadReceiver(new Handler()));
startService(intent);
代码示例来源:origin: stackoverflow.com
private void openScreenshot(File imageFile) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
Uri uri = Uri.fromFile(imageFile);
intent.setDataAndType(uri, "image/*");
startActivity(intent);
}
代码示例来源:origin: stackoverflow.com
/** on your logout method:**/
Intent broadcastIntent = new Intent();
broadcastIntent.setAction("com.package.ACTION_LOGOUT");
sendBroadcast(broadcastIntent);
代码示例来源:origin: stackoverflow.com
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
File file = new File(YOUR_SONG_URI);
intent.setDataAndType(Uri.fromFile(file), "audio/*");
startActivity(intent);
代码示例来源:origin: stackoverflow.com
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setClassName("com.android.camera", "com.android.camera.CropImage");
File file = new File(filePath);
Uri uri = Uri.fromFile(file);
intent.setData(uri);
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("outputX", 96);
intent.putExtra("outputY", 96);
intent.putExtra("noFaceDetection", true);
intent.putExtra("return-data", true);
startActivityForResult(intent, REQUEST_CROP_ICON);
代码示例来源:origin: smuyyh/BookReader
public static void start(Context context, String filePath) {
Intent intent = new Intent(context, ReadCHMActivity.class);
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.fromFile(new File(filePath)));
context.startActivity(intent);
}
代码示例来源:origin: stackoverflow.com
Intent intent = new Intent(this,MyAppWidgetProvider.class);
intent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
// Use an array and EXTRA_APPWIDGET_IDS instead of AppWidgetManager.EXTRA_APPWIDGET_ID,
// since it seems the onUpdate() is only fired on that:
int[] ids = {widgetId};
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,ids);
sendBroadcast(intent);
代码示例来源:origin: nickbutcher/plaid
public static void addToPocket(Context context,
String url,
String tweetStatusId) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setPackage(PACKAGE);
intent.setType(MIME_TYPE);
intent.putExtra(Intent.EXTRA_TEXT, url);
if (tweetStatusId != null && tweetStatusId.length() > 0) {
intent.putExtra(EXTRA_TWEET_STATUS_ID, tweetStatusId);
}
intent.putExtra(EXTRA_SOURCE_PACKAGE, context.getPackageName());
context.startActivity(intent);
}
代码示例来源:origin: stackoverflow.com
public void onBackPressed() {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
startActivity(intent);
}
代码示例来源:origin: stackoverflow.com
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE);
代码示例来源:origin: stackoverflow.com
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
startActivityForResult(Intent.createChooser(intent,
"Complete action using"), PHOTO_PICKER_ID);
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent i=new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (savedInstanceState==null) {
File dir=getExternalFilesDir(Environment.DIRECTORY_DCIM);
dir.mkdirs();
output=new File(dir, FILENAME);
}
else {
output=(File)savedInstanceState.getSerializable(EXTRA_FILENAME);
}
if (output.exists()) {
output.delete();
}
i.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(output));
startActivityForResult(i, CONTENT_REQUEST);
}
代码示例来源:origin: smuyyh/BookReader
public static void start(Context context, String filePath) {
Intent intent = new Intent(context, ReadPDFActivity.class);
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.fromFile(new File(filePath)));
context.startActivity(intent);
}
代码示例来源:origin: stackoverflow.com
Intent i = new Intent();
i.putExtra("name_of_extra", myParcelableObject);
代码示例来源:origin: nickbutcher/plaid
public static void startActionUpvote(@NonNull Context context, long storyId) {
final Intent intent = new Intent(context, UpvoteStoryService.class);
intent.setAction(ACTION_UPVOTE);
intent.putExtra(EXTRA_STORY_ID, storyId);
context.startService(intent);
}
代码示例来源:origin: square/leakcanary
private void startShareIntentChooser(Uri heapDumpUri) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("application/octet-stream");
intent.putExtra(Intent.EXTRA_STREAM, heapDumpUri);
startActivity(Intent.createChooser(intent, getString(R.string.leak_canary_share_with)));
}
代码示例来源:origin: stackoverflow.com
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file://" + "/sdcard/test.jpg"), "image/*");
startActivity(intent);
代码示例来源:origin: stackoverflow.com
ImageView img = (ImageView)findViewById(R.id.foo_bar);
img.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setData(Uri.parse("http://casidiablo.net"));
startActivity(intent);
}
});
代码示例来源:origin: google/ExoPlayer
private static Intent getIntent(
Context context, Class<? extends DownloadService> clazz, String action) {
return new Intent(context, clazz).setAction(action);
}
代码示例来源:origin: crazycodeboy/TakePhoto
/**
* 获取选择照片的Intent
*
* @return
*/
public static Intent getPickIntentWithGallery() {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_PICK);//Pick an item from the data
intent.setType("image/*");//从所有图片中进行选择
return intent;
}
内容来源于网络,如有侵权,请联系作者删除!