Class AvatarGenerator

java.lang.Object
com.example.iconic_raffleevent.AvatarGenerator

public class AvatarGenerator extends Object
Utility class for generating circular avatar images with initials. This class provides methods to create avatars based on a user's name, generating a unique color and initials for each avatar. It draws a colored circle with initials centered within it.
  • Constructor Details

    • AvatarGenerator

      public AvatarGenerator()
  • Method Details

    • generateAvatar

      @NonNull public static android.graphics.Bitmap generateAvatar(@Nullable String name, int size)
      Generates a circular avatar bitmap with the initials of the provided name.
      Parameters:
      name - The name from which to generate the avatar initials. If null or empty, an empty avatar will be created.
      size - The size (width and height) of the generated avatar bitmap in pixels.
      Returns:
      A Bitmap representing the generated avatar image.