Android的 - 如何只通过点击应用程序图标执行项目的主要功能? [英] Android - How to execute main functionality of project only by clicking on the icon of application?

查看:171
本文介绍了Android的 - 如何只通过点击应用程序图标执行项目的主要功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只通过点击图标制作一个应用程序,并执行其主要功能所需。

I am making an app and required to execute its main functionality only by clicking on its icon.

在换句话说没有布局不小部件只是其工作。

In other words no layout no widget just its working.

当它应该执行其主要的功能的图标用户点击。我想到的一个方法是把所有的code在的onCreate 功能。

As soon as user click on the icon it should execute its main functionality. One way I think of is to put all the code in onCreate function.

或者,如果有任何其他方式请与我分享。

Or if there is any other way please share with me.

推荐答案

您必须有用户启动一个活动。这项活动可以直接调用finish()通过从onResume返回时间()不显示(你还需要设置机器人:主题=@安卓风格/ Theme.NoDisplay)。在实际工作中可以的onCreate()或者活动的发生,如果它是非常短暂的,否则你将需要启动服务,需要做的工作在其线程的照顾。

You must have an Activity that the user launches. That activity can just call finish() by the time it returns from onResume() to not be shown (you'll also need to set android:theme="@android:style/Theme.NoDisplay"). The actual work can happen in onCreate() or such of the activity if it is very brief, otherwise you'll need to start a service which takes care of doing the work in its thread.

但是。

有一个应用程序图标什么也不做,当用户触摸它是pretty体验不佳。我强烈反对这一点。你不应该有一个主入口进入你的应用程序,实际上并不启动应用程序。我可以向你保证,这样做的将会的导致你的应用程序评级下调得到,由于人们不理解你的应用程序。 (特别是如果这实际上是主要的活动,如果你的应用程序,因为他们会打市场打开按钮,它会做什么。Sucktastic。)

Having an app icon that does nothing when the user touches it is a pretty poor experience. I strongly recommend against that. You shouldn't have a main entry into your app that doesn't actually launch the app. I can assure you, doing so will result in your app rating getting lowered due to people not understanding your app. (Especially if this is actually the main activity if your app, because they will hit the "open" button in market and it will do nothing. Sucktastic.)

我不知道你在做什么,而是为用户preSS的首页屏幕按钮一般应以一个部件实现,如电源部件。这使得它更清楚是怎么回事,尤其是在视觉上可以让这个看起来像一个按钮,它们是pressing,而不是他们正在启动一个应用程序用户。

I don't know what you are doing, but buttons for the user to press from their home screen should generally be implemented with a widget, like the power widget. This makes it much more clear to the user what is going on, especially since visually you can make this look like a button they are pressing rather than an app they are launching.

这篇关于Android的 - 如何只通过点击应用程序图标执行项目的主要功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆