79468843

Date: 2025-02-26 07:29:00
Score: 0.5
Natty:
Report link
   private void showToast(int index) {

    String versionName = androidVersions[index];
    int iconId = androidIcons[index];

    LayoutInflater inflater = getLayoutInflater();
    View layout = inflater.inflate(R.layout.custom_toast_layout, null);

    TextView toastTextView = layout.findViewById(R.id.toastText);
    ImageView toastImageView = layout.findViewById(R.id.toastIcon);

    toastTextView.setText(versionName);
    toastImageView.setImageResource(iconId);

    Toast toast = new Toast(getApplicationContext());
    toast.setDuration(Toast.LENGTH_SHORT);
    toast.setView(layout); // Set the custom layout
    toast.show();
}

androidvercode

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: cookie cutter