title: Android notification with RemoteViews - having activity associated with RemoteViews layout
body: <p>I've been researching on how to create custom-layout notification using <code>RemoteView</code>. </p>
  
  <p>So far, I am able to create a notification with <code>contentView</code> and <code>bigContentView</code> pointing to a <code>RemoteView</code> with a custom layout xml. However, what does not happen, is to have <code>Activity</code> (associated with custom layout) started when this <code>RemoteView</code> is created.</p>
  
  <p>I've double checked and in my layout xml, it appears to have correct <code>Activity</code> class name:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="0dp"
      android:paddingLeft="0dp"
      android:paddingRight="0dp"
      android:paddingTop="0dp"
      tools:context=".LLMNotificationActivity" &gt;
  
  ..... the rest are standard layout items: images, buttons and text
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>In manifest file, right after main application main activity, notification activity is also added:</p>
  
  <pre><code>&lt;activity
      android:name=".LLMNotificationActivity"
      android:label="@string/app_name"&gt;
      &lt;intent-filter&gt;
          &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
      &lt;/intent-filter&gt;
  &lt;/activity&gt;
  </code></pre>
  
  <p>I would expect when notification uses <code>RemoteView</code> for its content, that this <code>RemoteView</code> will launch activity that is attached to its layout definition. However it appears not.</p>
  
  <p>Here is how I create a notification in main application <code>Activity</code>:</p>
  
  <pre><code>protected void startNoti() {
      if( noti!=null ) return;
  
      Context context = getApplicationContext();  
  
      RemoteViews contentView = new RemoteViews(context.getPackageName(),R.layout.activity_noti1);
  
      Notification.Builder notibuilder = new Notification.Builder(context);
      notibuilder.setContentTitle(" ");
      notibuilder.setContentText(" ");
      notibuilder.setSmallIcon(R.drawable.ic_launcher);
      notibuilder.setOngoing(true);
  
      manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
      noti = notibuilder.build();
  
      noti.contentView = contentView;
  
      manager.notify(NOTIFICATION_ID, noti);  
  }
  </code></pre>
  
  <p><code>LLMNotificationActivity</code> activity class is defined as usual:</p>
  
  <pre><code>public class LLMNotificationActivity extends Activity {
      .... etc.... constructor, some button on-click handlers, nothing spectacular...
  }
  </code></pre>
  
  <p>Can anyone point to me what I am missing or if I have misunderstood what <code>RemoteView</code> can do? My understanding is that <code>RemoteView</code> should, once created, invoke activity associated with its layout. Or - is there some API I've missed that explicitly can set intent of the <code>RemoteView</code>?</p>
  
  <p>What I have found so far are only setting content <code>Intent</code> which basically just launches an <code>Activity</code> once user touches notification. What I'm looking for is to handle touches to some of UI elements inside custom-layout notification, not to launch an <code>Activity</code> regardless where the user clicks on notification surface.</p>
  
  <p>For example, if I have 3 icons (i.e. <code>ImageView</code>) in a <code>RemoteView</code> which notification uses, I'd like to be able to handle touch on each one of them. I can't imagine this wouldn't be possible as if it's not, what's the point of having <code>RemoteView</code> in notification?</p>