Search code examples
androidphotoeditorsdk

I want to add stickers from a folder


I have 100+ png files I need to add as stickers. I would like to place them in a folder i.e. "/assets/stickers" or in "res/raw". But i have been unable to figure out how to then read the File/Uri for these images to create the ImageStickerAsset and ImageStickerItem lists.

Any help would be much appreciated


Solution

    1. put the sticker png into res/drawable-nodpi/, not res/raw/ (because loading of images in drawable-nodpi is faster)

    2. Add the stickers as ImageStickerAsset's like this

      AssetConfig assetConfig = settingsList.getConfig(); assetConfig.addAsset(new ImageStickerAsset( "sticker_FILE_NAME", ImageSource.create(R.drawable.file_name) ));

    3. Create previews from you sticker, with max 196x196px, prefix the files with something like "_preview" and put they also into res/drawable-nodpi/

    4. Add a StickerCategoryItem("category_NAME", R.string.categoryName, ImageSource.create(R.drawable.file_name_preview), ...)

    5. Replace ... with your ImageStickerItem's (must have the same ID as the assets) and separate the items with a commas

    new ImageStickerItem("sticker_FILE_NAME", R.string.myname, ImageSource.create(R.drawable.file_name_preview)),

    1. Look here for a better example: https://docs.photoeditorsdk.com/guides/android/v6/features/stickers