Note that there are some explanatory texts on larger screens.

plurals
  1. POI have got a nullpointer exception
    primarykey
    data
    text
    <p><strong>hi i have created an application in android but on running I am getting a null pointer exception</strong> </p> <p><strong>I am giving my log cat and java class below I need a better solution to overcome this error</strong></p> <pre><code>08-23 10:09:57.426: E/AndroidRuntime(3373): FATAL EXCEPTION: main 08-23 10:09:57.426: E/AndroidRuntime(3373): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.neochat/com.neochat.Friends_list}:java.lang.NullPointerException 08-23 10:09:57.426: E/AndroidRuntime(3373):at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) 08-23 10:09:57.426: E/AndroidRuntime(3373): at android.app.ActivityThread.startActivityNow(ActivityThread.java:2023) 08-23 10:09:57.426: E/AndroidRuntime(3373): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)` </code></pre> <p><strong>Here is my java class</strong></p> <pre><code> public class Friends_list extends Activity implements OnItemClickListener{ private ArrayList&lt;String&gt; results = new ArrayList&lt;String&gt;(); private SQLiteDatabase newDB; LoginDataBaseAdapter loginDataBaseAdapter ; ListView listview; Context context; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_friends); listview=(ListView)findViewById(R.id.listview); context=this; loginDataBaseAdapter.getfriends(); public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { Intent in2=new Intent(Friends_list.this,InboxActivity.class); startActivity(in2); } } </code></pre> <p><strong>I am giving my getFriends() function below</strong></p> <pre><code> public List&lt;String&gt;getfriends(){ List&lt;String&gt; FriendList=new ArrayList&lt;String&gt;(); String selectQuery="select * from UserDetails"; db=dbHelper.getWritableDatabase(); Cursor cursor=db.rawQuery(selectQuery, null); while(cursor.moveToNext()){ FriendList.add(cursor.getString(1)); } return FriendList; } </code></pre> <p><strong>I want to display the contents of the table in the database to a listview in my activity</strong> can anybody help me</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload