I know the above question have been ask several times. The previous answered thread does not provide me with the solution.
What i am trying to do is to click on my listview because i set the style with a dialog theme.
When i launch the activity it will appear like a dialog. In the dialog i applied listview.
I populate the listview with my sql lite data.
What i am trying to do now is that. I want to retrieve arraylist data. I successfully got the listview data when chosen.
But while setting text to the listview on my main activity. Even having :
EditText Messages = (EditText) findviewbyid(R.id.Messages);
Messages.setText(arr.get(i).tostring); <--------
This is where i got error.
Below is the error message.
07-24 10:08:41.803 6721-6721/com.example.xaviertang.phonewithsms E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.xaviertang.phonewithsms, PID: 6721
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.EditText.append(java.lang.CharSequence)' on a null object reference
at com.example.xaviertang.phonewithsms.listData$1.onItemClick(listData.java:38)
at android.widget.AdapterView.performItemClick(AdapterView.java:299)
at android.widget.AbsListView.performItemClick(AbsListView.java:1156)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:2963)
at android.widget.AbsListView$3.run(AbsListView.java:3856)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5118)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)