How to pass value using Intent between Activity in Android?

前端 未结 7 1495
面向向阳花
面向向阳花 2020-12-01 16:48

I want to pass the value of the position in one activity class to another...

My code is as follows:

protected void onListItemClick(ListView listView,         


        
7条回答
  •  不思量自难忘°
    2020-12-01 17:28

    From the First Activity

    Intent i=new Intent(getApplicationContext(),BookPractionerAppoinment.class);
    i.putExtra("prac","test");
    startActivity(i);
    

    Getting values in Second ACT Activity

    String prac=getIntent().getStringExtra("prac);
    

    For Serialized objects:

    Passing

    Intent i=new Intent(getApplicationContext(),BookPractionerAppoinment.class);
     i.putExtra("prac",pract);
     startActivity(i);
    

    Getting

    pract= (Payload) getIntent().getSerializableExtra("prac");
    

提交回复
热议问题