草庐IT

context_processors

全部标签

android - 未为类型 Context 定义方法 getSupportFragmentManager()

错误ThemethodgetSupportFragmentManager()isundefinedforthetypeContext当我在我的oncreateview中使用getSupportFragmentManager()时发生。使用了不同的上下文类型引用来克服这个错误,但这些都不起作用:例如globalContext=container.getContext();globalContext=getActivity().getApplicationContext();getSupportFragmentManager()只能在FragmentActivity中设置。我的问题是是否有

android - 数据绑定(bind) : How pass Context in xml to method?

安卓工作室3.0。这里是我的自定义方法:publicstaticintgetTileWidthDpInScreen(Contextcontext){//somecodeherereturntileWidthDp;}这里是我的带有数据绑定(bind)代码的xml文件:结果我得到错误:e:java.lang.IllegalStateException:failedtoanalyze:android.databinding.tool.util.LoggedErrorException:Founddatabindingerrors.databindingerrormsg:cannotfindm

android - ServiceConnection::onServiceConnected 没有被调用,即使 Context::bindService 返回 true?

我一直在尝试绑定(bind)从Activity启动时启动的服务。启动时的代码主要取自instantmessenger.这是3个主要组件的AndroidManifest.xml定义:接收器在启动时启动服务没有任何问题。但是,当我尝试从我的Activity绑定(bind)服务时,Context::bindService返回true,但ServiceConnection::onServiceConnected从未被调用。此外,当我从Activity中启动服务时,它会按预期工作(调用ServiceConnection::onServiceConnected)。 最佳

android - 从另一个 Context 向 HostApduService 传递信息

之前有人问过这个问题,但没有得到回应,所以我会尝试用不同的方式来表达这个问题。有哪些不同的方法可以将一些数据传递给AndroidService而不能绑定(bind)到它或自己启动它?这就是问题所在-我有一个HostApduService,它由操作系统在每次NFC卡交易时启动。它需要权限android.permission.BIND_NFC_SERVICE,这是一个系统权限,所以我的应用程序无法绑定(bind)到它。我不想让数据处于静止状态,因此写入磁盘的任何内容都是不行的。我想到了一些可能的解决方案,但它们要么困惑要么不安全:将数据放入我们应用的SharedPreferences。这就

android - AdvertisingIdClient.getAdvertisingIdInfo(context) 正在抛出 NoClassDefFoundError

我正在尝试使用AdvertisingIdClient获取我的AIR应用程序的广告ID。所以我喜欢AdvertisingIdClient.InfoadInfo=AdvertisingIdClient.getAdvertisingIdInfo(context)。我没有收到任何编译时错误。我从中生成了ANE。当控件遇到此语句时,它会立即抛出NoClassDefFoundError。我不知道到底发生了什么。这是我的扩展代码publicclassGetAdvertismentIDimplementsFREFunction{@OverridepublicFREObjectcall(FREConte

android - 确保先调用 FirebaseApp.initializeApp(Context)。默认 FirebaseApp 未在此过程中初始化 com.example.login

我正在使用kotlin制作Firebase身份验证注册页面,但在我运行该应用程序时出现运行时错误。请看第3行和第14行我不知道是什么问题。我没有附上主要代码,如果需要附上代码,请通知我。E/AndroidRuntime:FATALEXCEPTION:mainProcess:com.example.login,PID:7505java.lang.RuntimeException:UnabletoinstantiateactivityComponentInfo{com.example.login/com.example.login.Register}:java.lang.IllegalSt

解决方法:编译IMX6ULL裸机中断程序提示错误selected processor does not support `cpsid i‘ in ARM mode

一、问题编译IMX6ULL野火裸机中断程序出现错误:arm-none-eabi-gcc-g-cstart.Sstart.S:Assemblermessages:start.S:45:Error:selectedprocessordoesnotsupport`cpsidi'inARMmodestart.S:57:Error:selectedprocessordoesnotsupport`cps#0x12'inARMmodestart.S:61:Error:selectedprocessordoesnotsupport`cps#0x1F'inARMmodestart.S:65:Error:sele

android - 迁移后 Realm.getInstance(context) 不再工作

迁移后,我不能再使用Realm.getInstance(context);错误:java.lang.IllegalArgumentException:如果用于打开同一文件,配置不能有不同的架构版本。1对0我看到我必须使用之前创建的配置来进行迁移RealmConfigurationconfig1=newRealmConfiguration.Builder(this).schemaVersion(1).migration(newMigration()).build();现在我必须在所有使用的地方重新创建config1Realm.getInstance(上下文);我过去常常为每个方法添加这个

java - 错误 : "The newly created daemon process has a different context than expected"

这个问题在这里已经有了答案:GradleinAndroidStudiogivingerrorProjectsyncfailed(10个答案)关闭6年前。我想开始使用AndroidDeveloperStudio开发移动应用程序。我下载了具有SDK和JAVA要求的AndroidDeveloperStudio。但是当我尝试开始我的项目时,出现错误:Error:Thenewlycreateddaemonprocesshasadifferentcontextthanexpected.Itwon'tbepossibletoreconnecttothisdaemon.Contextmismatch:

android.content.res.Resources android.content.Context.getResources()' 在空对象引用上

我试图在我的SlidingTabLayout上显示图标,所以在我的适配器中我创建了这样的东西,我在寻找教程的某个时候找到了它我编辑了你将使用getDrawable的部分,因为它说它已经弃用并应用我找到的解决方案@OverridepublicCharSequencegetPageTitle(intposition){Drawableimage=ResourcesCompat.getDrawable(mContext.getResources(),icons[position],null);image.setBounds(0,0,48,48);SpannableStringsb=newSp