草庐IT

protected-resource

全部标签

android - 如何修复未 protected SMS BroadcastReceiver lint 警告

我的应用需要能够接收短信。一切正常,但我收到此lint警告:BroadcastReceiversthatdeclareanintent-filterforSMS_DELIVERorSMS_RECEIVEDmustensurethatthecallerhastheBROADCAST_SMSpermission,otherwiseitispossibleformaliciousactorstospoofintents.如何“确保调用方具有BROADCAST_SMS权限”?在我的list中我有:我的代码:publicclassSmsReceiverextendsBroadcastReceiv

android - 检索项目 : No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored' 的父项时出错

今天,我遇到了这篇文章中提到的错误:Errorretrievingparentforitem:Noresourcefoundthatmatchesthegivenname'android:TextAppearance.Material.Widget.Button.Borderless.Colored'有趣的是(也是不同之处)——我们的应用程序已经投入生产5个月,到目前为止我们已经制作了数百个版本和APK。我们一周没有更改任何一行代码(也没有更改任何库版本)并且构建突然停止工作并出现这个提到的错误。Executionfailedfortask':react-native-fbsdk:pr

android.content.res.Resources$NotFoundException : String resource ID

应用程序抛出异常android.content.res.Resources$NotFoundException:StringresourceID我的情况并不常见(因为给定的ID确实存在)。我问这个问题是为了自己回答。请看下面我的回答为什么会发生这种情况以及为什么会发生在我身上。 最佳答案 您可能已经发现,当您尝试将某个整数设置为字符串时会发生此错误,例如:代码中的某处some_variable被声明为int并且您想显示它的值,因此您尝试将其设置为some_textview使用setText()方法:intsome_variable=

android - 将 Robolectric 与 Gradle 结合使用时的 Resources$NotFoundException

我一直在关注thistutorial关于设置Robolectric以测试我的AndroidGradle项目。我一直遇到这个错误:android.content.res.Resources$NotFoundException:nosuchlabelcom.mypackage.dev:string/app_name通过从教程下载示例项目,我确定问题出在我的productFlavors(开发、暂存、生产)。将风格添加到工作示例项目会导致同样的问题。你可以看到我的大纲build.gradleinthisanswer.我看到了各种答案(例如here),这表明我需要为每种风格指定sourceSet

android - 我应该如何在 Android 的 viewModel 中获取 Resources(R.string)(MVVM 和数据绑定(bind))

我目前正在为android使用databinding和MVVMarchitecture。在ViewModel中获取字符串资源的最佳方式是什么。我没有使用新的AndroidViewModel组件、eventbus或RxJava我正在经历接口(interface)的方法,其中Activity将负责提供资源。但是最近我发现了一个类似的问题this回答使用应用程序上下文的单个类在哪里提供所有资源。哪种方法更好?或者我可以尝试其他方法吗? 最佳答案 您可以通过实现AndroidViewModel而不是ViewModel来访问上下文。class

android - Xamarin : No resource found that matches the given names (AppCompat)

我在Azure上部署了一个虚拟机。我已经安装了VisualStudio2015、Xamarin和其他移动开发工具。我在本地计算机上进行了相同的设置,以通过VisualStudio在我的设备上测试我的应用唯一的区别是AndroidSDK的安装。在我的本地机器上,我没有图像系统。我在我的虚拟机上开发了一个应用程序。我在编译期间没有错误。我使用Android.Support.Design、Android.Support.V4、Android.Support.V7.AppCompat、Android.Support.V7.RecyclerView(NuGet的最新版本)及其MvvmCross实

C++默认移动分配无法访问 protected 基本成员

我有一段代码使用msvc编译,启用了语言扩展,但没有禁用语言扩展。它分解为这个最小的例子:classA{protected:A(constA&);A&operator=(constA&);A(A&&);A&operator=(A&&);};classB:publicA{public:B&operator=(B&&);};inlineB&B::operator=(B&&)=default;//errorC2248随着错误信息的出现C2248'A::A':cannotaccessprotectedmemberdeclaredinclass'A'第14行定义了移动赋值运算符。有趣的是,下面的

c++ - 使用 void_t 和 protected 嵌套类进行基于 SFINAE 的检测

我最近在void_t属性检测和protected/私有(private)类信息方面遇到了clang和gcc之间的一些不同行为。考虑如下定义的类型特征:#includetemplateconstexprconstboolhas_nested_type_v=false;templateconstexprconstboolhas_nested_type_v>=true;给定具有protected或私有(private)嵌套type类的示例类型和一个简单的程序#include"has_nested_type.hpp"#includestructProtected{protected:struc

c++ - friend 类无法访问 protected 成员

此代码过去适用于VisualStudio2015,但不再适用于VisualStudio2015update1。classFoo{protected:virtual~Foo(){};friendclassFoo__init;};classFoo__init{public:Foo_init;};staticFoo__init_Foo_init;失败并出现以下错误:ErrorC2248'Foo::~Foo':cannotaccessprotectedmemberdeclaredinclass'Foo'这是编译器错误还是代码格式错误? 最佳答案

c++ - 连接到派生类中的 protected 插槽

这是基类中声明的样子:protected:voidindexAll();voidcleanAll();在派生类中,以下不编译:indexAll();//OKconnect(&_timer,&QTimer::timeout,this,&FileIndex::indexAll);//ERRORconnect(&_timer,SIGNAL(timeout()),this,SLOT(indexAll()));//OK我想使用connect的第一个变体,因为它会进行一些编译时检查。为什么会返回错误:error:'voidFiles::FileIndex::indexAll()'isprotect