Showing: 21 - 30 of 34 Articles

How do I format a double into a string (with only two decimal places)?

double d1 = 123456.78; double d2 = 567890; Locale fmtLocale = Locale.getDefault(Category.FORMAT); NumberFormat formatter = NumberFormat.getInstance(fmtLocale); formatter.setMaximumFractionDigits(2); formatter.setMinimumFractionDigits(2); System.out.println(formatter.format(d1)); System.out.println(formatter.format(d2)); System.out.println(fmtLocale.toLanguageTag());

Screen goes white before splash in android

<activity android:name=”first Activity Name” android:theme=”@android:style/Theme.Translucent.NoTitleBar”> <intent-filter> <action android:name=”android.intent.action.MAIN” /> <category android:name=”android.intent.category.LAUNCHER” /> </intent-filter> </activity> In Android studio 2.0 or above version it is happening because of instant run. by removing it from settings>Bulid, Execution, Deployment> Instant run and disable all the check boxes over there …

Firebase customise notification when app is in background or killed

Firebase will not call your onMessageReceived when your app is in background or killed, and you can’t customise your notification. System generated notification will show. to make firebase library to call your onMessageReived in every cases a) Foreground b) Background c) Killed you must not …