Android Question Open an "activity" without closing the main

vecino

Well-Known Member
Licensed User
Longtime User
Hello, is it possible to open an activity and stay open above the main activity?

Thanks and regards.

Example:
 

Attachments

  • example.jpg
    example.jpg
    6.1 KB · Views: 321

vecino

Well-Known Member
Licensed User
Longtime User
Hello, I've been testing this library and is not what I need.
With this library would have to write code for all the "sub activity" in the main activity.
What I want is to open another activity that is displayed above the main activity.
Is there no way to get it?

Thanks and regards.
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
The question is, if you need parts of the underlying activity, when the second one is open. If not, you can make the small activity with transparent background. In this situation, the user see the lower activity, but clicks dont have any effect. You can also reduce the alpha value or the transparency, so that the user can imagine, that there is something in the background. I made this type last week; then i wanted to click some buttons in the underlying window. For this i made a panel on the second activity, used the touch event and transformed this to the buttons of the first activity.

Greetings
Reinhard
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
The question is, if you need parts of the underlying activity, when the second one is open. If not, you can make the small activity with transparent background.

Hi, I like this solution, but can not get it to work. I put the second activity transparent and alpha value to zero, but the main activity is not shown background.
Please can you create me a simple example?
Thank you.
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
I made a demo and found out, why it does not work:
Insert
B4X:
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo.Light.Panel")
in the Manifest Editor; this made the difference.
In the sample you find an working example.
 

Attachments

  • Transparent.zip
    9 KB · Views: 268
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
My "Manifest Editor" already had that line:
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
  android:normalScreens="true"
  android:smallScreens="true"
  android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")

'SetActivityAttribute(Main, android:theme, "@android:style/Theme.NoTitleBar.Fullscreen")
'SetActivityAttribute(Main, android:theme, "@android:style/Theme.Holo.Light.NoActionBar")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo.Light.Panel")

'End of default text.

I get this error when compiling:
Parsing code. 0.00
Compiling code. 0.04
Compiling layouts code. 0.01
Generating R file. Error
AndroidManifest.xml:14: error: Error: No resource found that matches the given name (at 'theme' with value '@android:style/Theme.Holo.Light.Panel').

What I can do?
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
Hi,

i downloaded my own example; it compiles ok. I use version 2.71, no lib. I have no idea, what the difference could be...
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Hello, if I delete that line the Manifest Editor then it compiles but does not work transparency.
If I leave the line then it compiles with the error described above.
:(:(:(
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Hello, I could make it work this way:
B4X:
SetActivityAttribute(Act2, android:theme, @android:style/Theme.Translucent.NoTitleBar)
'SetApplicationAttribute(android:theme, "@android:style/Theme.Holo.Light.Panel")
I wonder, will I have to add as many lines as activity has my project?
B4X:
SetActivityAttribute (Act2, android: theme, @ android: style / Theme.Translucent.NoTitleBar)
SetActivityAttribute (Act3, android: theme, @ android: style / Theme.Translucent.NoTitleBar)
...
SetActivityAttribute (Act19, android: theme, @ android: style / Theme.Translucent.NoTitleBar)
SetActivityAttribute (Act20, android: theme, @ android: style / Theme.Translucent.NoTitleBar)
Will there be any problem if I do that?

Thanks and regards.
 
Upvote 0
Top