Parameter Passing Between Activities in ANdroid

Jyotishgher Astrology
By -
0
Main Activity 

listView.setOnItemClickListener(new AdapterView.OnItemClickListener(){ 

     @Override
     public void onItemClick(AdapterView<?> parent, View view,
                             int position, long id) { 
      String name = ((TextView) view.findViewById(R.id.title))
     .getText().toString();
      
      Intent intent = new Intent(Movies.this, Detail.class);    
      intent.putExtra(Title, name);
      intent.putExtra("images", bitmap);
      
         startActivity(intent);
     }
     });}
Second Activity
 public class Detail extends ActionBarActivity{
 private static String Title="title";
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.detail);
  getSupportActionBar().hide();

 Intent i=getIntent();
   String name = i.getStringExtra(Title);
   TextView lblName = (TextView) findViewById(R.id.name_label);
   
    lblName.setText(name);}

    
    public void onClickHandler(View v){
      switch(v.getId()){
      case R.id.imageview1:
      startActivity(new Intent(this,Movies.class));
     }
     
}}


Post a Comment

0Comments

Post a Comment (0)