草庐IT

host-context

全部标签

android - 为什么在 Picasso.with(context) 中,Picasso 要求提供上下文?

在Picasso.with(context)..publicstaticPicassowith(Contextcontext){if(singleton==null){synchronized(Picasso.class){if(singleton==null){singleton=newBuilder(context).build();}}}returnsingleton;}Builder(Context上下文)是这样的/**Startbuildinganew{@linkPicasso}instance.*/publicBuilder(Contextcontext){if(conte

mysql - 错误 1130 (HY000) : Host '' is not allowed to connect to this MySQL server

这个问题在这里已经有了答案:Host'xxx.xx.xxx.xxx'isnotallowedtoconnecttothisMySQLserver(28个回答)关闭5年前。为什么我连接不上mysql?mysql-uroot-ptest101-hxxx.xxx.xxx.xxxERROR1130(HY000):Host'xxx.xxx.xxx.xxx'isnotallowedtoconnecttothisMySQLserver在my.cnf我有以下内容#Insteadofskip-networkingthedefaultisnowtolistenonlyon#localhostwhichis

mysql - 错误 1130 (HY000) : Host '' is not allowed to connect to this MySQL server

这个问题在这里已经有了答案:Host'xxx.xx.xxx.xxx'isnotallowedtoconnecttothisMySQLserver(28个回答)关闭5年前。为什么我连接不上mysql?mysql-uroot-ptest101-hxxx.xxx.xxx.xxxERROR1130(HY000):Host'xxx.xxx.xxx.xxx'isnotallowedtoconnecttothisMySQLserver在my.cnf我有以下内容#Insteadofskip-networkingthedefaultisnowtolistenonlyon#localhostwhichis

android - 非法状态异常 : Could not find method insert(View) in a parent or ancestor Context class android. support.v7.widget.AppCompatButton

我已经在单个项目中启动了该程序,该程序运行正常。但是,当我复制并粘贴到一个更大的项目中时,它会在logcat中出现以下错误。FATALEXCEPTION:mainProcess:com.example.alan.mainactivity,PID:11545java.lang.IllegalStateException:Couldnotfindmethodinsert(View)inaparentorancestorContextforandroid:onClickattributedefinedonviewclassandroid.support.v7.widget.AppCompat

android - Kotlin 协程 : Switching context when testing an Android Presenter

我最近开始在我的Android项目中使用kotlin协程,但我在使用它时遇到了一些问题。许多人会称之为代码味道。我使用的是MVP架构,其中协程在我的演示器中像这样启动://WorklistPresenter.kt...overridefunloadWorklist(){...launchAsync{mViewModel.getWorklist()}...launchAsync函数是这样实现的(在我的WorklistPresenter类扩展的BasePresenter类中):@SynchronizedprotectedfunlaunchAsync(block:suspendCorouti

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

我有一个Activity,它本身有三个Fragment。在其中一个fragment中,有一个带有自定义适配器的RecyclerView,点击它的其中一项会转到另一个页面,这是同一个Activity的新实例。但是,某些行为会导致我的应用程序出错。在我的Activity中,单击其中一项会调出同一Activity的新实例,这很好。然后我按下后退按钮,我被带回第一个Activity。但是再次单击这些项目之一(以启动同一Activity的新实例)会导致以下错误:java.lang.NullPointerException:Attempttoinvokevirtualmethod'java.lan

android - 使用 Context.CONNECTIVITY_SERVICE 检查互联网连接

我正在使用此代码检查互联网连接:privatebooleancheckInternetConnection(){ConnectivityManagercm=(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);//testforconnectionif(cm.getActiveNetworkInfo()!=null&&cm.getActiveNetworkInfo().isAvailable()&&cm.getActiveNetworkInfo().isConnected()){returntrue;}e

android - AccessibilityManager 类型未定义方法 getinstance(Context)

我正在尝试创建我自己的ImagePreference,我将在我的应用首选项中使用它来选择用户选择代表他自己的图片。我不太确定自己在做什么,但基本上我是在模仿其他一些偏好类别。到目前为止,我在使用这种方法时遇到了麻烦:publicclassImagePreferenceextendsPreference{...voidsendAccessibilityEvent(Viewview){//Sincetheviewisstillnotattachedwecreate,populate,//andsendtheeventdirectlysincewedonotknowwhenit//willb

android - 无法在手机上运行应用程序进行测试 : Adb connection Error:An existing connection was forcibly closed by the remote host

我正在尝试运行我在手机上制作的应用程序进行测试,但我的设备没有出现在DDMS的“设备”选项卡中。下面是我在DDMSforandroid在eclipse中“重置adb”时得到的错误。我已经用谷歌搜索了这个错误和问题几个小时,但是没有一个解决方案对我有用,比如重置adb和终止进程。我不知道这是否重要,但我使用的是HTCOne。错误是:[2013-11-2201:59:03-DeviceMonitor]AdbconnectionError:Anexistingconnectionwasforciblyclosedbytheremotehost[2013-11-2201:59:04-Devic

安卓运行时异常 "Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag"

我在一个ListView中创建了多个布局,但是当我点击时我得到一个AndroidRuntimeException“从Activity上下文外部调用startActivity()需要FLAG_ACTIVITY_NEW_TASK标志。这真的是你想要的吗?”我正在添加Intent.FLAG_ACTIVITY_NEW_TASK我的Intent,但我得到了同样的信息!=(@OverridepublicViewgetView(intposition,ViewconvertView,ViewGroupparent){retval=LayoutInflater.from(getApplicationC