Service类:
Intent i = new Intent();
i.setClass(Service类类名.this, 要打开的Activity类名.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //必须
startActivity(i);
或者:
1.在AndroidManifest.xml中为要打开的Activity添加:
- <intent-filter>
- <action android:name="nameyoulike"></action>
- </intent-filter>
2.Service类:
Intent i = new Intent();
i.setAction("nameyoulike");
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //必须
startActivity(i);