B4J Question How to add more then 1 extension filter?

stanks

Active Member
Licensed User
Longtime User
something like this:

B4X:
fileChooser.getExtensionFilters().addAll(
new FileChooser.ExtensionFilter("All Images", "*.*"),
new FileChooser.ExtensionFilter("JPG", "*.jpg"),
new FileChooser.ExtensionFilter("PNG", "*.png")
);
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Try this:
B4X:
Dim jo As JavaObject = FileChooser1
dim ef1, ef2 As JavaObject
Dim l1 As List = Array("*.*")
ef1.InitializeNewInstance("javafx.stage.FileChooser$ExtensionFilter", Array("All Images", l1))
l1 = Array("*.jpg")
ef2.InitializeNewInstance("javafx.stage.FileChooser$ExtensionFilter", Array("JPG", l1))
jo.RunMethodJO("getExtensionFilters", null).RunMethod("addAll", array(ef1, ef2))
 
Upvote 0
Top