This is what my LogCat shows.
01-03 05:34:09.198: E/StrictMode(1469): A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
01-03 05:34:09.198: E/StrictMode(1469): java.lang.Throwable: Explicit termination method 'close' not called
01-03 05:34:09.198: E/StrictMode(1469): at dalvik.system.CloseGuard.open(CloseGuard.java:184)
01-03 05:34:09.198: E/StrictMode(1469): at android.database.CursorWindow.<init>(CursorWindow.java:107)
01-03 05:34:09.198: E/StrictMode(1469): at android.database.CursorWindow.<init>(CursorWindow.java:126)
01-03 05:34:09.198: E/StrictMode(1469): at com.google.android.gms.common.data.DataHolder.a(SourceFile:376)
01-03 05:34:09.198: E/StrictMode(1469): at com.google.android.gms.common.data.DataHolder.<init>(SourceFile:194)
01-03 05:34:09.198: E/StrictMode(1469): at com.google.android.gms.common.data.DataHolder.<init>(SourceFile:38)
01-03 05:34:09.198: E/StrictMode(1469): at com.google.android.gms.common.data.j.a(SourceFile:1102)
01-03 05:34:09.198: E/StrictMode(1469): at com.google.android.gms.config.ConfigService.b(SourceFile:1219)
01-03 05:34:09.198: E/StrictMode(1469): at com.google.android.gms.config.k.a(SourceFile:1671)
01-03 05:34:09.198: E/StrictMode(1469): at com.google.android.gms.config.k.a(SourceFile:1602)
01-03 05:34:09.198: E/StrictMode(1469): at com.google.android.gms.config.internal.u.onTransact(SourceFile:59)
01-03 05:34:09.198: E/StrictMode(1469): at android.os.Binder.execTransact(Binder.java:404)
01-03 05:34:09.198: E/StrictMode(1469): at dalvik.system.NativeStart.run(Native Method)
01-03 05:34:09.208: E/DataBuffer(1469): Internal data leak within a DataBuffer object detected! Be sure to explicitly call release() on all DataBuffer extending objects when you are done with them. (internal object: com.google.android.gms.common.data.DataHolder@b30f29b8)
01-03 05:34:09.208: E/DataBuffer(1469): Internal data leak within a DataBuffer object detected! Be sure to explicitly call release() on all DataBuffer extending objects when you are done with them. (internal object: com.google.android.gms.common.data.DataHolder@b316a2d8)
This is my Activity Auto.java
public class Auto extends ListActivity {
private static final String TABLE_NAME = "auto";
private static final String FIELD_ID = "SNo";
private static final String FIELD_NAME = "Name";
private static final String FIELD_NUM = "Number";
SqlHandler sqlHandler;
private ListView listView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_auto);
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
sqlHandler = new SqlHandler(this);
showlist();
}
private void showlist() {
ArrayList<listRowAuto> contactList = new ArrayList<listRowAuto>();
contactList.clear();
String query = "SELECT Name,Number FROM auto ";
Cursor c1 = sqlHandler.selectQuery(query);
if (c1 != null && c1.getCount() != 0) {
if (c1.moveToFirst()) {
do {
listRowAuto contactListItems = new listRowAuto();
contactListItems.setName(c1.getString(c1
.getColumnIndex("name")));
contactListItems.setPhone(c1.getString(c1
.getColumnIndex("phone")));
contactList.add(contactListItems);
} while (c1.moveToNext());
}
}
c1.close();
listAdapterAuto contactListAdapter = new listAdapterAuto(
Auto.this, contactList);
listView.setAdapter(contactListAdapter);
}
I want to load the fields to two texboxes name and phone. I am using cursor adapter.I am doing like the http://ift.tt/1Ripsf7.
Aucun commentaire:
Enregistrer un commentaire