草庐IT

CONTEXT_IGNORE_SECURITY

全部标签

android - 使用 Room 在 `@Ignore` 结果中使用 `@Query` 字段

我有两个简单的location和houses表。我希望能够获取包含所有相关信息的location,并将house计数添加到该查询中。houseCount字段被标记为@Ignored因为我不想保存它。然而,Room似乎无法像使用指定为查询返回对象类型的任何其他类那样使用该字段从查询返回数据。我的领域:@Ignore@ColumnInfo(name=EXTRA_COLUMN_LOCATION_HOUSE_COUNT)publicinthouseCount;我的位置构造函数:publicLocation(longid,Stringname,LatLnglocation,longdefault

android - Settings.canDrawOverlays(context) 在 Android Oreo 上返回 false

list:代码activity.onCreate():if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.M&&BuildConfig.DEBUG){if(!Settings.canDrawOverlays(this)){Intentintent=newIntent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,Uri.parse("package:"+getPackageName()));startActivityForResult(intent,OVERLAY_PERMISSION_REQ_CODE);}

c# - Visual Studio 2017 Xamarin Android 编译警告 "fakeLogOpen(/dev/log_security) failed"中断构建

我正在尝试编译一个用C#编写的Android应用程序,在Windows上使用VisualStudio2017(和Xamarin)。每当我尝试编译项目并将其部署到android模拟器,我不断收到此警告:“fakeLogOpen(/dev/log_security)failed”。没有详细说明原因。为什么我会收到此错误/警告? 最佳答案 似乎他们为下一次更新修复了它:JonathanPryorThankyouforyourfeedback!Wehavefixedtheprobleminanupcomingrelease.Thankyou

android - 使用 Locale.getDefault() 和 context.getResources().getConfiguration().locale 的语言环境有什么区别?

返回的字符串有什么区别吗:Locale.getDefault().toString()和context.getResources().getConfiguration().locale.toString()询问是因为我怀疑这会导致应用程序中出现错误,在使用Locale.getDefault().toString()之前有效的功能不再适用于context.getResources()。getConfiguration().locale.toString(),在某些美国设备上。但不确定是否是这个原因。谢谢! 最佳答案 Locale.ge

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

这个问题在这里已经有了答案:WhatisaNullPointerException,andhowdoIfixit?(12个答案)关闭5年前。每当我尝试在我的手机或模拟器上打开该应用程序时,我的Logcat中都会出现此错误。为了让您大致了解我目前正在做的项目,它是一个记录连接到手机接入点的设备数据的系统,可以通过屏幕上的按钮打开和关闭。我想归功于:Android2.3wifihotspotAPI和https://www.whitebyte.info/android/android-wifi-hotspot-manager-classLogcat文件的图像是:https://i.gyazo

android - 方法 checkSelfPermission(Context, String) 未定义类型 ContextCompat

Contextcontext;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);Contextcontext=(Permission)this;//Inanactualapp,you'dwanttorequestapermissionwhentheuser//performsanaction//thatrequiresthatpermission.if(Build.VERSIO

android - 执行 createChooser(context,intent,IntentSender) 后不调用 BroadcastReceiver

我想检测用户在我向他展示createChooser()对话框后选择的应用程序。所以我创建了我的BroadcastReceiver子类,如下所示:importandroid.content.BroadcastReceiver;importandroid.content.Context;importandroid.content.Intent;importandroid.util.Log;publicclassShareBroadcastReceiverextendsBroadcastReceiver{@OverridepublicvoidonReceive(Contextcontext,

android - 我应该在 AsyncTask 中使用 Wea​​kReference<Context> 还是 Application Context?

我有点进退两难,希望大家能帮帮我。如你所见,我有一个AsyncTask我在其中保存了一些代码Bitmap将对象作为.jpg文件添加到图库中。在AsyncTask我也在使用Context,但据我所知,使用Activity的上下文在这个内部类中可能会导致内存泄漏,所以我将其更改为WeakReferenceweakContext;所以垃圾收集器可以收集它。但是通过使用Application我从传递的View中获得的上下文从构造函数我应该归档与弱上下文引用相同的效果那么在这种情况下使用哪个更好呢?publicclassViewToBitmap{privateViewview;privateWe

android - 使用 Context 获取 LayoutInflater

这两者有什么区别吗?inflater=(LayoutInflater)LayoutInflater.from(context);inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 最佳答案 目前还没有,正如您通过检查theLayoutInflatersourcecode可以看到的那样.from()将抛出一个Exception而不是返回null,但除此之外它们是相同的。就个人而言,我大部分时间都使用getLayoutIn

android - 构造函数 SimpleCursorAdapter(Context, int, Cursor, String[], int[]) 已弃用

如何解决这个问题?TheconstructorSimpleCursorAdapter(Context,int,Cursor,String[],int[])isdeprecated和ThemethodmanagedQuery(Uri,String[],String,String[],String)fromthetypeActivityisdeprecated代码如下:packagecom.example.kamusdigital;importandroid.app.Activity;importandroid.os.Bundle;importandroid.view.View;impor