App reagiert nicht --> Logcat

  • 5 Antworten
  • Letztes Antwortdatum
D

DenizD

Neues Mitglied
0
Hallo liebe Community,

ich habe folgendes Problem. Ich habe meine APP endlich fertiggestellt, wenn ich jedoch auf meine Smartphone testen möchte, dann startet die App. .Wenn ich dann in die Suchleiste etwas eingeben will kommt die Meldung "meineapp reagiert nicht".

Im Logcat steht folgendes:

04-18 18:58:35.524 28741-28741/com.as400samplecode E/Trace error opening trace file: No such file or directory (2)
04-18 18:58:35.844 28741-28741/com.as400samplecode W/CustomersDbAdapter 10
04-18 18:58:36.494 28741-28741/com.as400samplecode D/libEGL loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_121.so
04-18 18:58:36.504 28741-28741/com.as400samplecode D/libEGL loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_121.so
04-18 18:58:36.514 28741-28741/com.as400samplecode D/libEGL loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_121.so
04-18 18:58:36.594 28741-28741/com.as400samplecode W/IMGSRV :0: gralloc_register_buffer: ID: 10251 handle: 0x530c8470 size: 540 x 888 fmt: 5 usage: 0xb00
04-18 18:58:36.594 28741-28741/com.as400samplecode D/OpenGLRenderer Enabling debug mode 0
04-18 18:58:36.664 28741-28741/com.as400samplecode W/IMGSRV :0: gralloc_register_buffer: ID: 10252 handle: 0x54ac5300 size: 540 x 888 fmt: 5 usage: 0xb00
04-18 18:58:36.724 28741-28741/com.as400samplecode W/IMGSRV :0: gralloc_register_buffer: ID: 10253 handle: 0x54afcba0 size: 540 x 888 fmt: 5 usage: 0xb00
04-18 18:58:36.724 28741-28741/com.as400samplecode W/InputMethodManager Ignoring onBind: cur seq=2578, given seq=2577
04-18 18:58:36.724 28741-28741/com.as400samplecode W/IInputConnectionWrapper clearMetaKeyStates on inactive InputConnection
04-18 18:58:42.154 28741-28741/com.as400samplecode W/CustomersDbAdapter p*
04-18 18:58:42.154 28741-28741/com.as400samplecode W/CustomersDbAdapter SELECT docid as _id,customer,name,(address1||(case when address2> '' then '
' || address2 else '' end)) as address,address1,address2,city,state,zipCode from CustomerInfo where searchData MATCH 'p*';
04-18 18:58:42.184 28741-28741/com.as400samplecode D/AndroidRuntime Shutting down VM
04-18 18:58:42.184 28741-28741/com.as400samplecode W/dalvikvm threadid=1: thread exiting with uncaught exception (group=0x41ff27d0)
04-18 18:58:42.254 28741-28741/com.as400samplecode E/AndroidRuntime FATAL EXCEPTION: main
java.lang.NullPointerException
at org.intracode.shisharadar.SearchViewActivity.showResults(SearchViewActivity.java:122)
at org.intracode.shisharadar.SearchViewActivity.onQueryTextChange(SearchViewActivity.java:82)
at android.widget.SearchView.onTextChanged(SearchView.java:1154)
at android.widget.SearchView.access$2000(SearchView.java:92)
at android.widget.SearchView$11.onTextChanged(SearchView.java:1623)
at android.widget.TextView.sendOnTextChanged(TextView.java:7124)
at android.widget.TextView.handleTextChanged(TextView.java:7183)
at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:8777)
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.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:676)
at android.view.inputmethod.BaseInputConnection.commitText(BaseInputConnection.java:196)
at com.android.internal.widget.EditableInputConnection.commitText(EditableInputConnection.java:190)
at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:279)
at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:77)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5031)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
at dalvik.system.NativeStart.main(Native Method)
04-18 18:58:43.854 28741-28741/com.as400samplecode I/Process Sending signal. PID: 28741 SIG: 9


Ich benötige ganz dringend eure Hilfe und bedanke mich für Eure Mühen im Voraus.

Mit freundlichen Grüßen

Deniz
 
at org.intracode.shisharadar.SearchViewActivity.showResults(SearchViewActivity.java:122)
at org.intracode.shisharadar.SearchViewActivity.onQueryTextChange(SearchViewActivity.java:82)

irgendwas in der Methode showResults ist null. Am besten zeigst du mal die Methode. (Der Fehler-Ursprung könnte auch in onQueryTextChange liegen)
 
Deine Datenbank liefert auf deine Anfrage ein Nullobjekt zurück. Du versuchst dieses im TextView anzuzeigen. Das geht nicht. Weshalb die Methode showResults() ein Exception wirft, dass nicht aufgefangen wird. Überprüfe mal die Formulierung deiner Query.
 
Zoopa schrieb:
irgendwas in der Methode showResults ist null. Am besten zeigst du mal die Methode. (Der Fehler-Ursprung könnte auch in onQueryTextChange liegen)

Ich hoffe, dass das hier ausreichend ist?:

private void showResults(String query) {

Cursor cursor = mDbHelper.searchCustomer((query != null ? query.toString() : "@@@@"));

if (cursor == null) {
//
} else {
// Specify the columns we want to display in the result
String[] from = new String[] {
CustomersDbAdapter.KEY_CUSTOMER,
CustomersDbAdapter.KEY_NAME,
CustomersDbAdapter.KEY_ADDRESS,
CustomersDbAdapter.KEY_CITY,
CustomersDbAdapter.KEY_STATE,
CustomersDbAdapter.KEY_ZIP};

// Specify the Corresponding layout elements where we want the columns to go
int[] to = new int[] { R.id.scustomer,
R.id.sname,
R.id.saddress,
R.id.scity,
R.id.sstate,
R.id.szipCode};

// Create a simple cursor adapter for the definitions and apply them to the ListView
SimpleCursorAdapter customers = new SimpleCursorAdapter(this,R.layout.customerresult, cursor, from, to);
mListView.setAdapter(customers);

// Define the on-click listener for the list items
mListView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// Get the cursor, positioned to the corresponding row in the result set
Cursor cursor = (Cursor) mListView.getItemAtPosition(position);

// Get the state's capital from this row in the database.
String customer = cursor.getString(cursor.getColumnIndexOrThrow("customer"));
String name = cursor.getString(cursor.getColumnIndexOrThrow("name"));
String address = cursor.getString(cursor.getColumnIndexOrThrow("address"));
String city = cursor.getString(cursor.getColumnIndexOrThrow("city"));
String state = cursor.getString(cursor.getColumnIndexOrThrow("state"));
String zipCode = cursor.getString(cursor.getColumnIndexOrThrow("zipCode"));

//Check if the Layout already exists
LinearLayout customerLayout = (LinearLayout)findViewById(R.id.customerLayout);
if(customerLayout == null){
//Inflate the Customer Information View
LinearLayout leftLayout = (LinearLayout)findViewById(R.id.rightLayout);
View customerInfo = getLayoutInflater().inflate(R.layout.customerinfo, leftLayout, false);
leftLayout.addView(customerInfo);
}

//Get References to the TextViews
customerText = (TextView) findViewById(R.id.customer);
nameText = (TextView) findViewById(R.id.name);
addressText = (TextView) findViewById(R.id.address);
cityText = (TextView) findViewById(R.id.city);
stateText = (TextView) findViewById(R.id.state);
zipCodeText = (TextView) findViewById(R.id.zipCode);

// Update the parent class's TextView
customerText.setText(customer);
nameText.setText(name);
addressText.setText(address);
cityText.setText(city);
stateText.setText(state);
zipCodeText.setText(zipCode);

searchView.setQuery("",true);
}
});
}
}


Nochmals herzlichen Dank!


mfg Deniz
 
Danke für den Code. Hast du das Feld mListView vorher instanziiert? Sonst würde mListView.setAdapter(customers) ein NullpointerException werfen.

Und sonst schicke die ganze Klasse.
 
Und vorallem sag uns was in Zeile 122 steht.
Denn da tritt der Fehler auf, deshalb ist das eigentlich die einzig interessante erstmal.
 

Ähnliche Themen

G
Antworten
0
Aufrufe
100
Gerdchen07
G
G
Antworten
1
Aufrufe
363
Gerdchen07
G
G
Antworten
13
Aufrufe
573
Gerdchen07
G
L
Antworten
2
Aufrufe
460
Lexub
L
migi01
Antworten
26
Aufrufe
1.907
migi01
migi01
Zurück
Oben Unten