自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(28)
  • 收藏
  • 关注

原创 进程和线程的概念

进程:进程是操作系统进行资源分配和调度的基本单位。由进程控制块(PCB)、程序段、数据段组成,进程控制块具有独立性,即指进程在系统中是一个可独立运行的、具有独立功能的基本单位。也是系统分配资源和进行调度的独立单位。运行过程中有三种基本状态,就绪状态、运行时状态、阻塞状态。线程:线程是处理器进行调度和运行的基本单位。线程基本上不拥有资源,只需要一些必不可少的资源(如程序计数器、一组寄存...

2018-10-14 23:52:18 197

原创 静态内部类和访问非静态成员变量

静态内部类访问包含它的外部类的非静态成员变量时,可以通过new外部类().成员的方式访问,这是因为静态的只能访问静态的,因为他们在对象没创建前就存在了。如果想访问非静态的则必须初始化该对象,因为只有初始化后对象在内存才存在(静态的除外)...

2018-07-04 16:04:41 4182

原创 android 定时任务

Android 定时任务有好几种实现方法,可以针对不同的情况使用。我先写我用过的这种,后面再补充。 一、利用Timer + TimerTask + runOnUiThread 实现定时任务 先介绍下从网上看到的使用方法 private TimerTask mTimerTask = new TimerTask() { @Override public vo...

2018-07-04 15:08:11 1394

原创 SmartRefreshLayout使用中遇坑总结

先放该第三方库的GitHub地址 https://github.com/scwang90/SmartRefreshLayout/tree/master

2018-06-11 15:32:11 25154 2

原创 常见排序算法及二分查找算法Java实现

插入排序、冒泡排序、归并排序、快速排序 要对这四种排序算法的思想理解熟记,并将代码牢记于心,还要知道四种算法的优劣之处。 一、插入排序(参考了此篇博客https://blog.csdn.net/Joseph_Cherry/article/details/60789718) 插入排序的思想: 不知道大家在生活中是如何思考排序这件事情的,就我来说,在打扑克牌(十三张那种哈)的时候,每拿到派发的...

2018-06-05 09:57:09 476

原创 设计模式之单例模式

首先要理解单例模式的意义,以及使用场景(这需要实战经验,多看代码,看别人在什么时候使用了单例模式,思考为什么在那里使用单例模式)。而这是最难的,一定要多总结,把所有遇到的单例模式的情景都可以总结进来 然后要知道单例模式的特点,理解什么样的定义是单例模式 最后要会写单例模式 一、单例模式特点1、单例类只能有一个实例2、单例类必须自己创建自己唯一的实例3、单例类必须给所有其他对象提供...

2018-06-02 00:25:50 183

原创 SmartRefreshLayout 下拉刷新上拉加载框架

首先,放上该智能第三方库的GitHub地址https://github.com/scwang90/SmartRefreshLayout/tree/master使用步骤 1、在build.gradle中添加依赖//1.1.0 API改动过大,老用户升级需谨慎compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-6'...

2018-06-01 23:34:21 2304

转载 android中Uid Pid是什么

PID:为Process Identifier, PID就是各进程的身份标识,程序一运行系统就会自动分配给进程一个独一无二的PID。进程中止后PID被系统回收,可能会被继续分配给新运行的程序,但是在android系统中一般不会把已经kill掉的进程ID重新分配给新的进程,新产生进程的进程号,一般比产生之前所有的进程号都要大。UID:一般理解为User Identifier,UID在linux中...

2018-04-12 16:06:22 865

原创 在自定义ViewGroup实现轮播图时遇到的第一个问题,

在使用AIDL时遇到错误:找不到符号 解决方法: https://blog.csdn.net/baidu_30164869/article/details/51036405

2018-04-10 11:30:20 200

原创 genymotion模拟器访问本机服务器地址

genymotion模拟器访问本机服务器地址时,本机地址为10.0.3.2,不再是127.0.0.1, 如果是用android studio 自带的模拟器,本机地址为10.0.2.2, 另外,模拟器上的wifi一定要打开,

2018-01-09 11:24:37 840

原创 Android之DecorView

DecorView是窗口最顶层的视图,其具体意思及用法参考 http://www.cnblogs.com/beenupper/archive/2012/07/13/2589749.html 获得当前活动的DecorView通过下面一行代码View decorView=getWindow().getDecorView();setSystemUiVisibility方法和getSystemUiVis

2017-12-11 17:01:11 417

原创 ImageView属性scaleType用法

scaleType的几种取值及区别参照 http://blog.csdn.net/larryl2003/article/details/6919513 或者 http://blog.csdn.net/u012702547/article/details/50586946 两篇都写的很清楚。

2017-12-11 15:46:25 198

原创 android 如何设置背景的透明度

安卓设置背景的透明度参考:http://blog.csdn.net/qiaoning13256/article/details/6910570

2017-12-08 09:55:22 416

原创 Error:(23, 0) Gradle DSL method not found: 'google()'

在使用glide时,刚开始在gradle中引人库时,用的是https://github.com/bumptech/glide直接复制粘贴过来的,如下所示:repositories { mavenCentral() google()}dependencies { implementation 'com.github.bumptech.glide:glide:4.4.0' annota

2017-12-05 17:01:53 24126 3

原创 LayoutInflator的用法

本来想自己把郭大神的博客总结写下的,但是由于郭大神里面还讲了源码,而以我现在的水平还理解不了,所以就先放个链接在这里吧。希望后面可以自己总结下。 在一个Activity中里如果直接用findViewById()的话,对应的是setContentView()的那个layout里的组件,如果当前需要用到别的layout,再设置这个layout里的组件,就必须用inflate()方法把la

2017-11-20 18:46:23 459

原创 Remove Nth Node From End of List

Given a linked list, remove the nth node from the end of list and return its head.For example,Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, the linked list be

2017-10-14 23:36:07 262

原创 Add Two Numbers

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it

2017-10-14 21:21:06 285

原创 疯狂JAVA讲义-接口和抽象类比较

相同点: 1、接口和抽象类都不能被实例化,都位于继承树的顶端,用于被其他类实现和继承 2、接口和抽象类都可以包含抽象方法,实现接口或继承抽象类的普通子类都必须实现这些抽象方法。 不同点: 从设计目的来看: 接口体现的是一种规范。对于接口的实现者而言,接口规定了实现者必须向外提供哪些服务(以方法的形式来提供),对于接口的调用者而言,接口规定了调用者可以调用哪些服务,以及如何调用这些服务(就是

2017-10-04 23:14:35 228

原创 疯狂JAVA讲义-接口

接口(interface)定义了一种规范,定义了某一批类所需要遵守的规范,不关心这些类里方法的实现细节,只规定这批类里必须提供某些方法。 一个接口可以有多个直接父接口,但接口只能继承接口,不能继承类。 接口里不能包含构造器和初始化块定义。接口里可以包含Field(只能是常量)、方法(只能是抽象实例方法)、内部类(包括内部接口、枚举)定义。接口里的所有成员,包括常量、方

2017-10-04 22:37:40 247

原创 Search Insert Position

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.Here

2017-10-04 12:45:37 184

原创 Implement strStr().

Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.class Solution { public int strStr(String haystack, String needle) { if (haystack.l

2017-10-04 09:04:30 183

原创 Remove Element

Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.The order

2017-10-04 08:12:26 320

原创 Remove Duplicates from Sorted Array

Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with cons

2017-10-03 23:30:45 162

原创 Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.class Solution { public String longestCommonPrefix(String[] strs) { if(strs.length==0)//要注意字符串数组越界的判断

2017-10-03 17:46:39 225

原创 Java之String类、StringBuffer类和StringBuilder类

String类是不可变类,即一旦一个String对象被创建后,包含在这个对象中的字符序列是不可改变的,直至这个对象被销毁。 StringBuffer对象则代表一个字符序列可变的字符串,当一个StringBuffer被创建后,通过StringBuffer提供的append()、insert()、reverse()、setCharAt()、setLength()等方法可以改变这个字符串对象的字符序列,

2017-10-03 17:16:59 228

原创 Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space. 判断一个整数是否为回文,即顺读和倒读是否一样。class Solution { public boolean isPalindrome(int x) { if(x<0)//当x为负数时,肯定不是回文 r

2017-10-03 10:22:57 158

原创 Reverse digits of an integer.

Example1: x = 123, return 321 Example2: x = -123, return -321 Note: The input is assumed to be a 32-bit signed integer. Your function should return 0 when the reversed integer overflows.class Soluti

2017-10-03 09:42:35 298

原创 Two Sum

Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same ele

2017-10-03 08:27:45 279

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除