草庐IT

g_null_acl

全部标签

android - Handler.removeCallbacksAndMessages(null) 和主循环程序

在fragment的onDestory中,我放置了代码来清理我开始使用Handler.postDelayed的所有挂起的可运行对象。mUiHandler.removeCallbacksAndMessages(null);我有一个问题。调用mUiHandler.removeCallbacksAndMessages(null);安全吗?我的理解是,Android在主循环器中执行所有UI操作,如UI布局、UI渲染、组件生命周期(onCreate、onPause、onResume)。我理解正确吗?然后,当我在fragment中调用mUiHandler.removeCallbacksAndMes

java.lang.IllegalStateException: Type handler was null on parameter mapping for property ‘__frch_ite

今天做项目遇到了IllegalStateException以下是报错:2023-08-3112:54:39.429ERROR12230---[nio-8080-exec-2]o.a.c.c.C.[.[.[/].[dispatcherServlet]:Servlet.service()forservlet[dispatcherServlet]incontextwithpath[]threwexception[Requestprocessingfailed;nestedexceptionisorg.mybatis.spring.MyBatisSystemException:nestedexcept

android - 改造响应在 Android 中返回 null

我想显示来自JSON值的文本。我正在使用Retrofit进行API调用我不知道我做的是否正确。不管怎样,这是我的代码。这是url链接:http://api.icndb.com/jokes/random.网站每次都会显示一个随机笑话。以下是网站输出的示例:{"type":"success","value":{"id":175,"joke":"WhenChuckNorriswasababy,hedidn'tsuckhismother'sbreast.Hismotherservedhimwhiskey,straightoutofthebottle.","categories":[]}}fra

安卓:bitmapfactory.decodestream 返回 null

我试图从图像的路径中获取位图图像。但是BitmapFactory.decodeStream返回null值。代码:URLurl=newURL(path);HttpURLConnectionconnection=(HttpURLConnection)url.openConnection();connection.setDoInput(true);connection.connect();InputStreaminput=connection.getInputStream();BitmapmyBitmap=BitmapFactory.decodeStream(input);connectio

android - SDK 更新到 5.0 后 getActionBar() 返回 null

在我将AndroidSDK更新到版本5.0之后,getActionBar()方法开始返回null,导致我的应用程序在启动时崩溃。我不知道是什么原因造成的,任何现有的Stackoverflow线程都没有帮助。这是我的list:样式.xml:8dp5dp8dp5dp主题.xml:@style/ActionBar@style/OverflowButton@style/ActionBar@style/OverflowButton@drawable/menu@color/main@color/main和我的gradle依赖项:dependencies{compile'com.github.jen

android - geocoder.getFromLocationName 仅返回 null

在过去的两天里,我因IllegalArgumentException而失去理智当我试图从地址中获取坐标时,我在Android代码中收到错误,或者甚至相反,从经度和纬度中获取地址。这是代码,但我看不到错误。它是一个标准的代码fragment,很容易在Google搜索中找到。publicGeoPointdetermineLatLngFromAddress(ContextappContext,StringstrAddress){Geocodergeocoder=newGeocoder(appContext,Locale.getDefault());GeoPointg=null;try{Sys

android - 来自 TextView (getDrawingCache) 的位图始终为 null

我正在尝试提取与显示的TextView实例关联的位图,但它总是返回空值。我究竟做错了什么?我应该改用textview.draw(canvas)吗?TextViewtextview=(TextView)findViewById(R.id.text_title);textview.setDrawingCacheEnabled(true);textview.buildDrawingCache();Bitmapbmp=textview.getDrawingCache(); 最佳答案 在获取绘图缓存之前执行此操作将解决问题view.measu

android - 启用滚动时调用 `getDrawingCache` 返回 null

此代码中缺少什么?同样的代码适用于ICS。在API8上,滚动出现并且一些内容从屏幕上消失。这种情况下如何获取绘图缓存?代码:TableLayoutpage=(TableLayout)findViewById(R.id.page);page.setDrawingCacheEnabled(true);page.buildDrawingCache();//getDrawingCachereturnsnull...BitmappageBmp=Bitmap.createBitmap(page.getDrawingCache(true));page.destroyDrawingCache();pa

Android - MediaStore.Video.query() 返回 null

我正在尝试使用MediaStore.Video.query()方法从视频文件(标题、语言、艺术家)中检索元数据。但是,该方法始终返回null。代码如下:String[]columns={MediaStore.Video.VideoColumns._ID,MediaStore.Video.VideoColumns.TITLE,MediaStore.Video.VideoColumns.ARTIST};Cursorcursor=MediaStore.Video.query(getApplicationContext().getContentResolver(),videoUri,colum

android - NsdManager.DiscoveryListener.onServiceFound 的 NsdServiceInfo 中 Host 为 null

我正在尝试获取作为参数传递给NsdManager.DiscoveryListener.onServiceFound()的NsdServiceInfo的mHost,但它为空。我有两个android设备,其中设备1是服务器,设备2是客户端。这就是我在设备1中注册服务器的方式publicvoidregisterService(intport,InetAddressmyIp){NsdServiceInfoserviceInfo=newNsdServiceInfo();serviceInfo.setPort(port);serviceInfo.setServiceName(this.servic