草庐IT

content_crawler

全部标签

Android:如何获取外部存储 PUBLIC 目录中文件的 content://URI

我关注了thisGoogletutorial使用newIntent(MediaStore.ACTION_IMAGE_CAPTURE)开始捕获图像的Intent。本教程建议使用带有getExternalStoragePublicDirectory的公共(public)目录,这对我的应用非常有用。但随后他们的示例改为使用getExternalFilesDir。然后使用MediaStore.EXTRA_OUTPUTIhavetogetacontentURI将文件的URI传递给Intent因为我想以AndroidN为目标。在以N为目标之前,我只需传递一个file://URI,除Google之外

java - 尝试在空对象引用上调用虚拟方法 'android.content.Context.getResources()'

我尝试使用fragment打开数据库,但是,当我单击按钮开始搜索时,程序意外终止并显示如下错误:java.lang.NullPointerException:Attempttoinvokevirtualmethod'android.content.res.Resourcesandroid.content.Context.getResources()'onanullobjectreferenceatandroid.widget.Toast.(Toast.java:102)atandroid.widget.Toast.makeText(Toast.java:259)atcom.exampl

Android PopupWindow 和 WRAP_CONTENT 不能一起工作

我打开一个这样的弹出窗口:mInfoPopup=newPopupWindow(layout,400,600,true);mInfoPopup.setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);然后窗口会获得指定的确切大小(400x600),并且不会根据内容调整其大小。我需要更改哪些内容才能使弹出窗口真正环绕其内容? 最佳答案 只需更改您创建它的方式:PopupWindowpopupMenu=newP

android - 如何使用 ConstraintLayout 制作 View "wrap_content but not larger than"?

我连续有3个View:标题、版本和ImageView(用作按钮):title应该是wrap_content但要遵守以下规则版本应该是wrap_content,在标题的右边和imageview的左边imageview大小固定,位于父级的右上角问题是如果标题太大,版本向右移动并且不遵守规则“版本在imageview的左侧”:所以我需要限制标题宽度并使版本可见而不向右移动。这里是XML:PS1.layout_width="0dp"+app:layout_constraintWidth_default="wrap"似乎正是我所需要的(“wrap_content但不破坏约束”)但它不起作用(仍然

android.content.ActivityNotFoundException : Unable to find explicit activity class

我收到此错误:06-0610:45:19.685:E/AndroidRuntime(554):android.content.ActivityNotFoundException:Unabletofindexplicitactivityclass{com.Android.myApp/com.Android.myApp.Facebook.Example};haveyoudeclaredthisactivityinyourAndroidManifest.xml?但是我已经在我的list文件中声明了它。这种异常的其他原因可能是什么?我的list.xml 最佳答案

Android - 为什么这告诉我 "Content view not yet created"?

这是在数据库fragment上填充ListView:publicViewonCreateView(LayoutInflaterinflater,ViewGroupcontainer,BundlesavedInstanceState){LinearLayoutLayout5=(LinearLayout)inflater.inflate(R.layout.tab_frag5_layout,container,false);CursorallBands;MyDatabasedb;Contextctx=(Context)TabFragment5.this.getActivity();db=ne

android - 由: java. lang.NoSuchMethodException : <init> [class android. content.Context,接口(interface)android.util.AttributeSet引起]

我在运行应用程序时收到此错误。错误:Causedby:java.lang.NoSuchMethodException:[classandroid.content.Context,interfaceandroid.util.AttributeSet]atjava.lang.Class.getConstructorOrMethod(Class.java:472)atjava.lang.Class.getConstructor(Class.java:446)atandroid.view.LayoutInflater.createView(LayoutInflater.java:574)ata

android - 使用 KitKat 存储访问框架后打开 Google Drive File Content URI

我正在使用适用于android4.4的存储访问框架并打开文件选择器。除了从GoogleDrive中选择文件外,一切正常,我只能弄清楚如何将其作为输入流打开,但我想获得一个javaFile对象。返回的内容uri如下所示:content://com.google.android.apps.docs.storage/document/acc%3D4%3Bdoc%3D2279其他类似但没有可让我获取文件名、文件大小和内容的有效解决方案的问题:GetrealpathfromURI,AndroidKitKatnewstorageaccessframeworkAndroidGalleryonKitK

Android studio 编译错误 "Content is not allowed in prolog"

我使用最新的AndroidStudio0.8.4(适用于OSX),在“res”目录中创建新的“database”目录并将所有需要的文件放在那里,当我尝试编译时收到此错误。Error:Contentisnotallowedinprolog.:app:mergeDebugResourcesFAILED/Users/filipp/data/Android_dev/project/app/src/main/res/database/5clSubject0Book0.txtError:Error:Contentisnotallowedinprolog.Error:Executionfailedf

android - 将 'wrap_content' 或 '-2' 分配给维度

我想创建一个等于“wrap_content”常量的维度。所以根据developer.android.comReference我写:-2但是ADT说:Error:Integertypesnotallowed(at'horizontal_border_height'withvalue'-2')分配'wrap_content'值也会产生错误。我做错了什么?任何想法如何使它工作? 最佳答案 要使用wrap_content或match_parent,您需要在dimens.xml文件中创建以下项目:-1-2那么你可以像这样简单地使用它:@dim