samsung keyboard isnt responding when android Autocompelete edittext DropDown list showing

I am building indian railway app that shows live train status etc.

in this app i am using autocomplete edittext dynamic train name suggestion from json array.

when entering some words in autocomplete textview is working fine but when dropdown is showing keyboard hanging and shows msesage samsung keyboard isn’t responding. sometimes the application isn’t responding.

i also try runonUiThread but the issue not solved.

Here is my activity

    public class TrainRoute extends AppCompatActivity {
    Button trainroute_btn;
    AutoCompleteTextView autoCompleteText;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.train_route);

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        toolbar.setTitle("Train Route");
        setSupportActionBar(toolbar);

        autoCompleteText = (AutoCompleteTextView) findViewById(R.id.routeTrainNo_autotxt);

       new AutoCompleteT(TrainRoute.this,autoCompleteText);
        autoCompleteText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View view, boolean b) {
                autoCompleteText.showDropDown();
            }
        });


        Intent intent = getIntent();
        if (intent!=null){


                String trainNumber = intent.getStringExtra("TrainNumber");
            autoCompleteText.setText(trainNumber);
        }

        trainroute_btn = (Button) findViewById(R.id.train_route_btn);

        trainroute_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {


                String train_number = autoCompleteText.getText().toString();

                if (!train_number.isEmpty()) {
                    try {

                        String trainNoSubstring = train_number.substring(0, 5);
                        Intent intent = new Intent(TrainRoute.this, TrainRouteResult.class);
                        intent.putExtra("TrainNumber", trainNoSubstring);
                        startActivity(intent);

                    } catch (StringIndexOutOfBoundsException | NullPointerException e) {
                        Toast.makeText(TrainRoute.this, "Please Enter Valid Detail", Toast.LENGTH_LONG).show();

                    }
                }else {
                    Toast.makeText(TrainRoute.this, "Please Enter Detail", Toast.LENGTH_SHORT).show();

                }
                }


            });
        }}`


Here is my custom adapter and filter    


    `@SuppressLint("ViewConstructor")
    public class AutoCompleteT extends android.support.v7.widget.AppCompatAutoCompleteTextView {

        String newText;
        Context context;

        ArrayList<String> originalList;


        public AutoCompleteT(final Context context, AutoCompleteTextView textView) {
            super(context);
            this.context = context;
            autoCompleteText = textView;

            autoCompleteText.addTextChangedListener(new TextWatcher() {
                @Override
                public void beforeTextChanged(CharSequence s, int start, int count, int after) {

     }             @Override
                public void onTextChanged(CharSequence s, int start, int beforecount) {

                     newText = s.toString();
                     new JsonData(newText);
                 }

                @Override
                public void afterTextChanged(Editable s) {  

            }
          });
       }private class JsonData {
            String url;
            String result;
           AutoTrainAdapter adapter;

            private JsonData(String newText) {
                  newText = newText.trim();
                newText = newText.replace(" ", "+");

                url = "http://api.railwayapi.com/v2/suggest-train/train/"+newText+"/apikey/";

                JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, url, (String) null, new Response.Listener<JSONObject>() {
                    @Override
                    public void onResponse(JSONObject response) {

                        try {
                            originalList = new ArrayList<>();

                            final JSONArray suggestArray = response.getJSONArray("trains");
                            for (int i = 0; i < suggestArray.length(); i++) {
                                JSONObject jsonObject = suggestArray.getJSONObject(i);
                                String number = jsonObject.getString("number");
                                String name = jsonObject.getString("name");
                                result = "" +number+ "  " + name + "";
                                originalList.add(result);

                            }


                                    adapter = new AutoTrainAdapter(context, R.layout.support_simple_spinner_dropdown_item);
                                    autoCompleteText.setAdapter(adapter);
                                    autoCompleteText.setThreshold(1);
                                    autoCompleteText.requestFocus();
                                    autoCompleteText.showDropDown();




                        } catch (JSONException e) {
                            e.printStackTrace();
                        }


                    }
                }, new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {

                        Log.d("Volley", "Error" + error);

                    }
                });

                jsonObjectRequest.setRetryPolicy(new DefaultRetryPolicy(30000,1,1.0f));
                jsonObjectRequest.setShouldCache(false);
                MySingalton.getmInstance(context).addToRequestque(jsonObjectRequest);
            }
            @SuppressWarnings("deprecation")
            class AutoTrainAdapter extends ArrayAdapter<String> implements Filterable {

                ArrayList<String> SuggestNamelist;
                ArrayList<String> FilterList;
                private Context mContext;

                @NonNull
                @Override
                public Filter getFilter() {
                    return nameFilter;
                }

                Filter nameFilter = new Filter() {
                    @Override
                    public String convertResultToString(Object resultValue) {
                        return resultValue.toString();
                    }

                    @Override
                    protected FilterResults performFiltering(CharSequence constraint) {
                        if (!(constraint == null || constraint.toString().trim().isEmpty())) {
                            SuggestNamelist.clear();
                            for (int i = 0; i < originalList.size(); i++) {
                                if (originalList.get(i).contains(constraint.toString()))
                                {
                                    SuggestNamelist.add(originalList.get(i));
                                }}
    FilterResults filterResults = new FilterResults();
    filterResults.values = SuggestNamelist;
    filterResults.count = SuggestNamelist.size();
    return filterResults;
      } else {
                            return new FilterResults();
                        }
                    }

                    @Override
                    protected void publishResults(CharSequence constraint, FilterResults results) {


                        @SuppressWarnings("unchecked") final
                        ArrayList<String> filteredList = (ArrayList<String>) results.values;



                        if (results.count > 0) {
                            clear();
                            runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    for (String c : filteredList) {
                                        add(c);
                                    }
                                }});
                            notifyDataSetChanged();
                            FilterList = new ArrayList<>();
                            FilterList = filteredList;
                        }

                    }
                };
     public AutoTrainAdapter(Context context,int resource) {
                    super(context, resource);
                    this.mContext = context;
                    SuggestNamelist = new ArrayList<>();
                }

                public int getCount() {
                    return this.SuggestNamelist.size();
                }

                public String getItem(int i) {
                    return this.SuggestNamelist.get(i);
                }

                @NonNull
                public View getView(int i, View view, @NonNull ViewGroup viewGroup) {
                    @SuppressLint("ViewHolder") View inflate = LayoutInflater.from(this.mContext).inflate(R.layout.custom_dropdown, null);
                    TextView textView = inflate.findViewById(R.id.txtview);
                    textView.setTextColor(Color.BLACK);
                    textView.setText(this.SuggestNamelist.get(i));
                    return inflate;
                }}}}`

Here is xml file

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:background="#fffbfb"
tools:context="trainRoute.TrainRoute">
<include
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    layout="@layout/toolbar"
    android:id="@+id/toolbar">
</include>
<com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    ads:adSize="BANNER"
    ads:adUnitId="@string/banner_ad_unit_id"/>
<LinearLayout
  android:id="@+id/header_card_view"
  android:layout_width="match_parent"
  android:layout_height="200dp"
  android:layout_below="@id/toolbar"
  android:background="#ffff4444"
  android:gravity="center"
  android:orientation="vertical">
  <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="Train Route"
      android:textColor="#ffffff"
      android:background="@drawable/curve_btn"
      android:textStyle="bold"
      android:textSize="20sp"
      android:padding="5dp"
      android:layout_marginTop="15dp"/>
  </LinearLayout>
  <View
    android:layout_width="match_parent"
    android:layout_height="2dp"
    android:layout_below="@id/toolbar"
    android:background="#ffffff">
  </View>
  <ScrollView
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:layout_below="@id/header_card_view"
  android:layout_above="@id/adView">
  <LinearLayout
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">

<AutoCompleteTextView
    android:id="@+id/routeTrainNo_autotxt"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:hint="Enter Train Number"
    android:layout_gravity="center"
    android:background="@drawable/edittext_style"
    android:dropDownSelector="#a0b4f0"
    android:layout_marginLeft="30dp"
    android:imeOptions="actionDone"
    android:dropDownWidth="match_parent"
    android:dropDownHeight="wrap_content"
    android:inputType="textAutoComplete"
    android:maxLines="1"
    android:lines="1"
    android:ems="10"
    android:layout_marginRight="30dp"
    android:textSize="18sp"
    android:textColor="#ffffff"
    android:dropDownAnchor="@+id/toolbar"
    android:textColorHint="#ffffff"
    android:padding="10dp"/>

<Button
    android:id="@+id/train_route_btn"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:background="@drawable/curve_btn"
    android:layout_marginTop="20dp"
    android:textColor="#ffffff"
    android:textStyle="bold"
    android:layout_marginLeft="30dp"
    android:layout_marginRight="30dp"
    android:textSize="15sp"
    android:layout_gravity="center"
    android:text="@string/get_route" />
</LinearLayout>
</ScrollView>
    </RelativeLayout>

Log:

  08-11 10:40:04.518 26243-26306/? W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST 
  denied by client
  08-11 10:40:04.518 26243-26243/? E/SamsungIME: ET9KDB_ProcessKey : 7
08-11 10:40:04.518 283-739/? W/AudioPolicyIntefaceImpl: Skipped to add 
effects on session 4884
08-11 10:40:04.618 985-1010/? E/ActivityManager: ANR in 
com.sec.android.inputmethod
                                             PID: 26243
                                             Reason: Input dispatching timed 
out (Waiting to send non-key event because the touched window has not 
finished processing certain input events that were delivered to it over 
500.0ms ago.  Wait queue length: 1.  Wait queue head age: 5672.2ms.)
                                             Load: 6.33 / 7.21 / 6.92
                                             CPU usage from 0ms to 6572ms 
later:
                                               67% 985/system_server: 29% 
user + 37% kernel / faults: 10980 minor 232 major
                                               33% 
23873/raza1001.com.indianrailwayinfosys: 32% user + 1.2% kernel / faults: 
2318 
minor 65 major
                                               12% 1444/com.android.phone: 
5.7% user + 6.4% kernel / faults: 3827 minor 52 major
                                               0.4% 277/debuggerd: 0.1% user 
+ 0.3% kernel / faults: 3784 minor 9 major
                                               8.8% 
1165/com.android.systemui: 4.2% user + 4.5% kernel / faults: 2597 minor 10 
major
                                               5.1% 
26243/com.sec.android.inputmethod: 2.7% user + 2.4% kernel / faults: 8349 
minor 327 major
                                               3% 28861/adbd: 0% user + 3% 
kernel / faults: 632 minor
                                               2.7% 159/mmcqd/0: 0% user + 
2.7% kernel
                                               2.4% 99/kswapd0: 0% user + 
2.4% kernel
                                               1.8% 283/mediaserver: 0.9% 
user + 0.9% kernel / faults: 195 minor 17 major
                                               0.3% 
1435/com.android.server.telecom: 0.1% user + 0.1% kernel / faults: 1528 
minor 222 major
                                               0% 
1515/com.sec.android.provider.logsprovider: 0% user + 0% kernel / faults: 
1484 minor 30 major
                                               0.9% 29271/logcat: 0.6% user 
 + 0.3% kernel / faults: 5 minor
                                               0.4% 22421/kworker/0:0: 0% 
user + 0.4% kernel
                                               0.1% 1//init: 0.1% user + 0% 
kernel / faults: 88 minor
                                               0.3% 151/irq/317-bt541_t: 0% 
user + 0.3% kernel
                                               0.3% 155/cfinteractive: 0% 
user + 0.3% kernel
                                               0.3% 253/servicemanager: 0% 
user + 0.3% kernel / faults: 25 minor
                                               0.3% 255/surfaceflinger: 0% 
user + 0.3% kernel / faults: 55 minor 2 major
                                               0% 3/ksoftirqd/0: 0% user + 
0% kernel
                                               0% 6/kworker/u8:0: 0% user + 
0% kernel
                                               0.1% 8/rcu_preempt: 0% user + 
0.1% kernel
                                               0% 14/ksoftirqd/1: 0% user + 
 0% kernel
                                               0% 24/ksoftirqd/3: 0% user + 
0% kernel
                                               0% 33/kworker/0:1H: 0% user + 
0% kernel
                                               0% 37/kworker/u9:0: 0% user + 
0% kernel
                                               0.1% 128/hwrng: 0% user + 
0.1% kernel
                                               0% 209/jbd2/mmcblk0p27: 0% 
 user + 0% kernel
                                               0.1% 
1669/com.google.android.marvin.talkback: 0.1% user + 0% kernel / faults: 102 
minor
                                                0% 16498/kworker/u8:4: 0% 
   user + 0% kernel
                                               0% 16499/kworker/u8:7: 0% 
    user + 0% kernel
                                               0% 18128/kworker/1:2: 0% user 
    + 0% kernel
                                               0.1% 25764/kworker/u8:1: 0% 
  user + 0.1% kernel
                                               0% 26086/kworker/u8:5: 0% 
    user + 0% kernel
                                               0.1% 28157/com.facebook.orca: 
     0.1% user + 0% kernel / faults: 24 minor
                                             43% TOTAL: 20% user + 18% 
     kernel + 3.9% iowait + 0.1% softirq
                                             CPU usage from 5821ms to 6345ms 
     later:
                                               109% 
      23873/raza1001.com.indianrailwayinfosys: 107% user + 1.8% kernel / 
   faults: 251 
     minor 13 major
                                                 92% 23873/nrailwayinfosys: 
      88% user + 3.7% kernel
                                                 15% 23888/GCDaemon: 15% 
    user + 0% kernel
                                                 1.8% 23882/ReferenceQueueD: 
    0% user + 1.8% kernel
                                                 1.8% 23883/FinalizerDaemon: 
    1.8% user + 0% kernel
                                               7.6% 985/system_server: 1.9% 
     user + 5.7% kernel / faults: 3 minor
                                                 3.8% 1010/ActivityManager: 
    0% user + 3.8% kernel
                                                 1.9% 1053/Binder_3: 1.9% 
    user + 0% kernel
                                               1.3% 151/irq/317-bt541_t: 0% 
    user + 1.3% kernel
                                               1.9% 283/mediaserver: 1.9% 
   user + 0% kernel
                                                 1.9% 726/FastMixer: 1.9% 
   user + 0% kernel
                                             32% TOTAL: 27% user + 3.9% 
   kernel + 0.4% iowait
    08-11 10:40:04.708 985-1728/? W/ActivityManager: Scheduling restart of 
   crashed 
  service 
    com.sec.android.inputmethod/com.nuance.connect.service.ConnectClient in 
  1000ms
    08-11 10:40:04.708 985-1728/? W/ActivityManager: Scheduling restart of 
   crashed 
    service com.sec.android.inputmethod/.SamsungKeypad in 1000ms
     08-11 10:40:04.748 985-985/? W/InputMethodManagerService: Session 
    failed to 
   close due to remote exception

      android.os.DeadObjectException
                                                          at 
    android.os.BinderProxy.transactNative(Native Method)
                                                          at 
    android.os.BinderProxy.transact(Binder.java:496)
                                                          at 
   com.android.internal.view.IInputMethodSession$Stub$Proxy.finishSession
 (IInputMethodSession.java:305)
                                                          at 
 com.android.server.InputMethodManagerService.finishSessionLocked
(InputMethodManagerService.java:2056)
                                                          at 


 com.android.server.InputMethodManagerService.clearClientSessionLocked
  (InputMethodManagerService.java:2047)
                                                          at
  com.android.server.InputMethodManagerService.clearCurMethodLocked
 (InputMethodManagerService.java:2073)
                                                       at 

 com.android.server.InputMethodManagerService.onServiceDisconnected
 (InputMethodManagerService.java:2092)
                                                          at 
 android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1208)
                                                          at 


    android.app.LoadedApk$ServiceDispatcher$RunConnection.run
(LoadedApk.java:1222)
                                                          at 
   android.os.Handler.handleCallback(Handler.java:739)
                                                          at 
    android.os.Handler.dispatchMessage(Handler.java:95)
                                                          at 
     android.os.Looper.loop(Looper.java:135)
                                                          at 
  com.android.server.SystemServer.run(SystemServer.java:687)
                                                          at 
   com.android.server.SystemServer.main(SystemServer.java:469)
                                                          at 
  java.lang.reflect.Method.invoke(Native Method)
                                                          at 
 java.lang.reflect.Method.invoke(Method.java:372)
                                                          at 
   com.android.internal.os.ZygoteInit$MethodAndArgsCaller.
   run(ZygoteInit.java:1397)
                                                          at 
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1192)
   08-11 10:40:04.798 1165-1165/? W/Settings: Setting airplane_mode_on has 
    moved 
    from android.provider.Settings.System to 
   android.provider.Settings.Global, 
    returning read-only value.
      08-11 10:40:04.818 2970-2970/? W/ContextImpl: Calling a method in the 
   system 
       process without a qualified user: 
    android.app.ContextImpl.startService:1864 
      android.content.ContextWrapper.startService:522 
    android.content.ContextWrapper.startService:522 
  com.samsung.android.sm.common.SmartManagerReceiver.b:199 
  com.samsung.android.sm.common.SmartManagerReceiver.onReceive:93 
  08-11 10:40:04.838 1165-1165/? W/Settings: Setting airplane_mode_on has 
 moved 
from android.provider.Settings.System to android.provider.Settings.Global, 
returning read-only value.
08-11 10:40:04.858 1165-1165/? W/Settings: Setting airplane_mode_on has 
moved 
from android.provider.Settings.System to android.provider.Settings.Global, 
  returning read-only value.
 08-11 10:40:05.708 985-1010/? E/ActivityManager: checkUser: 
useridlist=null, 
  currentuser=0
    08-11 10:40:05.708 985-1010/? E/ActivityManager: checkUser: 
    useridlist=null, 
    currentuser=0
   08-11 10:40:05.708 985-1010/? E/ActivityManager: checkUser: 
    useridlist=null, 
  currentuser=0
  08-11 10:40:05.708 985-1010/? E/ActivityManager: checkUser: 
   useridlist=null, 
 currentuser=0
  08-11 10:40:05.718 29588-29588/? E/Zygote: v2
 08-11 10:40:05.728 29588-29588/? E/SELinux: [DEBUG] get_category: variable 
seinfo: platform sensitivity: NULL, cateogry: NULL
08-11 10:40:05.908 23873-23873/raza1001.com.indianrailwayinfosys 
    W/InputMethodManager: IME died: 
  com.sec.android.inputmethod/.SamsungKeypad     


  android.os.DeadObjectException

at android.os.BinderProxy.transactNative(Native Method)

at android.os.BinderProxy.transact(Binder.java:496)

at 
  com.android.internal.view.IInputMethodSession$Stub$Proxy.viewClicked
 (IInputMethodSession.java:232)

at 

  android.view.inputmethod.InputMethodManager.viewClicked
  (InputMethodManager.java:1543)

at android.widget.TextView.viewClicked(TextView.java:9740)

at android.widget.TextView.onTouchEvent(TextView.java:8436)

at android.view.View.dispatchTouchEvent(View.java:8717)



 at 
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2583)
                  at  




   android.view.ViewRootImpl$ViewPostImeInputStage.onProcess 
  (ViewRootImpl.java:396                                                                                  
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3523)

at 
android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3576)

at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3542)

 at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImp