@Override
public void onClick(View v) {
switch (v.getId()) {
1.
case R.id.btn_addPic:
break;
2.
case R.id.btn_reflectPic:
break;
default:
break;
}
}
如果黑色字体的break你忘记了写。。。
那么程序就会从...
分类:
其他好文 时间:
2014-10-25 11:55:59
阅读次数:
150
世界上最遥远的距离,是我在if里,你在else里,似乎一直相伴又永远分离;世界上最痴心的等待,是我当case,你是switch,或许永远都选不上 自己;世界上最真情的相依,是你在try,我在catch。无论你发神马脾气,我都默默承受,静静处理。到那时,再来期待我们的finally !hello wo...
分类:
其他好文 时间:
2014-10-24 20:24:12
阅读次数:
221
看到下面代码中用了AND位运算是为了什么呢? public boolean onTouchEvent(MotionEvent event) { int action = event.getAction(); switch (action & MotionEvent.ACTION_MASK) { .....
分类:
其他好文 时间:
2014-10-24 15:59:53
阅读次数:
199
Java7中的switch支持String的实现细节作者:zsxwing更新: 2013-03-04 21:08:02 发布: 2012-04-26 13:58:19在Java7之前,switch只能支持 byte、short、char、int或者其对应的封装类以及Enum类型。在Java7中,呼吁...
分类:
编程语言 时间:
2014-10-24 00:02:06
阅读次数:
203
1、switch语句执行过程:从第一个匹配条件开始,后边的所有代码都执行,直至结束或遇到 break;
#include
int main()
{
int x = 1,a = 0,b = 0;
switch(x){
case 0:b++;
case 1:a++;
case 2:a++,b++;
}
printf("%d %d\n",a,b);
return 0;
}输出结果: 2...
分类:
其他好文 时间:
2014-10-23 17:43:43
阅读次数:
174
方案一:
所有比较都不用
int min = (a + b - abs(a - b)) / 2;(a与b的和减去a与b的差就等于a与b中较小值的两倍,再除以2即可得到较小值)
int max = (a + b + abs(a - b)) / 2; 同上
方案二:
int max(int a, b)
{
switch((unsigned int)(a - b) >> sizeof(in...
分类:
其他好文 时间:
2014-10-22 22:05:54
阅读次数:
253
#include
#include
int key[5];
double value[5]={0,12.01,1.008,14.01,16.00};
int T;
int num=0,p=0,flag=0;
int check(char ch)
{
switch(ch)
{
case 'C':
return 1;
case 'H':
...
分类:
其他好文 时间:
2014-10-22 18:13:12
阅读次数:
150
在某些情况下有误差public static int Sqrt(int a) { switch (a) { case 0: return 0; case 1: case 2: case 3: return 1; default: int n = a / 2;...
分类:
其他好文 时间:
2014-10-22 12:27:22
阅读次数:
196
gyp?ERR!?configure?error
gyp?ERR!?stack?Error:?Python?executable?"python"?is?v2.4.3,?which?is?not?supported?by?gyp.gyp?ERR!?stack?You?can?pass?the?--python?switch?to?poi...
分类:
编程语言 时间:
2014-10-21 23:21:37
阅读次数:
776
from pox.core import corefrom pox.lib.util import str_to_dpidfrom pox.forwarding.l2_learning import LearningSwitchdef launch (ignore_dpid): ignore_dp....
分类:
其他好文 时间:
2014-10-21 17:11:48
阅读次数:
222