当前位置:  编程技术>移动开发
本页文章导读:
    ▪JDepend运用小记        JDepend使用小记 http://blog.csdn.net/zhengsj/article/details/4148117 ......
    ▪ handler 计时器处置        handler 计时器处理 我觉得很好用,控制计时并且实现两个Activity 之间跳转,这里传参数用了bundle 传递:package com.face;import android.app.Activity;import android.content.Intent;import android.os.Bundle;import andr.........
    ▪ Box2D v2.2.0 User Manual中文版(一)       Box2D v2.2.0 User Manual中文版(1) 详情请参考:【Software Myzone】:http://www.firedragonpzy.com.cn/index.php/archives/2362 ......

[1]JDepend运用小记
    来源: 互联网  发布时间: 2014-02-18
JDepend使用小记
http://blog.csdn.net/zhengsj/article/details/4148117

    
[2] handler 计时器处置
    来源: 互联网  发布时间: 2014-02-18
handler 计时器处理
我觉得很好用,控制计时并且实现两个Activity 之间跳转,这里传参数用了bundle 传递:

package com.face;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.widget.TextView;

public class Activity9 extends Activity {

private MyHandler myHandler;
myThread mythread = null;
private boolean bool = true;
private int count = 0;
int type = 0;
int time = 0;
int ctime = 0;

TextView tm;

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.test9);
tm = (TextView) findViewById(R.id.tsTxt);

bool = true;
myHandler = new MyHandler(Looper.getMainLooper());
mythread = new myThread();
mythread.start();
}

class myThread extends Thread {

@Override
public void run()
{
while (bool)
{
Message message = myHandler.obtainMessage();
message.what = 1;
myHandler.sendMessage(message);
try
{
Thread.sleep(5000);// 休息1min
count += 5;
} catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
}

class MyHandler extends Handler {

public MyHandler(Looper looper) {
super(looper);
}

@Override
public void handleMessage(Message msg)
{
if (msg.what == 1)
{

if (count == (ctime + time))
{
count = 0;
}
tm.setText("====main======" + count);
if (count == 20)
{
ctime = count;
Log.i("main", "====="+count);
otherActivity();

}

}
}
}

public void otherActivity()
{
time = 4 * 15;
Intent itent = new Intent();
Bundle bundle = new Bundle();
bundle.putString("showtype", "" + time);
itent.putExtras(bundle);
itent.setClass(Activity9.this, Activity12.class);
startActivity(itent);
}

@Override
protected void onDestroy()
{
bool = false;
myHandler.removeCallbacks(mythread);
super.onDestroy();

}

}
--------------------------
package com.face;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.widget.TextView;

public class Activity12 extends Activity {
TextView timeTxt = null;

private CollectHandler myHandler;
CollectThread mythread = null;
private boolean bool = true;
private int count = 0;

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);

setContentView(R.layout.test12);
timeTxt = (TextView) findViewById(R.id.tmTxt);

Intent intent = this.getIntent();
String s = intent.getExtras().getString("showtype");
if (s != null)
{
int opentime = Integer.parseInt(s);
if (opentime > 0)
{
count = opentime;
bool = true;
myHandler = new CollectHandler(Looper.getMainLooper());
mythread = new CollectThread();
mythread.start();
} else
{
startActivity(new Intent(Activity12.this, Activity9.class));
finish();
}
} else
{
Log.i("Activity12", "====null");
finish();
}

}

class CollectThread extends Thread {

@Override
public void run()
{
while (bool)
{
Message message = myHandler.obtainMessage();
message.what = 1;
myHandler.sendMessage(message);
try
{
Thread.sleep(5000);// 休息1min
count -= 5;
} catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
}

class CollectHandler extends Handler {

public CollectHandler(Looper looper) {
super(looper);
}

@Override
public void handleMessage(Message msg)
{
if (msg.what == 1)
{
if (count > 0)
{
timeTxt.setText("======Activity12===" + count);
} else
{
//startActivity(new Intent(Activity12.this, Activity9.class));
finish();
}
}
}
}

@Override
protected void onDestroy()
{
bool = false;
myHandler.removeCallbacks(mythread);
super.onDestroy();

}

}





    
[3] Box2D v2.2.0 User Manual中文版(一)
    来源: 互联网  发布时间: 2014-02-18
Box2D v2.2.0 User Manual中文版(1)
详情请参考:【Software Myzone】:http://www.firedragonpzy.com.cn/index.php/archives/2362

    
最新技术文章:
▪Android开发之登录验证实例教程
▪Android开发之注册登录方法示例
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
▪Android提高之自定义Menu(TabMenu)实现方法
▪Android提高之多方向抽屉实现方法
▪Android提高之MediaPlayer播放网络音频的实现方法...
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3