Android Question can't set widget icon in widget selector

leitor79

Active Member
Licensed User
Longtime User
Hi!


I'm making an app with a widget, using the corwin's example, but I can't manage to set my own icon for the widget selector; I see the generic icon:

2017-11-02 14_22_46.png


I correctly see my own icon in the app drawer. Also, when I start to drag that generic Icon, the icon dragged also is the correct icon.

My advancedwidget_info.xml:

B4X:
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="70dp" android:minHeight="70dp"
android:minResizeWidth="70dp"
android:initialLayout="@layout/advancedwidget_layout_init"
android:previewImage="@drawable/icon"
android:configure="my.app.widgetconfig"
android:resizeMode="horizontal"
android:widgetCategory="home_screen|keyguard"
android:updatePeriodMillis="0" />


My manifest:

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: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="13"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")

SetReceiverAttribute(advancedwidget, android:icon, "@drawable/icon")

'End of default text.
AddActivityText(WidgetConfig, <intent-filter>
        <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
    </intent-filter>)
   

SetApplicationAttribute(android:theme, "@style/MyAppTheme")


'End of default text.
AddReplacement(<action android:name="android.intent.action.MAIN" />, )
AddReplacement(<category android:name="android.intent.category.LAUNCHER" />, )

'RemovePermission(android.permission.WRITE_EXTERNAL_STORAGE)


Also; I've noticed that if i change the icon.png name in the drawable folder, aflter generating the app, a new-generic icon.png file is created in that folder...


Regards!
 

leitor79

Active Member
Licensed User
Longtime User
Hi Erel, thank you very much for your answer.

I've already tried cleaning cache and data, uninstall the previously installed app and restarting the device. However, I've managed to "fix" (?) the issue by wiping the user data and install again. I'll folllow up if needed.

Thank you very much!
 
Upvote 0
Top