mardi 12 janvier 2016

Error handling in search SQLite Android

I have an app that has a search of student. I created an error handling since the app forces close when i input a location that is not available in the data but when i try to create an error handling, still not displaying although I enter a correct location in edittext. I dont know what's wrong in my code.

    class HomeSearch extends AsyncTask<Void, Void, Void> {
                ProgressDialog Asycdialog = new ProgressDialog(Home.this);

                @Override
                protected void onPreExecute(){
                    Asycdialog.setMessage("Loading...");
                    Asycdialog.setCancelable(false);
                    Asycdialog.show();
                    location = studentLocationEditText.getText().toString();

                }

                @Override
                protected Void doInBackground(Void... arg0) {
                    GetSearchHome = dbhelper.getHomeSearch(location);
                    return null;
                }

                @Override
                protected void onPostExecute(Void result) {

                    if (GetSearchHome != null) {
                        Asycdialog.dismiss();
                        Toast.makeText(context, "NO RESULT!", Toast.LENGTH_LONG).show();

                    }
                    else {
    //display the list if available
.
.
.
.
.
.
.
.
.
.
    }

Aucun commentaire:

Enregistrer un commentaire