android

How to show current position marker on Map in android?

落爺英雄遲暮 提交于 2021-02-18 06:46:39
问题 I am developing an application in which I want to display current location using marker in my map. I am using Google Map v2. Here I can display Map and marker when GPS is off ,but not visible any marker on map when GPS on. My requirement is display marker on map with current position I tried like this, @Override public void onLocationChanged(Location location) { // TODO Auto-generated method stub //locationManger.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this); ArrayList

XAxis label angle in MPAndroidChart

左心房为你撑大大i 提交于 2021-02-18 06:46:29
问题 I am using MPAndroidChart library for my project. Is it possible to rotate the labels of the XAxis by 270 degrees so that I can fit more text? 回答1: Original answer: Unfortunately it is currently not possible to rotate the values on the x-axis of a chart to a certain degree / angle. You will have to implement such a feature yourself. UPDATE: As of v2.1.5 this feature is now available: XAxis xAxis = chart.getXAxis(); xAxis.setLabelRotationAngle(...); 回答2: do it simply by XAxis xAxis=barChart

Appcompact DialogFragment single-choice checkmark color

柔情痞子 提交于 2021-02-18 06:42:07
问题 I have a problem. My activity has style <style name="MaterialTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="colorPrimary">@color/action_bar_background</item> <item name="colorPrimaryDark">@color/action_bar_background</item> <item name="colorAccent">@color/action_bar_background</item> </style> also i have dialogFragment with simple single-choice chooser. @Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final AlertDialog.Builder dialog = new

OkHttp doesn't redirect POST requests when used with retrofit

偶尔善良 提交于 2021-02-18 06:41:28
问题 Using retrofit I want to make POST request to http://milzinas.lt/oauthsilent/authorize . This URL is special because it redirects you to http://milzinas.e-bros.lt/oauthsilent/authorize . My retrofit setup uses OkHttpClient . If I make request using OkHttpClient only then redirecting works fine, i.e. 401 status code is received. However, when I use the same OkHttpClient with retrofit then response is status code 307. I think this has something to do with OkClient implementation which wraps the

DownloadManager not working for Android 10 (Q)

喜夏-厌秋 提交于 2021-02-18 06:34:07
问题 I've been beating my head against this issue for quite awhile... I am updating an app that uses DownloadManger to do a simple task like downloading a file to the external storage public directory i.e: Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) Everything works fine here from Android api 19-28. Its when testing on API 29 (Q/10) is where issues occur. Android implemented scoped storage and so deprecated the getExternalStoragePublicDirectory... As a result I

How to implement a onMenuItemClickListener in android

匆匆过客 提交于 2021-02-18 05:47:46
问题 How do I implement an onMenuItemClickListener ? @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.gameoptions, menu); menu.findItem(R.id.menu_item).setIntent(new Intent(this, QMenuActivity.class)); menu.findItem(R.id.back_item).setOnMenuItemClickListener; return true; } I want the back_item once clicked on to call a function within the page, how do I do it? 回答1: I'm assuming you want to access a non-static function in

`$cookies.put()` takes 30 seconds to save the cookie on disk on Android

你说的曾经没有我的故事 提交于 2021-02-18 05:35:28
问题 Context: We have a cordova application loading an online website. (We basically use cordova for the plugins) We store a cookie using $cookies.put() It works fine in desktop browsers and on iOS (as long we use expiration on the cookie) Problem: On Android if the user kill the application with 30 seconds after $cookies.put() is called the cookie will be gone on the next reboot. If the user wait more than 30 seconds (like 35 seconds or more) everything works fine. Question: How can we force the

AlertDialog vs AlertDialog.Builder

不打扰是莪最后的温柔 提交于 2021-02-18 05:33:50
问题 Why would one use the AlertDialog.Builder class rather than the methods directly available to AlertDialog , For example, why use AlertDialog.Builder.setCancellable rather than AlertDialog.setCancellable ? Surely this is a case of redundancy? 回答1: Because AlertDialog.setCancellable returns void and AlertDialog.Builder.setCancellable returns an AlertDialog.Builder . This means that the builder allows you to chain a bunch of settings with a little less verbosity. It's just a convenience class

Fragment, save large list of data on onSaveInstanceState (how to prevent TransactionTooLargeException)

风格不统一 提交于 2021-02-18 05:22:14
问题 In my app, I have Fragment which is inside ViewPager. Fragment contains RecyclerView with list of data fetched from web api based on user selection. On my Fragment onSaveInstanceState I save list data to Bunde, to keep the data on configuration changes etc. public void onSaveInstanceState(Bundle savedState) { super.onSaveInstanceState(savedState); savedState.putParcelableArrayList(LIST_STORAGE_KEY, new ArrayList<>(mItemAdapter.getModels())); } Now I have started to see

Android: Multiple Option Menus in one Activity

不想你离开。 提交于 2021-02-18 05:17:10
问题 I have an Activity containing a ViewFlipper and would like to show a different option menu for each view in that ViewFlipper . That is, the type of menu displayed when the menu button is pressed would depend on the type of the current view. However, onCreateOptionsMenu() is called only once (when showing the option menu for the first time), so creating the different menus can't be implemented there. How could I solve this? Any suggestions appreciated. 回答1: First read about