public class Calculate {
/**
* @param args
*/
private final static char[] arrayoperate = { '+', '-', 'x', '/' };
public char getOperate() {
Random rdm = new Random();
return arrayoperate[rdm.nextInt(4)];
}
public int getData2() {
Random rdm = new Random();
r...
public class Node {
private Object value;
public Node(Object value) {
this.value = value;
}
public String toString() {
return value == null ? "" : value.toString();
}
}
/***************************************************/
public class Border {
...
>>>>鼠标右键
>>>> Run Configurations
>>>>双击java application
>>>> 单击有main方法的类
>>>>选中classpath选项卡
>>>>remove掉... Entries下的android.jar
http://cslibrary.stanford.edu/110/BinaryTrees.html
public class BinTree {
private Node root;
public static class Node {
private int data;
private Node left;
private Node right;
public Node(int data) {
this.data = data;
}
}
public BinTree() {
this....
SQLite 數據庫
SQLite 版本控制類 SQLiteOpenHelper
@Override
onCreate();//只有在設備上不存在要獲取的數據庫時才會調用。
@Override
onUpgrade();
// 在更新表結構時, 只需要修改構造方法中的數據庫版本號,并在onUpgrade()方法中更新表結構的 SQL語句。
**************************************************************************...
拼接sql 字符串,一定留意空格符,错误好难找。
Sub Macro5()
'
' Macro5 Macro
' qunxingw 2016/5/21
全部录制。
'
Sheets("Sheet3").Select
Range("E1").Select
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("E1:E50")
Range("E1:E50").Select
Range("A1:C50").Select
Selection.Copy
Shee...
总结
总之Context在Android系统中的地位很重要,它几乎无所不能,但它也不是你想用就能随便用的,谨防使用不当引起的内存问题。如果还有疑问或者想了解更多内容,可以去看我的:视频课程
本文参考阅读:
http://blog.csdn.net/guolin_blog/article/details/47028975
http://blog.csdn.net/yanbober/article/details/45967639
文/尹star(简书作者)
原文链接:http://www.jianshu.com/p/94e0f9ab3f1d
著作权归作者所有,转载请...
public class Httpthread extends Thread{
String url;
WebView webView;
Handler handler;
public Httpthread(String url, WebView webView,Handler handler){
this.url=url;
this.webView=webView;
this.handler=handler;
}
public void run(){
try {
URL httpUrl=new URL(url);
t...
myweb = (WebView) findViewById(R.id.web);//找不到id时设置Project->Build Automatically,
myweb.loadUrl("http://www.baidu.com");
基本设计思想与8皇后差不多,注意2个细节
1,遍历时分数组中是否有原始数
2,在没有原始数时找k值时要用temp数组处理,主要是让temp[i][j]取不同的K值,以便递归。
package qunxingw.com;
import java.util.Scanner;
public class Soudu {
static int[][] array = new int[9][9];
public void show(int array[][]) {
for (int i = 0; i < 9; i++) {
...
Sub abc()
Dim dm As Variant
Dim m, w, d, r As Integer
y = InputBox("put_year")
m = InputBox("put_month")
d = DateSerial(y, m, 1)
w = Weekday(d)
r = 3
Range("3:10").ClearContents
Cells(1, 1) = y & "-year," & m & "-month"
dm = Array(31, 28, 31, 30, 31, 30, 31, 31, 30, ...
在资源的同步互斥中,生产者-消费者的含义是,系统中有很多生产者和消费者同时工作, 生产者负责 生产需要的资源,消费者消耗资源。 当消费者消费资源时,如果资源 不足,则等待。反之当生产者生产资源 时,如果资源已经满足需要,则也要等待该生产。同一时刻只能有一个生产者或消费者进行操作。
package com.qun;
public class Theaddemo {
class BreadContainer {
public static final int maxNum = 600;
private int num;
public BreadConta...
public class MainActivity extends Activity implements OnClickListener {
private TextView tv;
private Button bt1;
private Button bt2;
private Button bt3;
private Button bt4;
private Button bt5;
private Button bt6;
private Button bt7;
private Button bt8;
private Button bt9;
pr...
public class MyView extends View{
private int count=0;
public MyView(Context context) {
super(context);
}
public void onDraw(Canvas canvas){
int color = 0;
switch(count){
case 0:
color=Color.BLUE;
break;
case 1:
color=Color.LTGRAY;
break;
case 2:
c...
public class MainActivity extends AppCompatActivity {
public Button firstButton;
private Button secondButton;
private SQLiteDB dbHelper;
private final String dbName="helperdb";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedIn...
public class DownMainActivity extends Activity {
private static final int PROCESSING = 1;
private static final int FAILURE = -1;
private EditText pathText; // url地址
private TextView resultView;
private Button downloadButton;
private Button stopButton;
private ProgressBar progressB...
public class MainActivity extends Activity {
private Button btn;
private ProgressDialog dialog; //进度条
private MyAsyncTasck myAsyncTasck;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layo...
public class MainActivity extends Activity {
/*1*** 使用Thread的继承创建进程 ***/
public class MyThread extends Thread{
private int count=0;
public void run(){
while(count<100){
count++;
Log.i("======run=====", "count="+count);
System.out.println("线程");
}
}
}
/************使用run...
package com.example.postvalue;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class M...