Android - running a method periodically using postDelayed() call

前端 未结 8 1426
一向
一向 2020-11-27 13:45

I have a situation in an Android app where I want to start a network activity (sending out some data) which should run every second. I achieve this as follows:

In th

8条回答
  •  心在旅途
    2020-11-27 14:24

    I think you could experiment with different activity flags, as it sounds like multiple instances.

    "singleTop" "singleTask" "singleInstance"

    Are the ones I would try, they can be defined inside the manifest.

    http://developer.android.com/guide/topics/manifest/activity-element.html

提交回复
热议问题