Android Question Floating button

Shivito1

Active Member
Licensed User
Trying to use Floating button. I followed this Thread: https://www.b4x.com/android/forum/threads/sd-floating-button-standout.80847/#content

The example runs fine.
When I add it to my program I get the following error:

B4X:
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:131)
    at b4a.example.standout._init_elements(standout.java:314)
    at b4a.example.standout._service_start(standout.java:552)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:163)
    at b4a.example.standout.handleStart(standout.java:113)
    at b4a.example.standout.onStartCommand(standout.java:81)
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3738)
    at android.app.ActivityThread.-wrap23(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1744)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6780)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
Caused by: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@20665ef -- permission denied for window type 2002
    at android.view.ViewRootImpl.setView(ViewRootImpl.java:921)
    at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:342)
    at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:97)
    at b4a.example.standout$CustomImageView.sharedConstructing(standout.java:633)
    at b4a.example.standout$CustomImageView.<init>(standout.java:604)
    at b4a.example.standout.newInstance2(standout.java:771)
    ... 18 more

Furthermore I have this error is from the release. If needed I can post the Error from Debug.
 
Last edited:

Shivito1

Active Member
Licensed User
I have tried removing everything from the Activity create except for the floating button. It's still crashes with the same error???
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
The example runs fine.
When I add it to my program I get the following error:
How does you manifest looks like?

Post the manifest-editor-Code
 
Upvote 0

Shivito1

Active Member
Licensed User
How does you manifest looks like?

Post the manifest-editor-Code
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="5" 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$")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
'End of default text.

'AdMob
AddApplicationText(
<meta-data android:name="com.google.android.gms.version"
  android:value="@integer/google_play_services_version"/>
<activity android:name="com.google.android.gms.ads.AdActivity"
  android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

)
'End of AdMob

'************ Firebase Ads ************
AddApplicationText(
  <activity
  android:name="com.google.android.gms.ads.AdActivity"
  android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
  android:theme="@android:style/Theme.Translucent" />
  <activity android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
  android:theme="@style/Theme.IAPTheme"/>
)
'************ Firebase Ads (end) ************

'************ Firebase Ads ************
AddApplicationText(
  <activity
  android:name="com.google.android.gms.ads.AdActivity"
  android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
  android:theme="@android:style/Theme.Translucent" />
  <activity android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
  android:theme="@style/Theme.IAPTheme"/>
)
'************ Firebase Ads (end) ************

'**** Multi Window ****
AddActivityText(main, <intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />

<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" /></intent-filter>)

AddApplicationText( <uses-library android:required="false" name="com.sec.android.app.multiwindow"> </uses-library>
    <meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
    <meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:value="632.0dip" />
    <meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" />
    <meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:value="632.0dip" />
    <meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:value="598.0dip" />)
'**** Multi Window ****
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
then i compare BOTH Codes
in this case here i just downloaded the example zip, open it with winrar and had a look at the B4A file in Notepad++....
Here i saw the uses line and my first thought was; DID HE changed his manifest accordingly???
Then i asked for the manifest-text (see above)
 
Upvote 0
Top