title: Android: Unable to start activity java.lang.nullpointerexception
body: <p>I have created one <code>activity</code> And I write some functions inside <code>onCreate()</code> function.
  On Running the application , I got some error message Unable to start activity <code>java.lang.nullpointerexception</code> . And I <em>have included</em> this activity in <code>AndroidManifest.xml</code></p>
  
  <pre><code>@Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.user_report_hr_full);
           List&lt;Employee&gt; data = new ArrayList&lt;Employee&gt;();
              Employee eg=new Employee();
              ListView li=(ListView)findViewById(R.id.user_report_hr_list);
              Intent myIntent = getIntent(); // this is just for example purpose
              Bundle b=myIntent.getExtras();
              Log.i("User Report by Hours", b.toString());
              Toast.makeText(getApplicationContext(), "User ", Toast.LENGTH_LONG).show();
              if(b !=null)
              {
                  String username = b.getString("username");
                  String userid = b.getString("userid");
                  String startdate = b.getString("startdate");
                  String enddate = b.getString("enddate");
                  String mode=b.getString("mode");
                  Log.i("LOOP", userid+"-"+startdate+"-"+enddate+"-"+mode);
                  data=eg.getReports(username, userid, startdate, enddate,mode);
                  Log.i("Get Report",data.toString());
                  li.setAdapter(new UserHoursByReportArrayadapter(getApplicationContext(),data));
              }
  
  
      }
  </code></pre>
  
  <p>And My Log file is </p>
  
  <pre><code>05-08 11:45:30.745: I/User Report by HoursActivity:mode(517): 1
  05-08 11:45:30.837: I/User Report by Hours(517): Bundle[mParcelledData.dataSize=236]
  05-08 11:45:30.845: I/LOOP(517): 1-2012-04-08-2012-05-08-1
  05-08 11:45:30.855: D/HTTP(517): Execute HTTP Post Request
  05-08 11:45:30.855: D/UserID(517): Userid in EmpGlobal [1]
  05-08 11:45:30.855: D/Start date(517): Start date in EmpGlobal [2012-04-08]
  05-08 11:45:30.855: D/End date(517): End date in EmpGlobal [2012-05-08]
  05-08 11:45:30.855: D/Mode(517): Mode in EmpGlobal [1]
  05-08 11:45:48.275: I/log_tag(517):  Time: 2033755
  05-08 11:45:48.275: I/log_tag(517):  project name: AndroidTimesheet
  05-08 11:45:48.285: I/log_tag(517):  username: admin1
  05-08 11:45:48.285: I/log_tag(517):  Time: 34692
  05-08 11:45:48.285: I/log_tag(517):  project name: Google
  05-08 11:45:48.285: I/log_tag(517):  username: admin1
  05-08 11:45:48.285: I/Get Report(517): [com.technogems.employeetimecard.EmployeeGlobal@44da2ca8, com.technogems.employeetimecard.EmployeeGlobal@44da2f88]
  05-08 11:45:48.285: I/User Report by HoursAdapter(517): Inside constructor
  05-08 11:45:48.285: D/AndroidRuntime(517): Shutting down VM
  05-08 11:45:48.285: W/dalvikvm(517): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
  05-08 11:45:48.285: E/AndroidRuntime(517): Uncaught handler: thread main exiting due to uncaught exception
  05-08 11:45:48.295: E/AndroidRuntime(517): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.technogems.employeetimecard/com.technogems.employeetimecard.UserHoursByReport}: java.lang.NullPointerException
  05-08 11:45:48.295: E/AndroidRuntime(517):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
  05-08 11:45:48.295: E/AndroidRuntime(517):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
  05-08 11:45:48.295: E/AndroidRuntime(517):  at android.app.ActivityThread.access$2200(ActivityThread.java:119)
  05-08 11:45:48.295: E/AndroidRuntime(517):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
  05-08 11:45:48.295: E/AndroidRuntime(517):  at android.os.Handler.dispatchMessage(Handler.java:99)
  05-08 11:45:48.295: E/AndroidRuntime(517):  at android.os.Looper.loop(Looper.java:123)
  05-08 11:45:48.295: E/AndroidRuntime(517):  at android.app.ActivityThread.main(ActivityThread.java:4363)
  05-08 11:45:48.295: E/AndroidRuntime(517):  at java.lang.reflect.Method.invokeNative(Native Method)
  05-08 11:45:48.295: E/AndroidRuntime(517):  at java.lang.reflect.Method.invoke(Method.java:521)
  05-08 11:45:48.295: E/AndroidRuntime(517):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
  05-08 11:45:48.295: E/AndroidRuntime(517):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  05-08 11:45:48.295: E/AndroidRuntime(517):  at dalvik.system.NativeStart.main(Native Method)
  05-08 11:45:48.295: E/AndroidRuntime(517): Caused by: java.lang.NullPointerException
  05-08 11:45:48.295: E/AndroidRuntime(517):  at com.technogems.employeetimecard.UserHoursByReport.onCreate(UserHoursByReport.java:35)
  05-08 11:45:48.295: E/AndroidRuntime(517):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  05-08 11:45:48.295: E/AndroidRuntime(517):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
  05-08 11:45:48.295: E/AndroidRuntime(517):  ... 11 more
  </code></pre>
  
  <p>Please provide me the proper way to start that activity</p>