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

前端 未结 4 571
深忆病人
深忆病人 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:08

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

    You don't.

    I want to have two activity classes (estimateFare and Mapping) which both send data to a an activity class (CalculateFare).

    None of those classes will be touching each other except via startActivity(). Pass data between activities via Intent extras or via a central data model (e.g., database).

    When the class is called during runtime of the application I get the following message in the LogCat

    That is because you need to delete your constructor.

提交回复
热议问题