有时候我们的app需要保存一些变量值以供程序在任何地方都能调用,因此会用到全局变量的保存方法。这里介绍两种方法供大家参考。
1:使用application来保存全局变量
1.1 定义一个类AppContext继承自Application
package com.example.demo_001.app;
import java.util.HashMap;
import java...
分类:
移动开发 时间:
2015-08-25 16:36:21
阅读次数:
141
Volley框架是Google I/O 2013大会上发布的。Volley是Google针对Android平台上的网络通信库而诞生,该框架能使网络通信更快,更简单,更健壮。Volley的特点有:
Ⅰ:通信更简单更快捷
ll:Get,Post网络请求及网络图像进行高效异步处理
III:可以对多个网络请求进行优先级排序以级多级别取消操作
IV:网络请求缓存及与Activity生命周期进行联动,...
分类:
移动开发 时间:
2015-08-25 16:37:24
阅读次数:
148
Ubiquitous Religions
Time Limit: 5000MS
Memory Limit: 65536K
Total Submissions: 27741
Accepted: 13588
Description
There are so many different religions in the world t...
分类:
其他好文 时间:
2015-08-25 16:35:36
阅读次数:
147
// define head function
#ifndef PS_ALGORITHM_H_INCLUDED
#define PS_ALGORITHM_H_INCLUDED
#include
#include
#include "cv.h"
#include "highgui.h"
#include "cxmat.hpp"
#include "cxcore.hpp"
#include "m...
分类:
其他好文 时间:
2015-08-25 16:36:06
阅读次数:
197
CSJON库基本数据格式 cJSON 定义
typedef struct cJSON {
struct cJSON *next,*prev; // 数组 对象数据中用到
struct cJSON *child; // 数组 和对象中指向子数组对象或值
int type; // 元素的类型,如是对象...
分类:
Web程序 时间:
2015-08-25 16:35:28
阅读次数:
1743
clc;
clear all;
close all;addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm');I=imread('4.jpg');
I=double(I);
Image=I/255;
[height, width, depth]=size(Image);wavelength = 20;
amplitude = 10...
分类:
其他好文 时间:
2015-08-25 16:37:15
阅读次数:
248
隔了段时间没有学习j2se,写了一段demo发现编译不成功,找不到需要编译的文件了,以一个最简单的程序为例,HelloWorld.java的程序
解决方法:
①判断JDK安装是否正确
先来看看JDK安装的对不对,我的JDK安装的是1.8.0_45版本的,放在了C盘,找到C:\jdk1.8.0_45\bin后,输入java
出现了下图,说明JDK安装正确!...
分类:
其他好文 时间:
2015-08-25 16:35:03
阅读次数:
142
题目:给定一个double类型的浮点数base和int类型的整数exponent。求base的exponent次方。下面来看代码:public class PowerSolution {
public static double Power(double base, int exponent) {
//当底数为0,指数小于0,则为非法情况。
if (equal(base,0....
分类:
其他好文 时间:
2015-08-25 16:34:49
阅读次数:
173
安卓代码混淆时经常会出现各种问题,下面罗列一些注意事项
1.依赖的工程中使用的jar包若和工程自身中的jar包一样的话,直接删除依赖工程中相同的jar包即可
2.native方法要阻止混淆
例:
# natvie 方法不混淆
-keepclasseswithmembernames class * {
native ;
}
3.若自定义基类Activity中有根据名称为...
分类:
移动开发 时间:
2015-08-25 16:35:29
阅读次数:
151
//将有二个有序数列a[first...mid]和a[mid...last]合并。
void mergearray(int a[], int first, int mid, int last, int temp[])
{
int i = first, j = mid + 1;
int m = mid, n = last;
int k = 0;
while (i <= m && j ...
分类:
编程语言 时间:
2015-08-25 16:36:55
阅读次数:
127
/*
Author: Tanky Woo
Blog: www.WuTianQi.com
棋盘覆盖问题
分治法
2010-12-3
*/
#include
using namespace std;
const int N = 11;
int Board[N][N];
int tile = 0;
/*
tr:棋盘左上角方格的行号
tc:棋盘左上角方格的列号
dr:特殊方格所在的行号
dc:特...
分类:
其他好文 时间:
2015-08-25 16:34:10
阅读次数:
194
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [?2,1,?3,4,?1,2,1,?5,4],
the contiguous subarray [4,?1,2,1] ha...
分类:
其他好文 时间:
2015-08-25 16:34:50
阅读次数:
164
#include
#include
void gametable(int k)
{
int a[100][100];
int n,temp,i,j,p,t;
n=2;//k=0两个参赛选手日程可以直接求得
a[1][1]=1;a[1][2]=2;
a[2][1]=2;a[2][2]=1;
for(t=1;t<k;t++)//迭代处理,...
分类:
其他好文 时间:
2015-08-25 16:35:31
阅读次数:
158
1.hash表简介:把任意长度的输入编程固定长度的输出,压缩映射。
2.解决哈希冲突的主要方法。...
分类:
其他好文 时间:
2015-08-25 16:36:39
阅读次数:
119
opencv 特征点的提取和匹配
#include
#include "opencv2/opencv.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/...
分类:
其他好文 时间:
2015-08-25 16:33:33
阅读次数:
214
#include
using namespace std;
int C[8];
int res = 0;//多少组解
void EightQueen(int n,int curr)
{
if (curr == n)
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
if (C[i] == j)...
分类:
其他好文 时间:
2015-08-25 16:36:09
阅读次数:
232
用C实现哈希函数,并实现其插入与显示方法...
分类:
其他好文 时间:
2015-08-25 16:34:14
阅读次数:
143