自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 Android Fragment中onActivityResult()方法获取不到返回数据或者无响应的解决办法

今天在项目中碰到一个需求,需要在Fragment中跳转到一个新的Activity之后在Fragment获取到新的这个Activity返回的数据,今天一直都无法获取返回的数据,在网上查了很久的资料后发现原来是这个项目的上一个逗比Coder少写了一行代码,真想分分钟拍死TA ( ▼-▼ )下面提供遇到问题的解决办法:我们正常情况下会从一个Activity A 跳转到另一个Activity B,然后在A

2016-04-21 11:27:56 1212

原创 Leetcode题解14 136. Single Number

Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra me

2016-04-19 10:07:22 265

原创 Leetcode题解14 26. 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

2016-04-18 11:09:41 227

原创 Leetcode题解15 292. Nim Game

You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the

2016-04-18 10:02:23 266

原创 Leetcode题解15 58. Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string.If the last word does not exist, return 0.Note: A word is defined as

2016-04-17 22:25:27 236

原创 Leetcode题解14 1. 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.Example: Given nums = [2, 7, 11,

2016-04-16 11:28:07 191

原创 Leetcode题解14 27. 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

2016-04-16 11:08:09 153

原创 Leetcode题解 232. Implement Queue using Stacks

Implement the following operations of a queue using stacks.push(x) – Push element x to the back of queue. pop() – Removes the element from in front of queue. peek() – Get the front element. empty()

2016-04-16 10:47:18 211

原创 Leetcode题解 155. Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) – Push element x onto stack. pop() – Removes the element on top of the stack. top() – Get the

2016-04-16 00:02:28 263

原创 Leetcode题解 231. Power of Two

Given an integer, write a function to determine if it is a power of two. 没啥说的,很简单的题。public static boolean isPowerOfTwo(int n) { if (n == 1) { return true; } else if (n <= 0

2016-04-15 23:50:48 250

原创 Leetcode题解 70. Climbing Stairs

You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?建表,查表法搞定,用递归会做重复工作,效率不高。public static

2016-04-15 23:36:04 242

原创 Leetcode题解 169. Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element always

2016-04-15 20:24:06 254

原创 Leetcode题解 217. Contains Duplicate

Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is

2016-04-15 18:19:37 205

原创 Leetcode题解 171. Excel Sheet Column Number

Given a column title as appear in an Excel sheet, return its corresponding column number.For example:A -> 1B -> 2C -> 3...Z -> 26AA -> 27AB -> 28 26进制,简单题。public static int titleToNumber(String

2016-04-15 17:51:53 222

原创 Leetcode题解 242. Valid Anagram

Given two strings s and t, write a function to determine if t is an anagram of s.For example, s = “anagram”, t = “nagaram”, return true. s = “rat”, t = “car”, return false.简单题,《程序员面试金典》原题public stati

2016-04-15 17:16:37 456

原创 Leetcode题解 8. String to Integer (atoi)

Implement atoi to convert a string to an integer.这道题挺难得,很多以外情况没能考虑到,花了一个多小时才搞定,代码感觉还比较丑陋。思路字串为空或者全是空格,返回0; 字串的前缀空格需要忽略掉;忽略掉前缀空格后,遇到的第一个字符,如果是‘+’或‘-’号(如果遇到多个’+’ / ‘-’ ,则返回0)继续往后读;如果是数字,则开始处理数字;如果不是前面

2016-04-15 16:52:46 240

原创 Leetcode题解 7. Reverse Integer

Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321要考虑溢出的情况,用try catch捕获异常,感觉这道题好无聊。public int reverse(int x) { String xx = String.valueOf(x); tr

2016-04-15 14:44:22 251

原创 Leetcode题解 258. Add Digits

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, r

2016-04-15 13:47:29 195

原创 Leetcode题解 125. Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, “A man, a plan, a canal: Panama” is a palindrome. “race a car” is not a palin

2016-04-15 12:56:06 200

原创 Leetcode题解 67. Add Binary

Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1” Return “100”. public static String addBinary(String a, String b) { Stack<Character> aStack = n

2016-04-15 11:49:33 273

原创 Leetcode题解 283. Move Zeroes

Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling your funct

2016-04-14 17:53:34 290

原创 Android横竖屏切换时的生命周期

横 --->竖竖--->横 都只完整调用一次如图所示的生命周期,有些博客写的两次的说法是错误的。

2016-04-05 16:37:16 264

原创 Android根据文件名(String类型)去查找R文件中的对应id(int类型)

图片名:img123456 int resId = getResources().getIdentifier("img123456", "drawable", context.getPackageName()); iv_info.setImageResource(resId);

2016-04-05 16:12:26 1897 1

转载 队列在Android中的使用

先科普一下队列:队列是一种特殊的线性表,特殊之处在于它只允许在表的前端(front)进行删除操作,而在表的后端(rear)进行插入操作,和栈一样,队列是一种操作受限制的线性表。进行插入操作的端称为队尾,进行删除操作的端称为队头。队列中没有元素时,称为空队列。队列的数据元素又称为队列元素。在队列中插入一个队列元素称为入队,从队列中删除一个队列元素成为出队。因为队列只允许在一段插入,在另一

2016-04-02 11:41:01 1995

转载 Android ActionBar应用实战,高仿微信主界面的设计

转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/26365683经过前面两篇文章的学习,我想大家对ActionBar都已经有一个相对较为深刻的理解了。唯一欠缺的是,前面我们都只是学习了理论知识而已,虽然知识点已经掌握了,但是真正投入到项目实战当中时会不会掉链子还很难说。那么不用担心,本篇文章我就将带领大家一起进入Action

2016-04-01 17:37:09 304

转载 GitHub 上排名前 100 的 Android 开源库进行简单的介绍

GitHub Android Librarys Top 100 简介本项目主要对目前 GitHub 上排名前 100 的 Android 开源库进行简单的介绍, 至于排名完全是根据GitHub搜索Java语言选择 (Best Match) 得到的结果, 然后过滤了跟Android不相关的项目, 所以排名并不具备任何官方效力, 仅供参考学习, 方便初学者快速了解当前一些流行的Android开

2016-04-01 16:30:35 689

转载 Fragment+FragmentTabHost实现仿新浪微博底部菜单栏

转载请注明出处:http://blog.csdn.net/yangyu20121224/article/details/9016223                在上一篇文章中,我们花了大量的篇幅来讲解Fragment这个新引进类的使用,目的就是为了让大家能够牢牢的掌握它的使用方法,以便读者在今后的开发中能够熟练的使用它。 一、实现效果图

2016-04-01 16:14:36 383

空空如也

空空如也

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

TA关注的人

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