I want to pass a value from one avtivity to another activity by use intent.. Im not getting the value im getting as null.. There is no error in my logcat. Any help would appreciated. thanks in advance.
First activity
Intent intent = new Intent(Nexttopic.this, Quesans.class);
String name = getIntent().getStringExtra("name");
intent.putExtra("TopicName", tname);
intent.putExtra("Topicid", topicid);
intent.putExtra("LevelName",TAG_LEVELNAME);
intent.putExtra("Levelid",TAG_LEVELID);
intent.putExtra("Groupid",TAG_GROUPID);
startActivity(intent);
Second activity
Intent i=getIntent();
name=i.getStringExtra(tname);
tid=i.getStringExtra(topicid);
lid=i.getStringExtra(TAG_LEVELID);
gid=i.getStringExtra(TAG_GROUPID);
System.out.println("Result :"+name);
System.out.println("Result :"+tid);
System.out.println("Result :"+lid);
System.out.println("Result :"+gid);
You need to refer to the names of extra fields you have set while calling another activity.
So Change this :
to this :
hope it helps.