草庐IT

allow-intent

全部标签

android - Intent : remove Always/Only once buttons

我是Android开发的新手。打开Intent.ACTION_GET_CONTENT时是否可以删除两个按钮(始终/仅一次)?这是我当前的代码。Intentintent=newIntent(Intent.ACTION_GET_CONTENT);intent.setType("image/*");startActivityForResult(intent,PICK); 最佳答案 我找到了实现这个的方法:Intentintent=newIntent(Intent.ACTION_GET_CONTENT);intent.setType("im

使用 Intent 的 android.content.ActivityNotFoundException

我正在编写一个应用程序,我试图在其中发送一封包含一些数据的电子邮件,但每当我点击提交按钮发送电子邮件时,得到:不幸的是应用程序已停止错误:android.content.ActivityNotFoundException:NoActivityfoundtohandleIntent{act=android.intent.action.SENDtyp=text/plain(hasextras)}代码:IntentemailIntent=newIntent(android.content.Intent.ACTION_SEND);emailIntent.setType("text/plain"

android - Intent 和 Parcelable 对象 Android

为什么我需要打包我的对象,即使我只需要将它发送到同一任务的另一个线程?实际上,我需要打开一个甚至会在同一线程(主线程)上运行的Activity。换句话说,为什么Google不提供采用通用对象广告参数而不是bundle的startActivity版本来让我启动一个Activity,以防我知道它在同一个进程中或(大多数时候)即使是同一个线程(主要线程)? 最佳答案 您不需要使用Parcelable将对象从一个Activity传递到另一个Activity。您可以只将对象的引用存储在静态成员变量中,如下所示:publicclassGloba

android - 仅与蓝牙选项共享 Intent

我正在尝试使用我的应用程序通过蓝牙发送文件。我已经将mime类型更改为随机类型,如asdxasd/asdxa该文件有一个我需要使用的扩展名,即.sso当我使用共享Intent时,它只出现蓝牙和gmail选项,但我不能从列表中删除gmail选项吗?提前致谢!我正在使用此代码发送它,目的是:file=newFileSystem(this).saveTemp();IntentsharingIntent=newIntent(Intent.ACTION_SEND);UriscreenshotUri=Uri.fromFile(file);sharingIntent.setType("test/on

android - 错误 : Error: Integer types not allowed (at 'layout_height' with value '10' )

每次我输入不带字符串的文本时,它都会给我一个黄色的Isign。所以我做了一个字符串。现在我在layout_height收到了上面的消息。我是android开发的新手。 最佳答案 使用dp或sp指定整数值android:layout_height="10dp"或android:layout_height="35sp" 关于android-错误:Error:Integertypesnotallowed(at'layout_height'withvalue'10'),我们在StackOverf

java - 如何使用 Intent 打开 "Add a Google Account" Activity ?

我的问题是如何在不使用需要以下权限的AccountManager的情况下使用Intent打开“添加Google帐户”Activity:我的意思是找到解决以下问题的方法:AccountManageraccountMgr=AccountManager.get(context);accountMgr.addAccount("com.google","ah",null,newBundle(),context,null,null);我将为所有寻求解决此问题的人提供解决方案。 最佳答案 通过提供EXTRA_ACCOUNT_TYPES来回答上述问

java - 从 Intent.createChooser 获取选择的应用程序

我正在trycatchIntent.createChooser的结果,以了解用户选择了哪个应用进行共享。我知道有很多帖子与此相关:Howtoknowwhichapplicationtheuserchosewhenusinganintentchooser?https://stackoverflow.com/questions/6137592/how-to-know-the-action-choosed-in-a-intent-createchooser?rq=1HowtogettheuserselectionfromstartActivityForResult(Intent.create

android - 可以在 Intent 中传递的字符串数据的最大大小

这个问题在这里已经有了答案:MaximumlengthofIntentputExtramethod?(Forceclose)(9个回答)关闭2年前。intentextra中可以传递的字符串数据是否有最大限制?下面的Stringstr可以容纳多少数据?intentI1.putExtra("MyString",str);

android - 从 PHONE_STATE Intent 操作中读取数字 android 9 不工作

我试图通过onrecieve()方法从list文件中注册的以下广播接收器的intentextra中检索电话号码。除了在我的Pixel2设备中升级的AndroidPie之外,我可以成功读取所有版本的电话号码。根据documentation,应用程序需要读取电话号码的额外权限,即READ_CALL_LOG权限和READ_PHONE_STATE权限,但即使在允许这些权限后,我仍然缺少READ_CALL_LOG权限,因此我无法读取电话号码。请帮我解决这个问题。 最佳答案 确保您在Android6.0+的运行时授予READ_PHONE_STA

Android:图库 Intent 返回 resultCode == RESULT_CANCELED

我正在启动从图库中挑选图片的Intent,但Intent总是返回结果代码RESULT_CANCELED。我尝试了很多不同的代码,但没有任何帮助让我觉得我可能遗漏了一些东西,比如在Androidlist的Activity中放了一些东西?我的代码://TheIntentIntentintent=newIntent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);startActivityForResult(intent,0);@OverrideprotectedvoidonA