here i am provide my second activity code on button click event here i am try to existing In any method for that to call ...?
- List item
ent object through call first activity.
public class SecondActivity extends ActionBarActivity {
private TextView tx1;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
tx1=(TextView)findViewById(R.id.textView1);
Intent i=getIntent();
String Fname=i.getStringExtra("Fname");
String Lname=i.getStringExtra("Lname");
tx1.setText("Your Name is: "+Fname+" "+Lname);
Toast.makeText(getApplicationContext(), Fname+Lname, Toast.LENGTH_LONG).show();
Button btn=(Button)findViewById(R.id.button1);
btn.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
// TODO Auto-generated method stub
// Intent in=new Intent(SecondActivity.this,MainActivity.class);
// startActivity(in);
Toast.makeText(getApplicationContext(), "Call First Activity",Toast.LENGTH_SHORT).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.second, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings)
{
return true;
}
return super.onOptionsItemSelected(item);
}
}
0 comments:
Post a Comment