My first Extension
Name: Lists
PublishOn: 4-07-2021
Version: 1.0
Usage: Convert number and text in ascending order, Convert number and text in descending order, Find maximum number from a list, Find minimum number from a list, Reverse a list
Blocks:
HowToUse:
Thanking: Thanks a lot to @shreyash extension build with rush a new and improved way of building extension, thanks a lot to @Aarush_Kumar he gives me the tutorial of java
DownloadLink: v1 com.faraz.Lists.aix (3.8 KB)
v2 com.faraz.Lists.aix (3.8 KB)
JavaSource
package com.faraz.Lists;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.errors.YailRuntimeError;
import com.google.appinventor.components.runtime.util.YailList;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;public class Lists extends AndroidNonvisibleComponent {
public Lists(ComponentContainer container) {
super(container.$form());
}@SimpleFunction(description = "")
public Object Sort(List list) {
List sort = new ArrayList(list);
Collections.sort(sort);
return sort;
}@SimpleFunction(description = "")
public Object Reverse(List list) {
List reverse = new ArrayList(list);
Collections.reverse(reverse);
return reverse;
}@SimpleFunction(description = "")
public Object MaximumNumber(List list) {
List max = new ArrayList(list);
Collections.sort(max);
return max.get(max.size() - 1);
}@SimpleFunction(description = "")
public Object MinimumNumber(List list) {
List min = new ArrayList(list);
Collections.sort(min);
return min.get(0);
}
}