Skip to content

List Remove At

Summary

  • Internal name: ListRemoveAt
  • Category: Collections
  • Purpose: Remove the element at a given index from a list variable.
  • Task type: Normal

Compatibility

  • Minimum AndroMate version: 1.1.0

  • Maximum AndroMate version: 1.1.0

  • Minimum Android: Android 13 (API 33)

  • Maximum Android tested: Android 16 (API 36)

  • Supported manufacturers:

    • ✅ All manufacturers
  • Required permissions:

    • None

Detailed description

The List Remove At task removes the element at position index_input (zero-based) from a list variable. All elements after the removed one are shifted one position to the left.

If the index is out of bounds (negative or ≥ list size), the task throws COLLECTION-TASK-001.


Input parameters

Parameter Type Required Possible values Android Compatibility AndroMate Compatibility Default
list_variable_input Variable reference Yes Declared variable starting with $, holding a valid list Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0
index_input Integer / Variable Yes Zero-based index; must be 0 ≤ index < size Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0 0

Output parameters

None. The variable referenced by list_variable_input is updated with the element removed.


Exceptions

Code Exception Name Description
COLLECTION-TASK-001 List Variable Not a List Index is out of bounds — negative or ≥ list size.
COLLECTION-TASK-002 List Variable Name Invalid list_variable_input is empty or does not start with $.
RESOLVE-VAR-005 Resolve ArrayList Error The variable does not contain a valid JSON array string.

Execution flowchart

flowchart TD
    Start([Start ListRemoveAt]) --> ResolveList[🔄 Resolve list_variable_input]
    ResolveList --> CheckList{Valid list?}
    CheckList -->|No| E1[❌ RESOLVE-VAR-005]
    CheckList -->|Yes| ResolveIndex[🔄 Resolve index_input]
    ResolveIndex --> CheckBounds{0 ≤ index < size?}
    CheckBounds -->|No| E2[❌ COLLECTION-TASK-001]
    CheckBounds -->|Yes| Remove[list.remove index]
    Remove --> Store[💾 setVariableValue\nvar ← updated list]
    Store --> Success([✅ VoidResult])
    E1 --> Error([❌ Exception])
    E2 --> Error

    style Start fill:#e3f2fd
    style Success fill:#c8e6c9
    style Error fill:#ffcdd2
    style ResolveList fill:#fff9c4
    style ResolveIndex fill:#fff9c4
    style Store fill:#c8e6c9
    style E1 fill:#ffcdd2
    style E2 fill:#ffcdd2

Complete JSON example

{
  "ListRemoveAt": [
    {
      "id": "5",
      "title": "Remove first element",
      "list_variable_input": "$myList",
      "index_input": "0"
    }
  ]
}