When clicked on grid view how to send arralist(position) to another actvity

后端 未结 3 1089
不思量自难忘°
不思量自难忘° 2021-01-22 07:27

In this method I am receiving the ArrayList

        OkHttpHandler handler = new OkHttpHandler(MainActivity.this,new OkHttpHandler.MyInterface() {
           


        
3条回答
  •  既然无缘
    2021-01-22 08:12

    //Make constant class and add all data in this arraylist:
    //e.g : Constant.arrylist.add();
    public class Constant{
    public static ArrayList() arrylist = new ArrayList()
    }
    
    //Pass arraylist data
    Intent intent = new Intent(this,YourActivity.class);
    intent.putInt("position", arrylist.get(position));
    startActivity(intent);
    
    //Get position in another activity
    Bundle bundle = getIntent().getExtras();
    int position = bundle.getInt("position",0);
    
    //Now get Particular data 
    //e.g
    String url = Constant.arrylist.get(position).;
    //And so on..!
    

提交回复
热议问题