- 博客(24)
- 收藏
- 关注
原创 android MVVM框架认识
1、框架图 这是安卓官方给出的一个基于MVVM框架的架构图。(我觉得而已,官方并没有这么说) 2、释义: 由 Activity 和 Fragment 共同承担的 view 部分,通过观察数据的方式,观察来自于ViewModel的数据变化,并做出相应变化。 ViewModel 可在被实例化时 从Fragment 处 获取 一些信息。它自身的数据来源于 Repository。 ...
2020-02-12 16:50:12
338
原创 android MVP框架认识
此章整理从网上看来的 对MVP框架的认识 1、框架图 2、释义: Model:业务逻辑与数据。数据分为本地数据(数据库 or SP)和 远程数据(通过网络请求拉去的数据)。 View:视图。 Presenter:将Model 和 View 接在一起的 中间层。 3、例子:谷歌官方todo-mvp 目录结构: data包对应model(MVP中的M) util包...
2020-02-12 16:48:41
222
原创 android时间管理(8.0)
1、获取时间 android获取时间的方法一般调用java的 System.currentTimeMillis()方法获取,这个方法,据网上博客所说,在linux下实质上是调用系统的gettimeofday()。获取当前时间(是1970年1月1日到现在的时间)。Date初始化时所用时间也是通过该方法获取的。 2、设置时间 目前我所知有两个接口设置时间。一个是在AlarmManager下的se...
2019-04-15 10:52:57
528
原创 linux命令记录
提取cert.rsa 证书内容: opensslpkcs7-informDER-inCERT.RSA-noout-print_certs-text 格式化u盘: sudo mkfs.ext4 /dev/sdb4
2019-03-28 16:51:55
135
原创 java基础学习--final
1、final属性的数据 对于基本数据类型:一旦第一次赋值之后,就不允许改变了。(声明的时候可以先不赋值) final int a = 6; // a = 7;会报编译错误,提示已分配变量给a 对于数组:一旦第一次赋值之后,就不允许改变了。(声明的时候可以先不赋值) final int a[]; int b [] = {5, 6, 7}; a = b;//mark int c [...
2018-12-08 11:56:27
171
原创 leetcode--------35. 搜索插入位置 关于二分查找的改进
题目:给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。 你可以假设数组中无重复元素。 示例 1: 输入: [1,3,5,6], 5 输出: 2 示例 2: 输入: [1,3,5,6], 2 输出: 1 示例 3: 输入: [1,3,5,6], 7 输出: 4 示例 4: 输入: [1,3,5,6...
2018-08-01 19:16:56
172
转载 leetcode——Maximum Subarray
给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。示例:输入: [-2,1,-3,4,-1,2,1,-5,4], 输出: 6 解释: 连续子数组 [4,-1,2,1] 的和最大,为 6。思路:设输入序列为A,长度为N,从a0开始求和并记录最大值,如a(0),a(0)+a(1),a(0)+a(1)+a(2)…,直到开始出现求和小于0则停止。设加到a...
2018-05-25 22:27:55
178
原创 leetcode第17题----- Count and Say
题目: The count-and-say sequence is the sequence of integers with the first five terms as following: 1. 1 2. 11 3. 21 4. 1211 5. 111221 1 is read off as "one 1" or 11. 1
2018-01-22 15:47:42
185
原创 leetcode第16题----- 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 t
2018-01-22 13:02:49
141
原创 leetcode第15题----- Implement strStr()
题目: Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Example 1: Input: haystack = "hello", needle = "ll" Output:
2018-01-22 11:55:53
198
原创 leetcode第14题----- 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 by modifying the input ar
2018-01-22 11:35:26
177
原创 leetcode第13题----- 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 by m
2018-01-21 22:56:55
125
原创 leetcode第12题----- Valid Parentheses
题目: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the correct order, "()" and "()[]{}" are
2018-01-21 21:56:32
305
原创 leetcode第11题----- Merge Two Sorted Lists
题目: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: Input: 1->2->4, 1->3->4 Output: 1->1->
2018-01-21 19:36:57
191
原创 leetcode第十题----- Longest Palindromic Substring
题目: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "bab" Note: "aba" is also a valid a
2018-01-21 18:55:54
224
原创 leetcode第九题----- Integer to Roman
题目:Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 解题思路:这里需要借鉴罗马数字的计数法。 相同的数字连写,所表示的数等于这些数字相加得到的数,如 Ⅲ=3; 小的数字在大的数字的右
2018-01-20 22:57:03
249
原创 leetcode第八题----- Container With Most Water
题目:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i
2018-01-20 22:40:17
210
原创 leetcode第七题----- Longest Substring Without Repeating Characters
题目: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the length is 3. Given "bbbbb", the answer is
2018-01-20 19:25:55
148
原创 leetcode第六题-----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
2018-01-20 12:58:48
183
原创 leetcode第五题-----Longest Common Prefix
题目:Write a function to find the longest common prefix string amongst an array of strings 解题思路: 主要思路如下:输入是一个字符串数组,对它进行纵向比较,从头开始将数组每一列中的字符进行比较,如果都相同,则添加到共有前缀字符串里(初始为空),否则,提前结束比较过程,并且输出共有前缀字符串。需要注意的是,不
2018-01-20 10:48:16
213
原创 leetcode第四题-----Roman to Integer
题目:Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999 中文意思就是,将罗马数字转换成整数。 解题思路:首先要了解罗马数字是怎样表示数的。这里借助百度百科的相关知识。 罗马数字是阿拉伯数字传入之前使用的一种数码。
2018-01-07 19:20:32
177
原创 leetcode第三题-----Palindrome Number
题目:Determine whether an integer is a palindrome. Do this without extra space 解法:问题是判断一个数是否回文数。回文数的特征是它从头到尾读和从尾到头读都是一样的。我的思路是,用两个临时变量,一个存储从头到尾读的数,另外一个存储从尾到头读的数,如果这两个值从头到尾一模一样的话,那么这个数就是回文数,否则,不是。
2017-12-24 23:24:16
172
原创 leetcode第二题-----Reverse Integer
Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 Note:
2017-11-05 21:24:00
149
原创 leetcode------第一题 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 sam
2017-09-17 17:33:11
149
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人