当前位置: 编程技术>移动开发
本页文章导读:
▪变换东一到东八相差八小时时间 转换东一到东八相差八小时时间
+(NSDate *)convertDateToLocalTime:(NSDate *)forDate { NSTimeZone *nowTimeZone = [NSTimeZone localTimeZone]; int timeOffset = [nowTimeZone secondsFromGMTForDate:forDate]; NSDate *n.........
▪ Sensor地心引力demo Sensor重力demo
import java.util.List;
import android.app.Activity;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundl.........
▪ GC调优稿件 GC调优文章
官方:http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.htmlGC学习笔记http://blog.csdn.net/fenglibing/article/details/6321453Thread Dump分析 http://blog.csdn.net/wanyanxgf/article/details/6944987通过.........
[1]变换东一到东八相差八小时时间
来源: 互联网 发布时间: 2014-02-18
转换东一到东八相差八小时时间
+(NSDate *)convertDateToLocalTime:(NSDate *)forDate {
NSTimeZone *nowTimeZone = [NSTimeZone localTimeZone];
int timeOffset = [nowTimeZone secondsFromGMTForDate:forDate];
NSDate *newDate = [forDate dateByAddingTimeInterval:timeOffset];
return newDate;
}
+(NSDate *)convertDateToLocalTime:(NSDate *)forDate {
NSTimeZone *nowTimeZone = [NSTimeZone localTimeZone];
int timeOffset = [nowTimeZone secondsFromGMTForDate:forDate];
NSDate *newDate = [forDate dateByAddingTimeInterval:timeOffset];
return newDate;
}
[2] Sensor地心引力demo
来源: 互联网 发布时间: 2014-02-18
Sensor重力demo
import java.util.List;
import android.app.Activity;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
public class SensorActivity extends Activity implements
SensorEventListener
{
TextView text;
private boolean mRegisteredSensor;
// 定义SensorManager
private SensorManager mSensorManager;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
text = (TextView) findViewById(R.id.textView1);
mRegisteredSensor = false;
// 取得SensorManager实例
mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
}
@Override
protected void onResume()
{
super.onResume();
// 接受SensorManager的一个列表(Listener)
// 这里我们指定类型为TYPE_ORIENTATION(方向感应器)或YPE_ACCELEROMETER
List<Sensor> sensors = mSensorManager.getSensorList(Sensor.TYPE_ACCELEROMETER);
if (sensors.size() > 0)
{
Sensor sensor = sensors.get(0);
// 注册SensorManager
// this->接收sensor的实例
// 接收传感器类型的列表
// 接受的频率
mRegisteredSensor = mSensorManager.registerListener(this, sensor,
SensorManager.SENSOR_DELAY_NORMAL);
}
}
@Override
protected void onPause()
{
if (mRegisteredSensor)
{
// 如果调用了registerListener
// 这里我们需要unregisterListener来卸载\取消注册
mSensorManager.unregisterListener(this);
mRegisteredSensor = false;
}
super.onPause();
}
// 当进准度发生改变时
// sensor->传感器
// accuracy->精准度
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy)
{
}
// 当传感器在被改变时触发
@Override
public void onSensorChanged(SensorEvent event)
{
// 接受方向感应器的类型
synchronized (this) {
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER)// ///或
// TYPE_ORIENTATION
{
// 这里我们可以得到数据,然后根据需要来处理
// 由于模拟器上面无法测试效果,因此我们暂时不处理数据
float x = event.values[SensorManager.DATA_X];
float y = event.values[SensorManager.DATA_Y];
float z = event.values[SensorManager.DATA_Z];
Log.d("TESTSENSOR", x + " " + y + " " + z);
text.setText("TESTSENSOR"+x + " " + y + " " + z);
}
}
}
}
[3] GC调优稿件
来源: 互联网 发布时间: 2014-02-18
GC调优文章
官方:
http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
GC学习笔记
http://blog.csdn.net/fenglibing/article/details/6321453
Thread Dump分析
http://blog.csdn.net/wanyanxgf/article/details/6944987
通过GC输出分析内存泄露问题
http://www.iteye.com/topic/256701
jstack和线程dump分析
http://jameswxx.iteye.com/blog/1041173
10 个非常重要的 HotSpot JVM 参数
http://run-wang.iteye.com/blog/1326763
探秘Java7新增垃圾回收器G1特性
http://huangtut.iteye.com/blog/1106416
GC调优总结
http://pengjiaheng.iteye.com/blog/search?page=2&query=jvm
jvm GC优化
http://wangxuliangboy.iteye.com/blog/360798
CMS gc实践总结
http://www.iteye.com/topic/473874#1176751
官方:
http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
GC学习笔记
http://blog.csdn.net/fenglibing/article/details/6321453
Thread Dump分析
http://blog.csdn.net/wanyanxgf/article/details/6944987
通过GC输出分析内存泄露问题
http://www.iteye.com/topic/256701
jstack和线程dump分析
http://jameswxx.iteye.com/blog/1041173
10 个非常重要的 HotSpot JVM 参数
http://run-wang.iteye.com/blog/1326763
探秘Java7新增垃圾回收器G1特性
http://huangtut.iteye.com/blog/1106416
GC调优总结
http://pengjiaheng.iteye.com/blog/search?page=2&query=jvm
jvm GC优化
http://wangxuliangboy.iteye.com/blog/360798
CMS gc实践总结
http://www.iteye.com/topic/473874#1176751
最新技术文章: