Application crashed when long click on first items
<p>My Application is crashed when Long click on the First Items of the List view.Actually First Item is "Go To Up Folder" which is added manually and after "Go To Up Folder" List view items comes.Now i am using long click of all items of the list except "Go To Up Folder" items.
But when i Long click on "Go To Up Folder" my App is crashed.
A small part of my code is given below:</p>

<pre><code>if (tt != null) 
{
if ((m_remotefilepath == null)|| (m_remotefilepath.matches("/"))) 
 {
 tt.setText(items[position].m_FileName);
 } 
else 
{
 if (position &gt; 0) 
 {
 tt.setText(items[position].m_FileName);
} 
else 
{
tt.setText("Go To Up Folder");
imageView.setImageResource(R.drawable.up);
}
}
}
</code></pre>

<p>MY log cat:</p>

<pre><code>04-27 12:06:21.635: DEBUG/AndroidRuntime(230): Shutting down VM
04-27 12:06:21.645: WARN/dalvikvm(230): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
04-27 12:06:21.686: ERROR/AndroidRuntime(230): Uncaught handler: thread main exiting due to uncaught exception
04-27 12:06:21.965: ERROR/AndroidRuntime(230): java.lang.NullPointerException
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at com.officelinq.android.OfficeLinQ.onCreateContextMenu(OfficeLinQ.java:1549)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at android.view.View.createContextMenu(View.java:4086)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at com.android.internal.view.menu.ContextMenuBuilder.show(ContextMenuBuilder.java:81)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at com.android.internal.policy.impl.PhoneWindow$DecorView.showContextMenuForChild(PhoneWindow.java:1848)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:458)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:458)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:458)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:458)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:458)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:458)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at android.widget.AbsListView.performLongPress(AbsListView.java:1703)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at android.widget.AbsListView.access$500(AbsListView.java:71)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at android.widget.AbsListView$CheckForLongPress.run(AbsListView.java:1656)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at android.os.Handler.handleCallback(Handler.java:587)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at android.os.Handler.dispatchMessage(Handler.java:92)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at android.os.Looper.loop(Looper.java:123)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at android.app.ActivityThread.main(ActivityThread.java:4363)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at java.lang.reflect.Method.invokeNative(Native Method)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at java.lang.reflect.Method.invoke(Method.java:521)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
04-27 12:06:21.965: ERROR/AndroidRuntime(230):     at dalvik.system.NativeStart.main(Native Method)
04-27 12:06:22.235: INFO/Process(34): Sending signal. PID: 230 SIG: 3
04-27 12:06:22.285: INFO/dalvikvm(230): threadid=7: reacting to signal 3
04-27 12:06:22.963: INFO/dalvikvm(230): Wrote stack trace to '/data/anr/traces.txt'
</code></pre>

<p>The Code on line no 1549 is:
menu.setHeaderTitle(m_adapter.items[info.position].m_FileName);</p>
