S
S
sim-dev2015-12-03 08:08:39
Android
sim-dev, 2015-12-03 08:08:39

Android application without MainActivity - how to implement?

Hello!
I'm trying to make a simple application that, when clicking on its own icon, turns on / off the sound and displays a Toast with the corresponding image and text. The functionality is done, onCreate I complete finish() so that there is nothing on the screen, but ... Immediately after clicking on the icon, the animation of the appearance and disappearance of the main application window appears for a moment (I have a dark theme, and the window opens white). As a result, the whole impression of the application is spoiled.
I wanted Toast to simply pop up on click, and no other changes in the interface.
What am I doing wrong and how exactly should I do it?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
sim-dev, 2015-12-03
@sim-dev

In general, I answer to myself and to everyone who has not figured it out yet.
It turned out that everything is simple: Android Studio has an application theme editor. You click on the Styles resource folder and you see the Open Editor tooltip, and that's it. You need to select a theme like Theme.Translucent.NoTitleBar.Fullscreen , and for insurance, I also redid it and manually changed all the colors of this theme to #00000000 - in fact, the first byte should be zero (zero alpha channel, i.e. 100% transparent ) and the rest are the same.
After that, the application does not appear on the tap (so far I checked it in the emulator), and everything else works as intended.
Previously, these tips were not entirely inappropriate, but it was not possible to use them (this is regarding links to StackOverflow) - either my hands are crooked, or the new SDKs are not so easy to give in. In general, I manually could not change the manifest in such a way as to get a completely invisible main activity.
Thanks to all.

I
Ivan Lebedev, 2015-12-03
@kamiLLxiii

Here is a similar question stackoverflow.com/questions/10909683/launch-androi...
In short:

  1. In the manifest, post a theme for the activity Theme.Translucent.NoTitleBar.
  2. Do not call setContentView() in an activity.

K
Konstantin Dovnar, 2015-12-03
@SolidlSnake

This is easiest to implement using a widget, without an application icon at all.

G
Gleb Meshcheryakov, 2018-11-22
@arassa

Is it possible to transfer such an application to the Play Market?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question