从服务开始活动

时间:2018-03-30 03:06:55

标签: android service timer

我想在活动C现在调用活动C时启动计时器服务我可以转到活动D和E但是当计时器停止然后我想重定向活动A(主页)时,没关系在计时器之后打开哪个活动可以是C,D或E. 我还想在C,D,E活动中显示剩余时间

我想要的这种计时器

$ make -f Makefilef 
gfortran -o h5_crtgrpar.exe h5_crtgrpar.o -I/fs/posgrado16/other0/guido       /libraries/hdf5/serial/include /fs/posgrado16/other0/guido/libraries/hdf5/serial/lib/libhdf5_fortran.a /fs/posgrado16/other0/guido/libraries /hdf5/serial/lib/libhdf5.a 
/fs/posgrado16/other0/guido/libraries/hdf5/serial/lib/libhdf5.a(H5PL.o): In    function `H5PL_term_interface':
H5PL.c:(.text+0x205): undefined reference to `dlclose'
/fs/posgrado16/other0/guido/libraries/hdf5/serial/lib/libhdf5.a(H5PL.o): In   function `H5PL_load':
H5PL.c:(.text+0x477): undefined reference to `dlsym'
H5PL.c:(.text+0x5be): undefined reference to `dlopen'
H5PL.c:(.text+0x5d7): undefined reference to `dlsym'
H5PL.c:(.text+0x704): undefined reference to `dlclose'
H5PL.c:(.text+0x789): undefined reference to `dlerror'
H5PL.c:(.text+0x960): undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
make: *** [h5_crtgrpar.exe] Error 1

2 个答案:

答案 0 :(得分:0)

您可以通过创建新的onFinish()

Intent中打开活动
Intent intent = new Intent(textView.getContext(), ActivityA.class);                      
startActivity(intent);

要启动该服务,您可以致电:

startService(new Intent(this, YourServiceClass.class));

答案 1 :(得分:0)

通过将Intent传递给startService()来启动服务以执行一次性操作。

intent dialogIntent = new Intent(this, MyActivity.class);
dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(dialogIntent);

试试这个。