我有一个 Android 应用程序,它在 MAIN Activity 中有一个执行操作的按钮。
有没有办法在不打开应用程序的情况下执行该操作?
我不知道我是否可以说它像一个小部件,因为它不等待更新。
用户应该能够在不打开应用程序的情况下单击应用程序图标来执行该操作。 可能吗?
最佳答案
是也不是。对于类似的问题,我必须做的是在我的主要 Activity 中有一个透明的 View ,然后自行终止:
在你的 Activity 中......
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Do whatever you need here...
finish();
}
在 AndroidManifest.xml 中:
<activity android:name=".whatever" android:theme="@android:
style/Theme.NoDisplay">
希望对您有所帮助,
菲尔·莱罗
关于android - 在不打开 Android 应用程序的情况下执行操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5575679/