title: error with R.drawable.icon ; icon cannot be resolved or is not a field
body: <p>There comes error with the auto-generated code section: R.drawable. Please suggest solution for the error with:</p>
  
  <p>R.drawable.icon :- icon cannot be resolved or is not a field</p>
  
  <p>The .java file possessing this error looks like this:</p>
  
  <pre><code>package net.learn2develop.UsingNotifications;
  
  import android.app.Activity;
  import android.app.Notification;
  import android.app.NotificationManager;
  import android.app.PendingIntent;
  import android.content.Intent;
  import android.os.Bundle;
  
  public class DisplayNotifications extends Activity {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          //---get the notification ID for the notification; 
          // passed in by the MainActivity---
          int notifID = getIntent().getExtras().getInt("NotifID");
  
          //---PendingIntent to launch activity if the user selects 
          // the notification---
          Intent i = new Intent("net.learn2develop.AlarmDetails");
          i.putExtra("NotifID", notifID);  
  
          PendingIntent detailsIntent = 
              PendingIntent.getActivity(this, 0, i, 0);
  
          NotificationManager nm = (NotificationManager)
              getSystemService(NOTIFICATION_SERVICE);
          Notification notif = new Notification(
              R.drawable.icon,
              "Time's up!",
              System.currentTimeMillis());
  
          CharSequence from = "AlarmManager - Time's up!";
          CharSequence message = "This is your alert, courtesy of the AlarmManager";        
          notif.setLatestEventInfo(this, from, message, detailsIntent);
  
          //---100ms delay, vibrate for 250ms, pause for 100 ms and
          // then vibrate for 500ms---
          notif.vibrate = new long[] { 100, 250, 100, 500};        
          nm.notify(notifID, notif);
          //---destroy the activity---
          finish();
      }
  }
  </code></pre>
  
  <p>The manifest file also indicates it:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="net.learn2develop.UsingNotifications"
        android:versionCode="1"
        android:versionName="1.0"&gt;
      &lt;uses-sdk android:minSdkVersion="8" /&gt;
  
      &lt;uses-permission android:name="android.permission.VIBRATE"&gt;&lt;/uses-permission&gt;
  
      &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
          &lt;activity android:name=".MainActivity"
                    android:label="@string/app_name"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;        
          &lt;activity android:name=".AlarmDetails" 
              android:label="Details of the alarm"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="net.learn2develop.AlarmDetails" /&gt;
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt; 
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
          &lt;activity android:name=".DisplayNotification" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="net.learn2develop.DisplayNotification" /&gt;
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt; 
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>