My extension is compiling but after use in app,it is showing runtime error

@HIFI_APPS what result will the arrayer return?

You're parsing them to Integer. If you put a list with characters then you will get an error.

2 Likes

@oseamiya you must not use list if you are using integers in your extension

edited post

Only example it will convert not return

How can you save String data in int array :sweat_smile: :laughing:

1 Like

Please test you're code before posting it.

2 Likes

I can't in mobile but re edited

Again :sweat_smile:. How can you assign int array value to string array? :laughing: :expressionless:

2 Likes

Array and ArrayList are different.
This should work fine:

List list = new ArrayList<>();
String[] sArray = yailList.toStringArray();
for (String s:sArray){
  list.add(s);
}
list.remove(index - 1);//now you can add and remove items
2 Likes
@SimpleFunction
    public void Example(YailList list) {
        Object[] arrayer = new Object[list.size()];
        int index = 0;
        for(Object e : list.toArray()) {
            arrayer[index] = e;
            index++;
        }
    }

Try this for all type of things to array

The object must be Object

Hmm, @HIFI_APPS it's better if you use a laptop :confused:

1 Like

@HIFI_APPS Think you need to learn more :confused:

2 Likes

btw, what's the point of adding index++

@vknow360 i edited yes will it work

List list = new ArrayList<>();
Object[] sArray = yailList.toArray();
for (Object s:sArray){
  list.add(s);
}

And

(String) s

To convert to string ...

#Off topic
Yes I need to learn actually I copy pasted
Ur post

...

Really sorry if i am annoying.

Please correct the object to Object.

Which IDE do you use?

It's okay but should first test everything.

1 Like

Thank you for the code that you share @vknow360,
I've tried it and your code 100% works perfectly. :grin: :+1:

This is the code I've tried :

   @SimpleFunction(description="")
   public YailList RemoveItem(YailList yailList, int index){

     List list = new ArrayList<>();
     String[] sArray = yailList.toStringArray();
       for (String s:sArray){
         list.add(s);
       }
     list.remove(index - 1);//now you can add and remove items
     return YailList.makeList(list);

   }
3 Likes

I know it is only an example, but... :grin:

Taifun

7 Likes