I am sending long
value and String
value as extras from list activity to agenmin activity.But get java.lang.NullPointerException
at line 120
long baba1 = intent1.getExtras().getLong("baba",0); //line number 120
Sending from list activity
// long id from from listview
Intent i = new Intent(list.this, agenmin.class);
i.putExtra("baba", id);
startActivity(i);
//int position from listview
String c= Integer.toString(position);
Intent i1 = new Intent(list.this, agenmin.class);
i1.putExtra("abc", c);
startActivity(i1);
At receiving side agenmin
Intent i1 = getIntent();
String easyPuzzle;
easyPuzzle=i1.getStringExtra("abc");
textView2.setText(easyPuzzle);
Toast.makeText(getApplicationContext(), "Position " + (mess)+" ROWID " +(easyPuzzle), Toast.LENGTH_LONG).show();
Intent intent1 = getIntent();
long baba1 = intent1.getExtras().getLong("baba",0);
String strLong1 = Long.toString(baba1);
textView3.setText(strLong1);
Logcat:
05-27 20:43:45.169: E/AndroidRuntime(593): FATAL EXCEPTION: main
05-27 20:43:45.169: E/AndroidRuntime(593): java.lang.NullPointerException
05-27 20:43:45.169: E/AndroidRuntime(593): at com.indianic.demo.calendark.agenmin$1.onClick(agenmin.java:120)
I started the agenmin activity twice thats the reason for 'java.lang.NullPointerException
at line 120