android start activity from service

后端 未结 7 1056
傲寒
傲寒 2020-11-22 03:04

Android:

public class LocationService extends Service {

@Override
    public void onStart(Intent intent, int startId) {
        super.onStart(intent, startI         


        
7条回答
  •  盖世英雄少女心
    2020-11-22 03:36

    From inside the Service class:

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

提交回复
热议问题