Android – onRequestPermissionsResult() is deprecated. Are there any alternatives?

The onRequestPermissionsResult() method is deprecated in androidx.fragment.app.Fragment. So you may use registerForActivityResult() method instead of onRequestPermissionsResult(). You can refer this URL. Following is Kotlin code, but you can refer it: val requestPermissionLauncher = registerForActivityResult( ActivityResultContracts.RequestPermission() ) { isGranted -> if (isGranted) { // PERMISSION GRANTED } else { // PERMISSION NOT GRANTED } } // … Read more

Why is the Date constructor deprecated, and what do I use instead?

The java.util.Date class isn’t actually deprecated, just that constructor, along with a couple other constructors/methods are deprecated. It was deprecated because that sort of usage doesn’t work well with internationalization. The Calendar class should be used instead: Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, 1988); cal.set(Calendar.MONTH, Calendar.JANUARY); cal.set(Calendar.DAY_OF_MONTH, 1); Date dateRepresentation = cal.getTime(); Take a look at … Read more

How can I mark a C++ class method as deprecated?

In C++14, you can mark a function as deprecated using the [[deprecated]] attribute (see section 7.6.5 [dcl.attr.deprecated]). The attribute-token deprecated can be used to mark names and entities whose use is still allowed, but is discouraged for some reason. For example, the following function foo is deprecated: [[deprecated]] void foo(int); It is possible to provide … Read more

Unity 5.5 obsolete particle system code

particle.startLifetime: First of all, what Unity did in Unity 5.5 was to add new futures to the ParticleSystem. They also exposed some ParticleSystem API that was hidden before. ParticleSystem.MainModule.startLifetime is now a type of MinMaxCurve instead of float like ParticleSystem.startLifetime. By doing this, you are now given more options such as modifying the startLifetime as … Read more

Replacement for stringByAddingPercentEscapesUsingEncoding in ios9?

The deprecation message says (emphasis mine): Use stringByAddingPercentEncodingWithAllowedCharacters(_:) instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has different rules for what characters are valid. So you only need to supply an adequate NSCharacterSet as argument. Luckily, for URLs there’s … Read more

Why is mime_content_type() deprecated in PHP?

The method is not deprecated! It once was incorrectly marked as deprecated in the manual, but it has been fixed https://bugs.php.net/bug.php?id=71367 on the 14th of January 2016. However, at the moment, it is still incorrectly marked deprecated in the German, Spanish and Chinese manual. Feel free to use mime_content_type() whenever you like :).