草庐IT

android - ACTION_GET_CONTENT : How to get file-ending when searching for multiple file types?

我正在使用Intent让用户选择一个文件,在用户完成后我想知道所选文件的文件类型。Intent:Intentintent=newIntent(Intent.ACTION_GET_CONTENT);intent.setType("*/*");在我的onActivityResult中,我想通过intent.getData()及其所有“子方法”(getScheme()、getLastPathSegment()等)从Intent中提取路径。但是,我只获得所选文件的Uri。Uris的示例:Uri:content://media/external/audio/media/15185//Thisis

android - 如何使用 ACTION_PACKAGE_FIRST_LAUNCH intent-filter 启动应用程序?

我正在尝试使用intent-filterACTION_PACKAGE_FIRST_LAUNCH让应用程序在首次启动时执行一些任务,但是它没有被广播接收器捕获我的list这是我的广播接收器实现this.context=context;StringmAction=intent.getAction();Log.i("r",mAction);if(mAction==Intent.ACTION_PACKAGE_DATA_CLEARED){}elseif(mAction==Intent.ACTION_PACKAGE_FIRST_LAUNCH){}如何让它在应用首次启动时启动?

android - 使用 Intent.ACTION_PICK 打开图像

我正在尝试使用intent.ACTION_PICK打开图像,但是当我使用startActivityForResoult启动Activity时,我的应用程序崩溃了。我做错了什么的任何线索?publicvoidbutton_load_image(Viewview){Stringpath=Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+SimpleCamera.getAlbumName();Filef=newFile(path);if(f.exists()){Log.d("button_load_image","

android - Material 设计 : how to set transparency for Android Floating Action Button

我的问题与this有关一。当我打开NavigationDrawer时,FloatingButton位于其顶部,但必须位于下方。我试着这样做:@OverridepublicvoidonDrawerSlide(ViewdrawerView,floatslideOffset){Log.i(TAG,"inneronDrawerSlide");super.onDrawerSlide(drawerView,slideOffset);fabButton.setAlpha(25);floatalpha=0.2f;AlphaAnimationalphaUp=newAlphaAnimation(alpha

Android ACTION_RECOGNIZE_SPEECH Intent 在长时间讲话后永远不会完成

我开始打算并等待结果。它在简短的演讲中效果很好,但如果演讲太长,它不会给我答案。(将近1分钟)finalIntentsearchIntent=newIntent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);searchIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE,"tr");searchIntent.putExtra(RecognizerIntent.EXTRA_PROMPT,true);searchIntent.putExtra(RecognizerIntent.EXTRA_ONLY_RETUR

android - Intent.ACTION_VIEW 视频网址不适用于 Ice Cream Sandwich

我有以下代码来查看远程托管的视频文件:startActivity(newIntent(Intent.ACTION_VIEW,Uri.parse(article.getLink())));其中getLink()返回与文章关联的视频的URL。此方法在Gingerbread之前的设备上运行良好,但我最近在ICS上测试该应用程序并发现了一个问题。ICS浏览器开始加载URL,我在导航栏中看到它,但浏览器几乎立即关闭,我又回到我的应用程序Activity中。当它发生时,我得到以下堆栈跟踪:11-2810:24:44.488:E/SurfaceTexture(116):[com.mypackage.

android - Google Glass GDK 是否支持 Intent.ACTION_CALL?

我正在尝试让一个在GoogleGlass上运行的Android应用程序来调用电话。这是调用Intent的代码:Stringuri="tel:+44.....";Intentintent=newIntent(Intent.ACTION_CALL);intent.setData(Uri.parse(uri));startActivity(intent);这会引发以下异常。09-2621:57:05.880:E/AndroidRuntime(4995):FATALEXCEPTION:main09-2621:57:05.880:E/AndroidRuntime(4995):android.co

java - 从(辅助功能)服务中填写任何应用程序的 EditText?

Lastpass如何管理这个?!AccessibilityNodeInfo有一个setText()方法,但我觉得这是一个转移注意力的文档状态,注意:不能从AccessibilityService调用。此类在交付给AccessibilityService之前是不可变的。前段时间另一个用户也问过类似的问题,但最近对LastPass的更新证明这确实是可能的。SettextinAccessibilityNodeInfo 最佳答案 我找到了比ACTION_PASTE更好的解决方案。我觉得ACTION_PASTE会造成延迟并且无法正常工作。AC

Android Wear - 从手持 Action 开始穿戴 Activity

我正在从Android手持设备向Android穿戴设备发送通知。我想在通知中包含一个Action,以在Android穿戴设备上启动一个Activity。如何将挂起的Intent设置为可穿戴设备上的Activity?如果通知是在可穿戴设备上创建的,我可以启动Activity,但如果通知是在手机上创建然后发送到可穿戴设备,我就不能启动该Activity。//creatingactionforpushnotificationcreatedonhandheldpublicNotificationCompat.ActionCreateWearAppAction(IntegermetricId){

Android 从图库中选择图像不起作用(Android 6.0 和 Android 5.1.1)

我正在使用下面的代码从设备库中选择一个图像文件:首先我调用这段代码:Intenti=newIntent();i.setType("image/*");i.setAction(Intent.ACTION_GET_CONTENT);startActivityForResult(Intent.createChooser(i,"SelectPicture"),RESULT_LOAD_IMAGE);这是我的onActivityResult方法:@OverrideprotectedvoidonActivityResult(intrequestCode,intresultCode,Intentdat