How to declare or mark a Java method as deprecated?
Use @Deprecated on method. Don’t forget about clarifying javadoc field: /** * Does some thing in old style. * * @deprecated use {@link #new()} instead. */ @Deprecated public void old() { // … }
Use @Deprecated on method. Don’t forget about clarifying javadoc field: /** * Does some thing in old style. * * @deprecated use {@link #new()} instead. */ @Deprecated public void old() { // … }
Use sizeWithAttributes: instead, which now takes an NSDictionary. Pass in the pair with key UITextAttributeFont and your font object like this: CGRect rawRect = {}; rawRect.size = [string sizeWithAttributes: @{ NSFontAttributeName: [UIFont systemFontOfSize:17.0f], }]; // Values are fractional — you should take the ceil to get equivalent values CGSize adjustedSize = CGRectIntegral(rawRect).size;
Yes, Google Custom Search has now replaced the old Search API, but you can still use Google Custom Search to search the entire web, although the steps are not obvious from the Custom Search setup. To create a Google Custom Search engine that searches the entire web: From the Google Custom Search homepage ( http://www.google.com/cse/ … Read more
update: as @Andy mentioned below Google has created HtmlCompat which can be used instead of the method below. Add this dependency implementation ‘androidx.core:core:1.0.1 to the build.gradle file of your app. Make sure you use the latest version of androidx.core:core. This allows you to use: HtmlCompat.fromHtml(html, HtmlCompat.FROM_HTML_MODE_LEGACY); You can read more about the different flags on … Read more
Important: Make sure your app is not using I18n 0.6.8, it has a bug that prevents the configuration to be set correctly. Short answer In order to silence the warning edit the application.rb file and include the following line inside the Rails::Application body config.i18n.enforce_available_locales = true The possible values are: false: if you want to … Read more
A UUID created by CFUUIDCreate is unique if a user uninstalls and re-installs the app: you will get a new one each time. But you might want it to be not unique, i. e. it should stay the same when the user uninstalls and re-installs the app. This requires a bit of effort, since the … Read more
It looks like the best approach is to use: ContextCompat.getColor(context, R.color.color_name) eg: yourView.setBackgroundColor(ContextCompat.getColor(applicationContext, R.color.colorAccent)) This will choose the Marshmallow two parameter method or the pre-Marshmallow method appropriately.
Vector synchronizes on each individual operation. That’s almost never what you want to do. Generally you want to synchronize a whole sequence of operations. Synchronizing individual operations is both less safe (if you iterate over a Vector, for instance, you still need to take out a lock to avoid anyone else changing the collection at … Read more
The shortest way is by adding the ObsoleteAttribute as an attribute to the method. Make sure to include an appropriate explanation: [Obsolete(“Method1 is deprecated, please use Method2 instead.”)] public void Method1() { … } You can also cause the compilation to fail, treating the usage of the method as an error instead of warning, if … Read more