remoteview

Reliable way of retrieving StatusbarNotification details (title, notification text)

落花浮王杯 提交于 2019-12-31 12:59:33
问题 I'd like to get as much information out of a StatusBarNotification -object as possible. Right now, the only "reliable" information that can be accessed is the tickerText -property. I'm using the following code to get the notification's title and text via RemoteViews , but a lot of the time, the title and/or text will simply be null :-(: //Get the title and text String mTitle = ""; String mText = ""; try { RemoteViews remoteView = sbn.getNotification().contentView; LayoutInflater inflater =

How to add vertical line to RemoteView for custom Android Notifications?

萝らか妹 提交于 2019-12-30 10:37:27
问题 I'm struggling to add a vertical line to a custom Android Notification. I've tried adding a view like this to my Relative Layout: <View android:id="@+id/line_vertical" android:layout_width="1dip" android:layout_height="fill_parent" android:layout_centerVertical="true" android:layout_toRightOf="@id/image_logo" android:background="#0000FF" /> But when I fire the notification, I get the following Exception: android.app.RemoteServiceException: Bad notification posted from package XXX: Couldn't

Layout weight on dynamically added RemoteViews

☆樱花仙子☆ 提交于 2019-12-21 20:13:07
问题 Within my widget, i'm using the following to dynamically add items (R.layout.widget_item) to a LinearLayout defined within my main widget layout: //-- Main widget layout RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_design); //-- Add to main layout RemoteViews newView = new RemoteViews(context.getPackageName(), R.layout.widget_item); views.addView(R.id.view_container, newView); My question is, how can I dynamically set the "android:layout_weight" attribute on

Notification for android music player

橙三吉。 提交于 2019-12-18 16:52:41
问题 How to control a music player from buttons in notification, and how to listen button action from the notification 回答1: You should use setOnClickPendingIntent() of RemoteViews to listen button action from the notification. The method setOnClickPendingIntent() will bind a PendingIntent to response the button click event. The sample code is like this: private void showControllerInNotification() { PendingIntent pendingIntent = null; Intent intent = null; //Inflate a remote view with a layout

RemoteView addView not working

爱⌒轻易说出口 提交于 2019-12-18 04:46:12
问题 I have an app widget and I'd like to add Views ( TextView , etc.,) to the RemoteView but it never shows up. Here goes the code: RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout); RemoteViews newView = new RemoteViews(context.getPackageName(), R.layout.widget_row_layout); newView.setTextViewText(R.id.textUser, "1234"); views.addView(views.getLayoutId(), newView); // Tell the AppWidgetManager to perform an update on the current App Widget appWidgetManager

Big Picture is Cropping while setting to Notification

此生再无相见时 提交于 2019-12-13 14:46:51
问题 I want to show a Big Picture Style Image in my notification bar Android. But I am getting a problem -> When I set the image in notification bar using the below code: PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(ctx) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle(title) .setContentText(message) .setOngoing(false) .setAutoCancel(true) .setStyle(new

TransactionTooLargeException while notify notification

跟風遠走 提交于 2019-12-12 23:36:45
问题 I have update time while recording in android, I using CountDownTimer and update to remote view on notification. I have optimized smallest data but still get TransactionTooLargeException. public void showNotificationRecording() { mRemoteViews = new RemoteViews(getPackageName(), R.layout.notify_recording_layout); mBuilder = new NotificationCompat.Builder(mContext); isSecretModeEnable = mSharePreferencesSettings.getBoolean(RecordSettings.SECRET_MODE, false); Log.d(TAG, "isSecretModeEnable " +

Remoteview displays system notification when App is not in the foreground or not running instead of Custom Notification

戏子无情 提交于 2019-12-12 18:54:11
问题 First of all, let me tell you what I have done so far. I have gone through lots of searching including Remoteview is not applied in background firebase_messaging not customizing notification when an app is not in the foreground Also, I have referred GitHub and lots of articles but none of these worked for me so that is the reason I am posting this question, so please do not mark this as duplicate. Its Working fine when App is Running, but it displays system notification when the app is in

Creating custom android notification without RemoteView

我怕爱的太早我们不能终老 提交于 2019-12-12 05:39:41
问题 I am trying to create custom notification with custom view inside. I have to set custom array of custom objects into view. But RemoteView doesn't provide getView function. So I am asking, how to create custom android notification with custom view without RemoveView . Or how to get View from RemoteView 回答1: how to create custom android notification with custom view without RemoveView That is not possible, sorry. Or how to get View from RemoteView That is not possible, sorry. You will need to

Saving run-time generated NinePatch on external memory

我的梦境 提交于 2019-12-12 01:53:40
问题 I'm following this post to create nine patch drawable at run-time. I need to save the 9patch image on the internal/external memory, so that i can easily retrieve it's URI and assign it to an ImageView for example. Does anybody know how can I achieve this? P.S. Bitmap.compress method won't work, because it will save the image as a regular (not 9patch) png file. P.S. I know that I can serialize generated NinePatch object and save it to a file. But this way I can't assign it to a RemoteViews