赞
踩
发表于 2015-12-03 07:47:55 by 月小升
package com.toplus.speedtest;
import java.util.Locale;
import com.toplus.speedtest.R;
import android.app.ActionBar;
import android.app.Activity;
import android.app.FragmentTransaction;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.NavUtils;
import android.support.v4.view.ViewPager;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity implements SensorEventListener
{
private SensorManager sm;
private Sensor mGyroscope;
private Sensor mAccelerator;
private Sensor GAccelerator;
private TextView axis_x = null ,axis_y = null ,axis_z = null;
private TextView axis_x_degree = null, axis_y_degree = null, axis_z_degree = null ;
private TextView G_axis_x = null ,G_axis_y = null ,G_axis_z = null;
private TextView axis_gro_x_degree = null;// ,G_axis_y = null ,G_axis_z = null;
private double X_max=0, Y_max=0, Z_max=0;
public static final double G_CONSTANT = 9.81;
private double degree_X = 0 , offset_X = 0 ;
private double degree_Y = 0 , offset_Y = 0 ;
private double degree_Z = 0 , offset_Z = 0 ;
private long lasttimestamp=0;
private TextView R_total = null ;
private static final double C= 180 / Math.PI / 1000000000;
private static final float NS2S = 1.0f / 1000000000.0f;
private final float[] deltaRotationVector = new float[4];
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。