How do I instantiate a class in android which is also an activity?

前端 未结 4 505
深忆病人
深忆病人 2021-01-29 00:39

In android, how can I create a constructor for a class which is also an Activity?

My problem is,

I want to have two activity cl

4条回答
  •  一整个雨季
    2021-01-29 01:11

    Move your data into a separate class that isn't an activity at all but is shared between activities. The data can be structured into those data that come from the user and those that come from the network. See, for example, this thread for approaches to sharing data between activities.

    Instantiating a CalculateFare object that happens to be an activity won't help when the framework creates another instance when it needs an Activity.

提交回复
热议问题