记得我前几天发过一个类似的代码如下(适用安卓)
import android.app.Activityimport android.os.Bundle
import android.location.*
import android.content.*
import android.util.Log
import android.widget.TextView
public class GPSLocationListenActivity extends Activity implements LocationListener {
LocationManager locman
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState)
setContentView(R.layout.main)
locman = (LocationManager)getSystemService(Context.LOCATION_SERVICE)
}
@Override
protected void onResume(){
if (locman != null){
locman.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,0,this)
}
super.onResume()
}
@Override
protected void onPause(){
if (locman != null){
locman.removeUpdates(this)
}
super.onPause()
}
@Override
public void onLocationChanged(Location location){
TextView textView1 = (TextView)findViewById(R.id.textView1)
textView1.setText("Latitude:Longitude - "
+String.valueOf(location.getLatitude()) +":"+String.valueOf(location.getLongitude()))
TextView textView2 = (TextView)findViewById(R.id.textView2)
textView2.setText(String.valueOf(location.getTime()))
Log.v("----------", "----------")
Log.v("Latitude", String.valueOf(location.getLatitude()))
Log.v("Longitude", String.valueOf(location.getLongitude()))
Log.v("Accuracy", String.valueOf(location.getAccuracy()))
Log.v("Altitude", String.valueOf(location.getAltitude()))
Log.v("Time", String.valueOf(location.getTime()))
巧吵 做正 Log.v("Speed", String.valueOf(location.getSpeed()))
Log.v("Bearing", String.valueOf(location.getBearing()))
}
@Override
public void onProviderDisabled(String provider){
}
@Override
public void onProviderEnabled(String provider){
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras){
switch(status){
case LocationProvider.AVAILABLE:
Log.v("Status","AVAILABLE")
纯宽悔 break
case LocationProvider.OUT_OF_SERVICE:
Log.v("Status","OUT_OF_SERVICE")
break
case LocationProvider.TEMPORARILY_UNAVAILABLE:
Log.v("Status","TEMPORARILY_UNAVAILABLE")
break
}
}
}
之前的提问链接
http://zhidao.baidu.com/question/426245883846255372
"蓝牙"(Bluetooth)是一种低功率短距离的无线连接技术标准的代称,"蓝牙"一词取自一位在公元10世纪统一了丹麦的国王,哈拉德二世、(Harald)的绰号,即"蓝牙"(Bluetooth)。"蓝牙"技术的最初倡导者是五家世界著名的计算机和通信公司:爱立信Ericsson, 国际商用机器IBM, 英特尔Intel, 诺基亚Nokia, 和东塌液芝Toshiba。并于1998年5月成立了"蓝牙"特殊利益集团(Bluetooth Special Interest Group-SIG) ,该组织采取了向产业界无偿转让该项专利技术的策略,以实现其全球统一标准的目兆衫州标。你的提问蓝牙 似乎和你的电脑没 关族蔽系的
import java.util.Scanner/*
* @author ww
*
*/
public class Test {
public static void main(String[] args) {
Scanner s = new Scanner(System.in)
System.out.println("输入一个正整数n(n>谨旦芦=2)")
int n = s.nextInt()
StringBuilder sb = new StringBuilder()
boolean has = false
for(int i=1i<ni++){
int temp = i
迟孝sb.append(i).append(" ")
for(int j=i+1j<nj++){
temp += j
sb.append(j).append(" ")
if(temp==n){
祥带 System.out.println(sb.toString())
has = true
}
}
sb.delete(0, sb.length())
}
if(!has){
System.out.println("NONE")
}
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)