android-7.0-nougat

How to get actual screen size after Android N?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 19:02:42
问题 Since Android N introduces split screen, the window size of your app can be half of the original. I found that getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics); no longer always returns the actual device screen size anymore because in split screen mode the display's height will be your app's window height instead. Is there any other API I can use to get the actual screen size? 回答1: Display.getRealMetrics(DisplayMetrics) will return the actual display size. 回答2: You can

Android: Implement a custom ConnectionService which uses built-in telephony stack

孤街醉人 提交于 2019-12-23 12:08:23
问题 I'm trying to implement a custom ConnectionService in my custom telephony-app. According to the documentation I need to select my registered PhoneAccount as default in the Phones settings menu. However when I'm registering a PhoneAccount to use the native telephony stack the PhoneAccount does not seem to show up for use. Let me show you what I got working so far. This code registers a PhoneAccount that "...is not allowed to manage or place calls from the built-in telephony stack" PhoneAccount

Attempt to invoke virtual method 'void android.widget.Editor$SelectionModifierCursorController.hide()' on a null object reference

余生长醉 提交于 2019-12-23 08:58:18
问题 This error seems to be happening only on Samsung phones using Android 6.0.1. or 7.0: Fatal Exception: java.lang.NullPointerException Attempt to invoke virtual method 'void android.widget.Editor$SelectionModifierCursorController.hide()' on a null object reference android.widget.Editor.performLongClick (Editor.java:1139) android.widget.TextView.performLongClick (TextView.java:10945) android.view.View$CheckForLongPress.run (View.java:22568) android.os.Handler.handleCallback (Handler.java:739)

Detect current running application in Android Nougat 7.+ version

爷,独闯天下 提交于 2019-12-23 08:54:02
问题 Android team changed their approaches to get current running applications from time to time. I am able to get current running applications upto Marshmallow 6.0 version but i want to ask that how can i get these in Nougat 7.0 version? Is there anyway to do that? Please guide towards solutions. I have searched a lot but could find any appropriate way to that. Thanks 回答1: Simple answer: no, you can't. Long answer: you can't get the running process but you can retrospectively see what was running

Html Tag Handler not called in Android N for “ul”, “li”

一曲冷凌霜 提交于 2019-12-23 07:36:59
问题 We have a custom TagHandler in our app for bulleted list etc. html = "<ul><li>First item</li><li>Second item</li></ul>"; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { result = Html.fromHtml(html,Html.FROM_HTML_MODE_LEGACY, null, new ListHTMLTagHandler(density)); } else { //noinspection deprecation result = Html.fromHtml(html, null, new ListHTMLTagHandler(density)); } The handleTag() function in my TagHandler is called for ul , li in API-23 and below but not

Html Tag Handler not called in Android N for “ul”, “li”

試著忘記壹切 提交于 2019-12-23 07:35:00
问题 We have a custom TagHandler in our app for bulleted list etc. html = "<ul><li>First item</li><li>Second item</li></ul>"; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { result = Html.fromHtml(html,Html.FROM_HTML_MODE_LEGACY, null, new ListHTMLTagHandler(density)); } else { //noinspection deprecation result = Html.fromHtml(html, null, new ListHTMLTagHandler(density)); } The handleTag() function in my TagHandler is called for ul , li in API-23 and below but not

Update android SDK : install latest platform to implement new APIs such as “ShortcutManager”

冷暖自知 提交于 2019-12-23 07:29:07
问题 Here i am performing demo for Android Shortcuts introduces in android nougat App Shortcuts I have used following code to create app shortcut ShortcutManager shortcutManager; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { shortcutManager = getSystemService(ShortcutManager.class); ShortcutInfo shortcut; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N_MR1) { shortcut = new ShortcutInfo.Builder(this, "second_shortcut") .setShortLabel(getString

Android S8+ warning message “does not support the current Display size setting and may behave unexpectedly”

家住魔仙堡 提交于 2019-12-22 10:40:02
问题 I have this warning message in Samsung S8+ Android 7: APP_NAME does not support the current Display size setting and may behave unexpectedly. What it means and how can I remove it? Thank you 回答1: Solved by adding in supports-screens android:xlargeScreens="true" and removing: android:requiresSmallestWidthDp="600" 回答2: So you need to create different folders and maintain all xml in those folders. The following is a list of resource directories in an application that provides different layout

android 7.0 Notification icon appearing white square

萝らか妹 提交于 2019-12-22 05:27:06
问题 I am using the below snippet to generate notifications in my android app. private void sendNotification(String contentText, String message) { Intent resultIntent = new Intent(this, MainActivity.class); resultIntent.putExtra("clear","clear"); resultIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); PendingIntent piResult = PendingIntent.getActivity(this, 0, resultIntent,0); NotificationCompat.Builder builder=new NotificationCompat.Builder(this) .setSmallIcon(R

Shortcuts for Nougat version

我只是一个虾纸丫 提交于 2019-12-22 03:56:15
问题 I'm catching this fatal exception when I try to pass an Serializable inside an Intent bundle, and I think is related with the nougat shortcuts that I'm trying to implement. here the exception: 12-16 16:17:32.972 20461-20461/***.****.******.debug E/AndroidRuntime: FATAL EXCEPTION: main Process: ***.****.******.debug, PID: 20461 java.lang.IllegalArgumentException: Bad value in PersistableBundle key=shortcutId value=***.****.******.common.cta.CtaAccountSectionModel@1fb70dc at android.os