String sel="SELECT "+stdb.sid+"," +stdb.amt+", "+stdb.details+" FROM "+stdb.tname;
Cursor c=dobj.rawQuery(sel, null);
while(c.moveToNext()){
int id=c.getInt(c.getColumnIndex(stdb.sid));
int amt=c.getInt(c.getColumnIndex(stdb.amt));
String printdetail=c.getString(c.getColumnIndex(stdb.details));
TextView tv1=(TextView)findViewById(R.id.textView1);
Log.e("gg",""+amt ); //the value of amt comes in logcat
tv1.setText(""+amt);//this gives nullpointer exception
here i am trying to get a value from an edittext i am able to see the value in the logcat but when i try to print the same with a settext(TextView) i get a NULLPOINTEREXCEPTION
Try this
And see if it prints the else log. If it does, that means your tv1 view is not getting initialized correctly. If not, will see what we can do.