I am trying to use MvxAutoCompleteTextView, but it is stuck with the following output in Debug:
mvx: Diagnostics: 3.57 Waiting for launch
As soon as I run the application in the emulator (Android 4.3, Hardware keyboard DISABLED), I see a message Wait starting for, and when I type, no suggestions are displayed.
My ViewModel:
public class FirstViewModel : MvxViewModel
{
public FirstViewModel()
{
ClearResults();
}
public string[] AutoCompleteSuggestions { get; set; }
private string _currentTextHint;
public string CurrentTextHint
{
get { return _currentTextHint; }
set
{
_currentTextHint = value;
base.RaisePropertyChanged(() => CurrentTextHint);
if (CurrentTextHint == null || CurrentTextHint.Length < 3)
ClearResults();
else
BeginSearchAsync();
}
}
private void ClearResults()
{
AutoCompleteSuggestions = new string[0];
base.RaisePropertyChanged(() => AutoCompleteSuggestions);
}
private async void BeginSearchAsync()
{
await Task.Delay(2000);
AutoCompleteSuggestions = new string[] { "test", "ok" };
base.RaisePropertyChanged(() => AutoCompleteSuggestions);
}
public string Selected { get; set; }
public string CurrentText { get; set; }
}
Firstview.axml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<MvxAutoCompleteTextView
android:id="@+id/autoCustomerName"
android:inputType="textPersonName"
android:layout_width="366.7dp"
android:layout_height="49.1dp"
android:paddingLeft="5dp"
android:completionThreshold="3"
android:hint="hint..."
android:gravity="left|center_vertical"
local:MvxBind="ItemsSource AutoCompleteSuggestions; PartialText CurrentTextHint; SelectedObject Selected; Text CurrentText;" />
</LinearLayout>
source
share