您的位置:首页 > 其它

更新按钮上面文字,并根据变化判断活动

2016-07-19 14:30 239 查看
startLocation = (Button) findViewById(R.id.addfence);

startLocation.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
if (startLocation.getText().toString().equals(getString(R.string.startlocation))) {
LocationResult.setVisibility(View.VISIBLE);
//locationService.start();// 定位SDK
// start之后会默认发起一次定位请求,开发者无须判断isstart并主动调用request
Date date = new Date();
LocationActivity.workid = new SimpleDateFormat("MMddHHmm").format(date);
Intent idintent = new Intent(LocationActivity.this, MyLocationService.class);
idintent.putExtra("workid", LocationActivity.workid);
startService(idintent);
startLocation.setText(getString(R.string.stoplocation));
} else {
//locationService.stop();
stopService(new Intent(LocationActivity.this, MyLocationService.class));
getdialog();
startLocation.setText(getString(R.string.startlocation));
LocationResult.setVisibility(View.INVISIBLE);
}
}
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: