Elements 9 Android Problem (on 8 all works fine)

Hello,
I updated my environment to Elements 9 and I have problem with compiling simple line
var vwynik: FilterResults := new android.widget.Filter.FilterResults;
I got error :
Error 159 (E400) No overloaded constructor with 1 parameter for type “android.widget.Filter.FilterResults” D:\projekty\Android\biblioteki\inpx_android_wspolne\adapter_bazowy\TInpx_Adapter_Filtr_Bazowy_rv.pas 49 35 inpx_android_wspolne

Why ??? On Elements 8 all works fine :frowning:
Simple object with one constructor without parameters as i call in my app :frowning:

Best regards
Mateusz

hard to say w/o more info. how is FilterResults defined? what .ctors does it have?

It is base class defined in android.widget :

I used as you see default constrcutor in my example…

Mateusz

Hmm, i get:

method MainActivity.onCreate(savedInstanceState: Bundle);
begin
  inherited;
  // Set our view from the "main" layout resource
  ContentView := R.layout.main;
  var vwynik := new android.widget.Filter.FilterResults; // E43 No static member "FilterResults" on type "android.widget.Filter"
end;

and i see Filter itself defined as a type:

android.widget.Filter = public abstract class(Object)
protected
  method performFiltering(arg1: CharSequence): Filter.FilterResults;
  method publishResults(arg1: CharSequence; arg2: Filter.FilterResults);
public
  constructor;
  method filter(constraint: CharSequence; listener: Filter.FilterListener); final;
  method filter(constraint: CharSequence); final;
  method convertResultToString(resultValue: Object): CharSequence;
end;

if FilterResults is supposed to be a nested type on that, i don’t see it. i’m referencing android-24/android.jar. What could i be missing compared to your scenario?

all i did was start a new Android app from template and add the one line.

Hmmm
All is strange… My target API is 22 I only changed Elements and I don’t understand it now :wink:
In my scenario I have

TInpx_Adapter_Filtr_Bazowy_rv = public class(android.widget.Filter)
protected
fAdapter : TInpx_Adapter_Widok;
flista : List;
protected
method performFiltering(constraint: CharSequence): Filter.FilterResults; override;
method publishResults(constraint: CharSequence; results: Filter.FilterResults); override;
method SprawdzWarunek(aPozycja : Element; aWyszukiwanyCiag : CharSequence) : Boolean; abstract;
public
property Lista : List read flista write flista;
constructor(aAdapter : TInpx_Adapter_Widok;aLista : List);
end;

method TInpx_Adapter_Filtr_Bazowy_rv.performFiltering(constraint: CharSequence): Filter.FilterResults;
begin
var vwynik: FilterResults {:= new android.widget.Filter.FilterResults} - this works on 8 and now i can’t create this object :(
if ((constraint = nil) or (constraint.length() = 0)) then begin
vwynik.values := flista;
vwynik.count := flista.size;
end
else
begin
var vWyszukanaLista: List := new ArrayList;
for each vPozycja: Element in flista do begin
if SprawdzWarunek(vPozycja, constraint) then
vWyszukanaLista.add(vPozycja);
end;
vwynik.values := vWyszukanaLista;
vwynik.count := vWyszukanaLista.size();
end;
exit vwynik

end;

I found many examples and everybody use FilterResults as I :slight_smile: for example:

Ok; i don’t have 22 to tens, right now. all i know is in 24 that type doesn’t seem to exist…

I found only something like that but…

Can someone give some directions ?