رفتن به مطلب
انجمن اندروید ایران | آموزش برنامه نویسی اندروید و موبایل
  • android.png.1fab383bc8500cd93127cebc65b1dcab.png

قرار دادن قابلیت search در برنامه


پست های پیشنهاد شده

سلام

من توی صفحه اول برنامه م چندتا فرگمنت دارم که کشورها و پرچم ها رو نشون میده می خوام قابلیت سرچ کردن اضافه کنم

توی تولبار با استفاده از منو یک تکست ویو اضافه کردم برای کلید سرچ

و در اکتیویتی اصلی داخل منو و داخل متد override شده ی onQueryTextChange یک متد فراخوانی کردم که زمانی که در ادیت تکست متنی وارد میشه یک کوئری می زنم

و اصل متد رو در فرگمنتم پیاده سازی کردم

 

اکتویتی اصلی:

 @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu_item, menu);

        final MenuItem searchItem = menu.findItem(R.id.action_search);
        final SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
        searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
            @Override
            public boolean onQueryTextSubmit(String query) {
                return false;
            }

            @Override
            public boolean onQueryTextChange(String newText) {

                //ArrayList<Structure> Liststructure_2= new ArrayList<>();

                Asia_Fragment asia=new Asia_Fragment();
                asia.getTextChanged(newText);
              
                return true;
            }
        });
        return true;
    }

فرگمنت آسیا:

 

 public void getTextChanged(String newText)
    {
        newText = newText.toLowerCase();
        Log.i("Log","text : "+newText);
        searchSelect(newText);
       // adapterCardView.notifyDataSetChanged();
    }
    public void searchSelect(String newText)
    {
       final Database database2 = new Database(getActivity());
       database2.CreateDatabase();
       database2.openDatabase();

       Cursor cursor = database2.QueryData("SELECT * FROM Country WHERE Country_Name LIKE '%" + newText + "%' ");
        //arrayList.clear();
        if (cursor != null) {
            if (cursor.moveToFirst())
            {
                do {
                    Structure structure = new Structure();
                    structure.setCountry_Name(cursor.getString(1));
                    structure.setCapital(cursor.getString(2));
                    structure.setGhareh(cursor.getString(3));
                    structure.setFlag(cursor.getString(4));
                    arrayList2.add(structure);

                }
                while (cursor.moveToNext());
            }
        }
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
        adapterCardView=new AdapterCardView(getActivity(),arrayList);

        recyclerView.setHasFixedSize(true);
        recyclerView.setLayoutManager(linearLayoutManager);
        recyclerView.setAdapter(adapterCardView);

    }

ولی وقتی به database2.CreateDatabase(); میرسه فورس کلوز میده

 

ممنون

لینک ارسال
به اشتراک گذاری در سایت های دیگر
در 5 ساعت قبل، scientific گفته است :

سلام

من توی صفحه اول برنامه م چندتا فرگمنت دارم که کشورها و پرچم ها رو نشون میده می خوام قابلیت سرچ کردن اضافه کنم

توی تولبار با استفاده از منو یک تکست ویو اضافه کردم برای کلید سرچ

و در اکتیویتی اصلی داخل منو و داخل متد override شده ی onQueryTextChange یک متد فراخوانی کردم که زمانی که در ادیت تکست متنی وارد میشه یک کوئری می زنم

و اصل متد رو در فرگمنتم پیاده سازی کردم

 

اکتویتی اصلی:


 @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu_item, menu);

        final MenuItem searchItem = menu.findItem(R.id.action_search);
        final SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
        searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
            @Override
            public boolean onQueryTextSubmit(String query) {
                return false;
            }

            @Override
            public boolean onQueryTextChange(String newText) {

                //ArrayList<Structure> Liststructure_2= new ArrayList<>();

                Asia_Fragment asia=new Asia_Fragment();
                asia.getTextChanged(newText);
              
                return true;
            }
        });
        return true;
    }

فرگمنت آسیا:

 


 public void getTextChanged(String newText)
    {
        newText = newText.toLowerCase();
        Log.i("Log","text : "+newText);
        searchSelect(newText);
       // adapterCardView.notifyDataSetChanged();
    }
    public void searchSelect(String newText)
    {
       final Database database2 = new Database(getActivity());
       database2.CreateDatabase();
       database2.openDatabase();

       Cursor cursor = database2.QueryData("SELECT * FROM Country WHERE Country_Name LIKE '%" + newText + "%' ");
        //arrayList.clear();
        if (cursor != null) {
            if (cursor.moveToFirst())
            {
                do {
                    Structure structure = new Structure();
                    structure.setCountry_Name(cursor.getString(1));
                    structure.setCapital(cursor.getString(2));
                    structure.setGhareh(cursor.getString(3));
                    structure.setFlag(cursor.getString(4));
                    arrayList2.add(structure);

                }
                while (cursor.moveToNext());
            }
        }
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
        adapterCardView=new AdapterCardView(getActivity(),arrayList);

        recyclerView.setHasFixedSize(true);
        recyclerView.setLayoutManager(linearLayoutManager);
        recyclerView.setAdapter(adapterCardView);

    }

ولی وقتی به database2.CreateDatabase(); میرسه فورس کلوز میده

 

ممنون

سلام روز بخیر اگه ممکنه خطایی که میده هم بزارین

لینک ارسال
به اشتراک گذاری در سایت های دیگر

سلام روز شمام به خیر

این تمام پیغام هایی که میده:


01/15 11:18:10: Launching app
No apk changes detected since last installation, skipping installation of D:\Workspace_Android\Android\CountriesAndContinentss\CountriesAndContinentss\app\build\outputs\apk\app-debug.apk
$ adb shell am force-stop com.narsis.countriesandcontinents
$ adb shell am start -n "com.narsis.countriesandcontinents/com.narsis.countriesandcontinents.mainPage.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 26421 on device MyNexus_5_API_19 [emulator-5554]
I/dalvikvm: Could not find method android.support.v7.widget.LinearLayoutCompat.drawableHotspotChanged, referenced from method android.support.design.internal.ForegroundLinearLayout.drawableHotspotChanged
W/dalvikvm: VFY: unable to resolve virtual method 17875: Landroid/support/v7/widget/LinearLayoutCompat;.drawableHotspotChanged (FF)V
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0000
D/dalvikvm: GC_FOR_ALLOC freed 332K, 5% free 7560K/7956K, paused 5ms, total 6ms
W/SQLiteConnectionPool: A SQLiteConnection object for database 'data/data/com.narsis.countriesandcontinents/databasesCuntriesInformation' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
W/SQLiteConnectionPool: A SQLiteConnection object for database 'data/data/com.narsis.countriesandcontinents/databasesCuntriesInformation' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
W/SQLiteConnectionPool: A SQLiteConnection object for database 'data/data/com.narsis.countriesandcontinents/databasesCuntriesInformation' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
W/SQLiteConnectionPool: A SQLiteConnection object for database 'data/data/com.narsis.countriesandcontinents/databasesCuntriesInformation' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
W/SQLiteConnectionPool: A SQLiteConnection object for database 'data/data/com.narsis.countriesandcontinents/databasesCuntriesInformation' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
I/Log: text : d
E/InputEventSender: Exception dispatching finished signal.
E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
E/MessageQueue-JNI: java.lang.NullPointerException
                        at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
                        at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:188)
                        at com.narsis.countriesandcontinents.Database.CreateDatabase(Database.java:51)
                        at com.narsis.countriesandcontinents.Asia_Fragment.searchSelect(Asia_Fragment.java:652)
                        at com.narsis.countriesandcontinents.Asia_Fragment.getTextChanged(Asia_Fragment.java:646)
                        at com.narsis.countriesandcontinents.mainPage.MainActivity$1.onQueryTextChange(MainActivity.java:173)
                        at android.support.v7.widget.SearchView.onTextChanged(SearchView.java:1237)
                        at android.support.v7.widget.SearchView$12.onTextChanged(SearchView.java:1767)
                        at android.widget.TextView.sendOnTextChanged(TextView.java:7408)
                        at android.widget.TextView.handleTextChanged(TextView.java:7467)
                        at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:9183)
                        at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:962)
                        at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:496)
                        at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:435)
                        at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30)
                        at android.text.method.QwertyKeyListener.onKeyDown(QwertyKeyListener.java:223)
                        at android.text.method.TextKeyListener.onKeyDown(TextKeyListener.java:136)
                        at android.widget.TextView.doKeyDown(TextView.java:5532)
                        at android.widget.TextView.onKeyDown(TextView.java:5343)
                        at android.widget.AutoCompleteTextView.onKeyDown(AutoCompleteTextView.java:716)
                        at android.view.KeyEvent.dispatch(KeyEvent.java:2640)
                        at android.view.View.dispatchKeyEvent(View.java:7665)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:2035)
                        at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1505)
                        at android.app.Activity.dispatchKeyEvent(Activity.java:2418)
                        at android.support.v7.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:547)
                        at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:57)
                        at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:315)
                        at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:57)
                        at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1962)
                        at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:3852)
                        at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3826)
                        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3399)
                        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3449)
                        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3418)
                        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3525)
                        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3426)
                    	at android.vi
D/AndroidRuntime: Shutting down VM
W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xb0ceab20)
E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.narsis.countriesandcontinents, PID: 26421
                  java.lang.NullPointerException
                      at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
                      at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:188)
                      at com.narsis.countriesandcontinents.Database.CreateDatabase(Database.java:51)
                      at com.narsis.countriesandcontinents.Asia_Fragment.searchSelect(Asia_Fragment.java:652)
                      at com.narsis.countriesandcontinents.Asia_Fragment.getTextChanged(Asia_Fragment.java:646)
                      at com.narsis.countriesandcontinents.mainPage.MainActivity$1.onQueryTextChange(MainActivity.java:173)
                      at android.support.v7.widget.SearchView.onTextChanged(SearchView.java:1237)
                      at android.support.v7.widget.SearchView$12.onTextChanged(SearchView.java:1767)
                      at android.widget.TextView.sendOnTextChanged(TextView.java:7408)
                      at android.widget.TextView.handleTextChanged(TextView.java:7467)
                      at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:9183)
                      at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:962)
                      at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:496)
                      at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:435)
                      at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30)
                      at android.text.method.QwertyKeyListener.onKeyDown(QwertyKeyListener.java:223)
                      at android.text.method.TextKeyListener.onKeyDown(TextKeyListener.java:136)
                      at android.widget.TextView.doKeyDown(TextView.java:5532)
                      at android.widget.TextView.onKeyDown(TextView.java:5343)
                      at android.widget.AutoCompleteTextView.onKeyDown(AutoCompleteTextView.java:716)
                      at android.view.KeyEvent.dispatch(KeyEvent.java:2640)
                      at android.view.View.dispatchKeyEvent(View.java:7665)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:2035)
                      at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1505)
                      at android.app.Activity.dispatchKeyEvent(Activity.java:2418)
                      at android.support.v7.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:547)
                      at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:57)
                      at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:315)
                      at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:57)
                      at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1962)
                      at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:3852)
                      at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3826)
                      at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3399)
                      at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3449)
                      at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3418)
                      at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3525)
                  	at androi
I/Process: Sending signal. PID: 26421 SIG: 9
Application terminated.

 

لینک ارسال
به اشتراک گذاری در سایت های دیگر
در 2 ساعت قبل، scientific گفته است :

سلام روز شمام به خیر

این تمام پیغام هایی که میده:



01/15 11:18:10: Launching app
No apk changes detected since last installation, skipping installation of D:\Workspace_Android\Android\CountriesAndContinentss\CountriesAndContinentss\app\build\outputs\apk\app-debug.apk
$ adb shell am force-stop com.narsis.countriesandcontinents
$ adb shell am start -n "com.narsis.countriesandcontinents/com.narsis.countriesandcontinents.mainPage.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 26421 on device MyNexus_5_API_19 [emulator-5554]
I/dalvikvm: Could not find method android.support.v7.widget.LinearLayoutCompat.drawableHotspotChanged, referenced from method android.support.design.internal.ForegroundLinearLayout.drawableHotspotChanged
W/dalvikvm: VFY: unable to resolve virtual method 17875: Landroid/support/v7/widget/LinearLayoutCompat;.drawableHotspotChanged (FF)V
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0000
D/dalvikvm: GC_FOR_ALLOC freed 332K, 5% free 7560K/7956K, paused 5ms, total 6ms
W/SQLiteConnectionPool: A SQLiteConnection object for database 'data/data/com.narsis.countriesandcontinents/databasesCuntriesInformation' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
W/SQLiteConnectionPool: A SQLiteConnection object for database 'data/data/com.narsis.countriesandcontinents/databasesCuntriesInformation' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
W/SQLiteConnectionPool: A SQLiteConnection object for database 'data/data/com.narsis.countriesandcontinents/databasesCuntriesInformation' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
W/SQLiteConnectionPool: A SQLiteConnection object for database 'data/data/com.narsis.countriesandcontinents/databasesCuntriesInformation' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
W/SQLiteConnectionPool: A SQLiteConnection object for database 'data/data/com.narsis.countriesandcontinents/databasesCuntriesInformation' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
I/Log: text : d
E/InputEventSender: Exception dispatching finished signal.
E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
E/MessageQueue-JNI: java.lang.NullPointerException
                        at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
                        at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:188)
                        at com.narsis.countriesandcontinents.Database.CreateDatabase(Database.java:51)
                        at com.narsis.countriesandcontinents.Asia_Fragment.searchSelect(Asia_Fragment.java:652)
                        at com.narsis.countriesandcontinents.Asia_Fragment.getTextChanged(Asia_Fragment.java:646)
                        at com.narsis.countriesandcontinents.mainPage.MainActivity$1.onQueryTextChange(MainActivity.java:173)
                        at android.support.v7.widget.SearchView.onTextChanged(SearchView.java:1237)
                        at android.support.v7.widget.SearchView$12.onTextChanged(SearchView.java:1767)
                        at android.widget.TextView.sendOnTextChanged(TextView.java:7408)
                        at android.widget.TextView.handleTextChanged(TextView.java:7467)
                        at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:9183)
                        at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:962)
                        at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:496)
                        at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:435)
                        at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30)
                        at android.text.method.QwertyKeyListener.onKeyDown(QwertyKeyListener.java:223)
                        at android.text.method.TextKeyListener.onKeyDown(TextKeyListener.java:136)
                        at android.widget.TextView.doKeyDown(TextView.java:5532)
                        at android.widget.TextView.onKeyDown(TextView.java:5343)
                        at android.widget.AutoCompleteTextView.onKeyDown(AutoCompleteTextView.java:716)
                        at android.view.KeyEvent.dispatch(KeyEvent.java:2640)
                        at android.view.View.dispatchKeyEvent(View.java:7665)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                        at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:2035)
                        at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1505)
                        at android.app.Activity.dispatchKeyEvent(Activity.java:2418)
                        at android.support.v7.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:547)
                        at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:57)
                        at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:315)
                        at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:57)
                        at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1962)
                        at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:3852)
                        at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3826)
                        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3399)
                        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3449)
                        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3418)
                        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3525)
                        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3426)
                    	at android.vi
D/AndroidRuntime: Shutting down VM
W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xb0ceab20)
E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.narsis.countriesandcontinents, PID: 26421
                  java.lang.NullPointerException
                      at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
                      at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:188)
                      at com.narsis.countriesandcontinents.Database.CreateDatabase(Database.java:51)
                      at com.narsis.countriesandcontinents.Asia_Fragment.searchSelect(Asia_Fragment.java:652)
                      at com.narsis.countriesandcontinents.Asia_Fragment.getTextChanged(Asia_Fragment.java:646)
                      at com.narsis.countriesandcontinents.mainPage.MainActivity$1.onQueryTextChange(MainActivity.java:173)
                      at android.support.v7.widget.SearchView.onTextChanged(SearchView.java:1237)
                      at android.support.v7.widget.SearchView$12.onTextChanged(SearchView.java:1767)
                      at android.widget.TextView.sendOnTextChanged(TextView.java:7408)
                      at android.widget.TextView.handleTextChanged(TextView.java:7467)
                      at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:9183)
                      at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:962)
                      at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:496)
                      at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:435)
                      at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30)
                      at android.text.method.QwertyKeyListener.onKeyDown(QwertyKeyListener.java:223)
                      at android.text.method.TextKeyListener.onKeyDown(TextKeyListener.java:136)
                      at android.widget.TextView.doKeyDown(TextView.java:5532)
                      at android.widget.TextView.onKeyDown(TextView.java:5343)
                      at android.widget.AutoCompleteTextView.onKeyDown(AutoCompleteTextView.java:716)
                      at android.view.KeyEvent.dispatch(KeyEvent.java:2640)
                      at android.view.View.dispatchKeyEvent(View.java:7665)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1408)
                      at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:2035)
                      at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1505)
                      at android.app.Activity.dispatchKeyEvent(Activity.java:2418)
                      at android.support.v7.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:547)
                      at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:57)
                      at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:315)
                      at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:57)
                      at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1962)
                      at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:3852)
                      at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3826)
                      at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3399)
                      at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3449)
                      at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3418)
                      at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3525)
                  	at androi
I/Process: Sending signal. PID: 26421 SIG: 9
Application terminated.

 

خطای

NullPointerException

برگشت داده میشود پس نتیجه این میباشد که کدی که دارید اجرا میکنید خالی میباشد.

تیکه کد اصلی خودتون رو بزارید که خطا روی آن اتفاق میشود

 

 

 

 

 

لینک ارسال
به اشتراک گذاری در سایت های دیگر

به گفتگو بپیوندید

هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .

مهمان
ارسال پاسخ به این موضوع...

×   شما در حال چسباندن محتوایی با قالب بندی هستید.   حذف قالب بندی

  تنها استفاده از 75 اموجی مجاز می باشد.

×   لینک شما به صورت اتوماتیک جای گذاری شد.   نمایش به صورت لینک

×   محتوای قبلی شما بازگردانی شد.   پاک کردن محتوای ویرایشگر

×   شما مستقیما نمی توانید تصویر خود را قرار دهید. یا آن را اینجا بارگذاری کنید یا از یک URL قرار دهید.

×
×
  • اضافه کردن...