问题: 我有一个启动画面,它设置为 5 秒。启动“主菜单”
启动画面开始,找到 gps 值,但它显示在 Toast 消息上,但我想将它存储在 Editbox 中。
启动画面有 xml --> starter.xml
Gps 值的( lat 和 lng )编辑框有 xml --> gps_values
代码: 这是一个名为 starter 的类:
public void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
setContentView(R.layout.starter);
LocationResult locationResult = new LocationResult(){
@Override
public void gotLocation(Location location){
EditText lat_view = (EditText)findViewById(R.id.lat_Field);
EditText lng_view = (EditText)findViewById(R.id.lng_Field);
Double lat_source = location.getLatitude();
Double lng_source = location.getLongitude();
lat_view.setText(lat_source.toString());
lng_view.setText(lng_source.toString());
Log.d(TAG, "GPS values =" + lat_view + lng_view);
Toast.makeText(
getApplicationContext(),
"Latitude: "+location.getLatitude()+"\n Longitude: "+location.getLongitude() ,
Toast.LENGTH_SHORT).show();
}
};
MyLocation myLocation = new MyLocation();
myLocation.getLocation(this, locationResult);
final Starter sPlashScreen = this;
mSplashThread = new Thread(){
@Override
public void run(){
try {
synchronized(this){
wait(5000);
}
}
catch(InterruptedException ex){
}
finish();
Intent intent = new Intent();
intent.setClass(sPlashScreen,DashboardMain.class);
startActivity(intent);
finish();
} };
就像我说的
lat_view 和 lng_view 位于名为gps_values的 XML 文件中,还有另一个用于启动活动的 xml,名为starter.xml。任何人都可以看到我看不到的东西吗?