本文整理汇总了Java中android.location.Location.set方法的典型用法代码示例。如果您正苦于以下问题:Java Location.set方法的具体用法?Java Location.set怎么用?Java Location.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.location.Location
的用法示例。
在下文中一共展示了Location.set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.location.Location; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.place_details);
mContext = this;
mResources = getResources();
mMapFragment = (SupportMapFragment)
getSupportFragmentManager().findFragmentById(R.id.place_map);
mMapFragment.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap map) {
mMap = map;
updateUI();
}
});
mPlaceId = getIntent().getIntExtra(EXTRA_PLACE_POSITION, -1);
final VisitableGenerator generator = VisitableGenerator.get(this);
mPlace = generator.getPlace(mPlaceId);
mLocation = new Location("");
mLocation.set(mPlace.getLocation());
mPlaceImageViewFull = (ImageView) findViewById(R.id.place_image_full);
mPlaceCaption = (TextView) findViewById(R.id.place_caption_full);
mWebView = (WebView) findViewById(R.id.web_view);
mBackupEmptyView = (TextView) findViewById(R.id.place_backup_empty_view);
mIndicator = (ProgressBar) findViewById(R.id.indicator);
mVisitedCheckBox = (CheckBox) findViewById(R.id.visited_check_box);
mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
mProgressBar.setMax(100);
mWebView.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView webView, int newProgress) {
if (newProgress == 100) {
mProgressBar.setVisibility(View.GONE);
} else {
mProgressBar.setVisibility(View.VISIBLE);
mProgressBar.setProgress(newProgress);
}
}
});
mWebView.setWebViewClient(new WebViewClient());
mWebView.loadUrl(mPlace.getWikiUrl());
Bitmap bitmap = PictureUtils.decodeBitmapFromResource(getResources(),
mPlace.getImgResourceId(), 400, 400);
mPlaceImageViewFull.setImageBitmap(bitmap);
mPlaceCaption.setText(mPlace.getPlaceNameResId());
this.getSupportActionBar().setTitle(mPlace.getPlaceNameResId());
mVisitedCheckBox.setChecked(mPlace.isVisited());
mVisitedCheckBox.setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton view, boolean isChecked) {
mPlace.setVisited(isChecked);
}
});
mConnManager = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = mConnManager.getActiveNetworkInfo();
boolean isConnected = activeNetwork != null && activeNetwork.isConnected();
if (!isConnected) {
mIndicator.setVisibility(View.INVISIBLE);
mBackupEmptyView.setText(R.string.empty_placeholder);
}
}