PHP / C# / ASP coder starting out in android properly after giving Xamarin a shot (and then having a 6 month hiatus from all coding).
I'm trying to achieve custom layouts within a notification. I can get it to produce normal notifications, but can't help but crash when its done using setContent(view).
Also new to Eclipse / ADT so struggling with knowing how to work through the issues myself (in visual studio this was easy).
Just to clarify, displayNotification is currently set to execute upon app launch.
I am sure it is something so simple and small, however it's getting late and my mind is frazzled. All help is greatly appreciated!
Here is my code (removed any commented out code just to clean it up for this purpose).
protected void displayNotification() {
RemoteViews customNotificationView =
new RemoteViews(getPackageName(), R.layout.notification_layout);
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this);
mBuilder.setContent(customNotificationView);
mBuilder.setTicker("New Message Alert!");
mBuilder.setSmallIcon(R.drawable.ic_launcher);
mBuilder.setOngoing(true);
mNotificationManager = (NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(notificationID, mBuilder.build());
}
Here is my custom layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/notification_title"
style="@style/NotificationTitle"
/>
<SeekBar
android:id="@+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>