Pass data between classes

前端 未结 2 1014
孤城傲影
孤城傲影 2021-01-26 02:22

I have two classes. 1st class extends AppCompatActivity and has all my data like arraylist, constants... My 2nd class extends BaseAdapter. Now the question is: I need to use som

2条回答
  •  佛祖请我去吃肉
    2021-01-26 02:38

    you can pass data in constructor of second class like this:

    YourBaseAdapter adapter = new YourBaseAdapter(YourDataType1 data1, YourDatatype2 data2, ....)

    all you need to do is create matching constructor in YourBaseAdapter

提交回复
热议问题