Search code examples
androidsqlitecustom-adaptersearch-suggestionsearch-dialog

Android Studio, Search Activity (No data found massage)


I'm a beginner at Android development. I have a problem trying to show in a List view that the query doesn't bring any result. I just appear blank (nothing) without indications.

I'm using a Search dialog with customs suggestions, and when I start writing the query, the search starts suggesting, but when nothing match the query, no message appears.I want to create a massage that tells "no data found".

I've created a content provider, a custom suggest interface and a custom cursor adapter to query with a searchable activity an sqlite database.

All the app works perfect but the "no data" massage or toast.

Which part of the code you need?

Thanks


Solution

  • Add this in searchable class

    mlistView.setEmptyView( findViewById( R.id.zero_result ) );
    

    and this in xml layout file

     <TextView android:id="@+id/zero_resultt"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="No match data"/>