Add new Activity in AndroidManifest.xml
==================================
USING INTENT:
==============
==================================
<activity
android:name=".LoginActivity"
android:label="@string/login_act">
</activity>
USING INTENT:
==============
public class SampleAppActivity extends Activity implements OnClickListener{
/** Called when the activity is first created. */
private Button btn_go;
Button btn_next;
AlertDialog alertDialog;
EditText nw_name;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btn_next.setOnClickListener(this);
btn_next.setOnClickListener(this);
}
public void onClick(View v) {
// TODO Auto-generated method stub
nw_name = (EditText) findViewById(R.id.nw_name);
String name = (String) nw_name.getText().toString();
Intent i = new Intent(SampleAppActivity.this, LoginActivity.class);
i.putExtra("name", name);
Log.d(name, " hi....... name "+name);
startActivityForResult(i, 1);
}
}
public class LoginActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.register);
Intent i = getIntent();
String name = i.getStringExtra("name");
TextView nameText =(TextView) findViewById(R.id.r_name);
nameText.setText(name);
System.out.println("hi...................." +name);
Log.d(name, " hi..i received name : "+name);
}
}
Just refer: http://geekswithblogs.net/bosuch/archive/2011/01/17/android---passing-data-between-activities.aspx
USING BUNDLE:
==============
Just Refer : http://remwebdevelopment.com/dev/a33/Passing-Bundles-Around-Activities.html
Just refer: http://geekswithblogs.net/bosuch/archive/2011/01/17/android---passing-data-between-activities.aspx
USING BUNDLE:
==============
Just Refer : http://remwebdevelopment.com/dev/a33/Passing-Bundles-Around-Activities.html
No comments:
Post a Comment