草庐IT

MEDIA_BUTTON

全部标签

android media player 显示音频但没有视频

我正在使用媒体播放器播放视频。它只播放音频而不播放视频。有人能帮忙吗?我的代码如下。publicclassVideoViewApplicationextendsApplication{@OverridepublicvoidonCreate(){}@OverridepublicvoidonTerminate(){}}publicclassVideoViewDemoextendsActivityimplementsOnErrorListener,OnBufferingUpdateListener,OnCompletionListener,MediaPlayer.OnPreparedList

android - Robotium ClickOnButton(int ID) 方法导致 "junit.framework.AssertionFailedError: Button with index 2131034130 is not available!"

我正在使用robotium进行测试,无法弄清楚如何单击没有文本的按钮。测试失败,跟踪:junit.framework.AssertionFailedError:Buttonwithindex2131034130isnotavailable! 最佳答案 索引系统是出于黑盒测试的原因所以如果你知道你想点击的View的资源ID你可以使用solo.getView(R.id)来获取一个hold对象,然后使用solo.clickOnView(Viewview)单击它。 关于android-Robot

android - ConstraintLayout - Button 下方的 RecyclerView 不遵守约束

我在ConstraintLayout中有一个RecyclerView和一个按钮。我希望Button位于顶部,RecyclerView位于其下方。尝试将app:layout_constraintTop_toBottomOf="@+id/button"设置为RecyclerView,但这并不符合要求。它看起来像这样:我想要按钮下方的RecyclerView。这是我的代码:我正在为Button的parent设置开始、顶部、结束和底部约束。对于RecyclerView,开始和结束到parent,顶部约束到button的底部我做错了什么? 最佳答案

android - 如何在 Google Map API V2 中使用 MyLocation-Button

我想在单击MyLocation-Button时显示Toast。我试试这段代码:publicvoidsetMyLocationLayerEnabled(Viewv){Toasttoast=Toast.makeText(getApplicationContext(),"ExampledeMessageforAndroid",Toast.LENGTH_SHORT);toast.show();}但是没有工作。我希望你们有人能帮助我! 最佳答案 map.setOnMyLocationButtonClickListener(newOnMyLoc

Android 系统在启动 Media Intent 时停止应用程序

我正在发布一个媒体Intent来拍照。用户拍照并返回到之前的Activity后,整个应用程序重新启动。由于这种情况不会一直发生,我认为我的应用程序会进入后台,当设备内存不足时android会终止它。有什么方法可以防止我的应用程序进入后台吗?谢谢! 最佳答案 这是Android中的正常行为,如果系统内存不足,所有当前在屏幕上不可见的Activity(在onStop之后)都可以在没有通知的情况下终止(即onDestory).这通常发生在我们的一个测试设备上的应用程序上,无论我们的应用程序如何,它都存在内存问题。当您通过Intent打开相

android - 从 MediaStore.Images.Media.DATA 获取图像的方向

我有一张图片的MediaStore.Images.Media.DATAuri,如何使用该uri获取MediaStore.Images.ImageColumns.ORIENTATION?我收到NullPointerException。以下是我的代码,privateintgetOrientation(Contextcontext,UriphotoUri){Log.v("orientatioon","notcrashed01");Cursorcursor=context.getContentResolver().query(photoUri,newString[]{MediaStore.Im

android - 图片 _display_name 在 com.android.provider.media/external.db 的外部数据库中更改

我在我的应用程序中使用MediaStore.Images.Media.EXTERNAL_CONTENT_URI(ExternalDB::data/data/com.android.provider.media/external.db))用我自己的_display_name保存图像,例如:image_101。jpg但一段时间后显示名称更改为长号。像1327392947034.jpg。下次当我用我的_display_name(image_101.jpg)获取图像时,它在外部数据库中什么也找不到。谁能告诉我为什么会这样?谢谢 最佳答案 我

android - 即使在 MEDIA_MOUNTED 状态下设置了权限和外部存储也无法写入 sdcard

在尝试将文件写入SD卡时出现java.io.FileNotFoundException:/filename(Read-onlyfilesystem)异常。遗憾的是,这里发布的许多解决方案都没有帮助我。我已经设置了权限并且外部存储处于MEDIA_MOUNTED状态。这是有问题的代码:Log.i("STORAGE",Environment.getExternalStorageState());OutputStreamfos=newFileOutputStream(Helpers.StripExtension(filePath)+".blk");fos.write(digest.getByt

android - URI 内容 ://media/external/file doesn't exist for some devices

我在使用某些设备时遇到问题。我无法在任何设备上复制它,但一些用户报告了很多崩溃报告。就是这个异常:java.lang.IllegalArgumentException:UnknownURLcontent://media/external/fileatandroid.content.ContentResolver.delete(ContentResolver.java:1024)我用这个:context.getContentResolver().delete(MediaStore.Files.getContentUri("external"),MediaStore.Files.FileC

android:button ="@null"不适用于较低的 API <= 19 设备

我将androidx.appcompat:appcompat的版本更新为1.1.0-alpha01以供使用newfeatures.但是在更新之后,带有RadioButton的android:button="@null"在API19以下的设备上停止工作并且不会删除默认的单选图标。有什么解决办法吗? 最佳答案 在我的例子中只对两者都有效android:button="@null"app:buttonCompat="@null"属性设置为@null 关于android:button="@nul