首页 文章 精选 留言 我的

精选列表

搜索[android studio],共10000篇文章
优秀的个人博客,低调大师

【Android错误集锦】Could not resolve net.qiujuer.genius:kit-handler:latest.i...

Error:A problem occurred configuring project ':app'. > Could not resolve all dependencies for configuration ':app:_debugApkCopy'. > Could not resolve net.qiujuer.genius:kit-reflect:latest.integration. Required by: project :app > net.qiujuer.common:okhttp:3.0.0 > Could not resolve net.qiujuer.genius:kit-reflect:latest.integration. > Failed to list versions for net.qiujuer.genius:kit-reflect. > Unable to load Maven meta-data from https://jcenter.bintray.com/net/qiujuer/genius/kit-reflect/maven-metadata.xml. > Could not GET 'https://jcenter.bintray.com/net/qiujuer/genius/kit-reflect/maven-metadata.xml'. > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target > Could not resolve net.qiujuer.genius:kit-handler:latest.integration. Required by: project :app > net.qiujuer.common:okhttp:3.0.0 > Could not resolve net.qiujuer.genius:kit-handler:latest.integration. > Failed to list versions for net.qiujuer.genius:kit-handler. > Unable to load Maven meta-data from https://jcenter.bintray.com/net/qiujuer/genius/kit-handler/maven-metadata.xml. > Could not GET 'https://jcenter.bintray.com/net/qiujuer/genius/kit-handler/maven-metadata.xml'. > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 解决方法:使用官方OKHTTP //网络请求依赖包 // compile 'net.qiujuer.common:okhttp:3.0.0' // compile 'com.squareup.okio:okio:1.7.0' compile 'com.squareup.okhttp3:okhttp:3.2.0' compile 'com.google.code.gson:gson:2.7'

优秀的个人博客,低调大师

Android笔记:Fragment与Activity之间的交互,onAttach,退出最后一个 fragment

一、交互代码笔记: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 private LoginFragmentListener mListener; @Override public void onAttach(Activity activity) { super .onAttach(activity); try { mListener = (LoginFragmentListener) activity; } catch (ClassCastException e) { // throw new ClassCastException(activity.toString() + "must implement LoginFragmentListener"); Log.e( "接口实现异常" , activity.toString() + "未实现LoginFragmentListener接口!" ); } } // 监听登录验证结果的接口 public interface LoginFragmentListener { // 登录完毕 public void OnLoginComplete(String result); // 登录失败 public void OnLoginFailed(String result); // 退出成功 public void OnLoginOutFailed(String mSessionId); // 退出失败 public void OnLoginOutComplete(String result); } 二、重写finish退出最后一个fragment 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 /** * 重写finish,当fragment栈中只剩最后一个fragment时才finish */ @Override public void finish() { if (getSupportFragmentManager().getBackStackEntryCount() == 0 ) { super .finish(); } else { getSupportFragmentManager().popBackStack(); } } 本文转自 glblong 51CTO博客,原文链接:http://blog.51cto.com/glblong/1322346,如需转载请自行联系原作者

优秀的个人博客,低调大师

Android第四十二期 - 关于微信手势退出Activity的操作

微信现在支持手势退出当前Activity了,我也接到需求就写了,代码已经整理好,效果图如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 public GestureDetectorgestureDetector= new GestureDetector( new OnGestureListener(){ @Override public boolean onSingleTapUp(MotionEvente){ return false ; } @Override public void onShowPress(MotionEvente){ } @Override public boolean onScroll(MotionEvente1,MotionEvente2, float distanceX, float distanceY){ return false ; } @Override public void onLongPress(MotionEvente){ } @Override public boolean onFling(MotionEvente1,MotionEvente2, float velocityX, float velocityY){ MyLogUtil.v( "e1.getX()->" ,e1.getX()+ "" ); //控制只右滑 if (e2.getX()-e1.getX()> 0 &&(e1.getX()>= 0 &&e1.getX()<= 100 )){ if (Math.abs(e2.getX()-e1.getX())>Math.abs(e2 .getY()-e1.getY()) &&Math.abs(velocityX)> 1000 ){ overridePendingTransition(R.anim.open_next, R.anim.close_main); //finish(); onBackPressed(); } } return false ; } @Override public boolean onDown(MotionEvente){ return false ; } }); @Override public boolean dispatchTouchEvent(MotionEventev){ gestureDetector.onTouchEvent(ev); //scroll.onTouchEvent(ev); return super .dispatchTouchEvent(ev); } 本文转自 吴雨声 51CTO博客,原文链接:http://blog.51cto.com/liangxiao/1671773,如需转载请自行联系原作者

优秀的个人博客,低调大师

Android多线程的研究(8)——Java5于Futrue获取线程返回结果

我们先来看看ExecutorService操作的方法: 在上一篇中我们使用了execute方法启动线程池中的线程运行,这一篇我们来看看submit方法的使用:submit提交一个返回值的任务用于运行,返回一个表示任务的未决结果的 Future。 该 Future 的get方法在成功完毕时将会返回该任务的结果。 import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; public class CallableAndFutrue { public static void main(String[] args) throws InterruptedException, ExecutionException { ExecutorService threadPool = Executors.newSingleThreadExecutor(); Future<String> future = threadPool.submit(new Callable<String>() { @Override public String call() throws Exception { Thread.sleep(2000); return "阳光小强"; } }); System.out.println(future.get()); } } 在上面代码中我们启动了一个线程,休眠了2秒后返回结果“阳光小强" import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; public class CallableAndFutrue { public static void main(String[] args) throws InterruptedException, ExecutionException { ExecutorService threadPool = Executors.newSingleThreadExecutor(); Future future = threadPool.submit(new Runnable(){ @Override public void run() { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } } }); System.out.println(future.get()); } } 提交一个 Runnable 任务用于运行。并返回一个表示该任务的 Future。该 Future 的get 方法在 成功 完毕时将会返回null 。 再看看最后一个submit。能够加入一个result,当线程运行完毕后会返回该result Future future = threadPool.submit(new Runnable(){ @Override public void run() { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } } }, "阳光小强"); 假设我们提交多个任务(也就是开启多个线程)后怎样有序的返回结果呢? 将生产新的异步任务与使用已完毕任务的结果分离开来的服务。 生产者submit运行的任务。使用者take已完毕的任务,并依照完毕这些任务的顺序处理它们的结果。比如。CompletionService能够用来管理异步 IO ,运行读操作的任务作为程序或系统的一部分提交,然后。当完毕读操作时。会在程序的不同部分运行其它操作。运行操作的顺序可能与所请求的顺序不同。 通常。CompletionService依赖于一个单独的Executor来实际运行任务。在这样的情况下。CompletionService仅仅管理一个内部完毕队列。ExecutorCompletionService类提供了此方法的一个实现。 import java.util.Random; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorCompletionService; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class CallableAndFutrue { public static void main(String[] args) throws InterruptedException, ExecutionException { ExecutorService threadPool = Executors.newFixedThreadPool(10); ExecutorCompletionService<Integer> ecs = new ExecutorCompletionService<>(threadPool); for(int i=0; i<10; i++){ final int seq = i; ecs.submit(new Callable<Integer>() { @Override public Integer call() throws Exception { Thread.sleep(new Random().nextInt(5000)); return seq; } }); } for(int i=0; i<10; i++){ System.out.println(ecs.take().get()); } } } 版权声明:本文博主原创文章,博客,未经同意不得转载。 本文转自mfrbuaa博客园博客,原文链接:http://www.cnblogs.com/mfrbuaa/p/4872318.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

Android GIS开发系列-- 入门季(5) FeatureLayer加载本地shp文件与要素查询

FeatureLayer是要素图层,也是Arcgis的主要图层。用这个图层可以加载本地的shp文件。下面我们看怎样加载shp文件到MapView中。查看ArcGis API可知FeatureLayer的构造方法要传一个FeatureTable,而FeatureTable可用子类ShapefileFeatureTable来实现。代码如下,其中shpPath为shp文件的本地路径。\ privatevoidinitLayer(){ try{ featureLayer=newFeatureLayer(newShapefileFeatureTable( shpPath)); featureLayer.setRenderer(newSimpleRenderer(newSimpleFillSymbol( Color.GREEN))); mapView.addLayer(featureLayer); }catch(Exceptione){ e.printStackTrace(); } } 效果图如下。 这样就可以很简单地加载shp文件了。下面我们来学习一下FeatureLayer的查询。 一、FeatureLayer点击查询主要用到的方法是featureLayer.getFeatureIDs(float x, float y, int tolerance),方法与上一讲GraphicsLayer的查询差不多。可以获取每个要素的属性属性值。 privatevoidhandleSingleTap(floatx,floaty){ long[]featureIds=featureLayer.getFeatureIDs(x,y,8); if(featureIds!=null&&featureIds.length>0){ for(longid:featureIds){ com.esri.core.map.Featurefeature=featureLayer.getFeature(id); Map<String,Object>attrs=feature.getAttributes(); Set<Entry<String,Object>>setEntry=attrs.entrySet(); for(Entry<String,Object>entryItem:setEntry){ Log.e(TAG, entryItem.getKey()+"===="+entryItem.getValue()); } } } } 二、利用FeatureTable查询,这是FeatureLayer特别的地方。比如在一个shp文件中,有多个要素,我们知道有每个要素中有name这个属性,怎样快速查询name为shanghai的要素呢?要用到FeatureTable的queryFeatures(QueryParametersquery,CallbackListener<FeatureResult> callback)方法或者是queryIds(QueryParametersquery,CallbackListener<long[]> callback)这个方法。 privatevoidqueryTable(){ FeatureTablefeatureTable=featureLayer.getFeatureTable(); QueryParametersparameters=newQueryParameters(); //查询条件,有点像数据库中的查询 parameters.setWhere("name='shanghai'");<spanstyle="white-space:pre"></span>Future<long[]>queryIds=featureTable.queryIds(parameters,newCallbackListener<long[]>(){ @Override publicvoidonError(Throwablearg0){ //TODOAuto-generatedmethodstub } @Override publicvoidonCallback(long[]arg0){ //TODOAuto-generatedmethodstub } }); try{ long[]Ids=queryIds.get(); if(Ids!=null&&Ids.length>0){ for(inti=0;i<Ids.length;i++){ Featurefeature=featureLayer.getFeature(Ids[i]); Log.i(TAG,feature.getAttributes().get("name")+""); } } }catch(InterruptedExceptione){ e.printStackTrace(); }catch(ExecutionExceptione){ e.printStackTrace(); } 这样就可以快速查询到某个具体的要素。 Code for all 没有整理与归纳的知识,一文不值!高度概括与梳理的知识,才是自己真正的知识与技能。 永远不要让自己的自由、好奇、充满创造力的想法被现实的框架所束缚,让创造力自由成长吧! 多花时间,关心他(她)人,正如别人所关心你的。理想的腾飞与实现,没有别人的支持与帮助,是万万不能的。 本文转自wenglabs博客园博客,原文链接:http://www.cnblogs.com/arxive/p/7751880.html ,如需转载请自行联系原作者

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册