עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

בעיה בעיה בעיה.... (מסד נתונים וSQL באנדרואיד)

Featured Replies

פורסם

היי, ניסיתי ליצור חיבור למסד נתונים עם שאילתות SQL על מנת להציג את כל תוכנו (טבלה 1) לתוך TextView אחד.

עשיתי שיטה כזו:


public String Blip(){
String result = "";


String[] colums = new String[]{KEY_ID,KEY_CONTENT,KEY_HOTNESS};
Cursor c = sqLiteDatabase.query(MYDATABASE_TABLE, colums, null, null, null, null, null);



int iRow = c.getColumnIndex(KEY_ID);
int iName = c.getColumnIndex(KEY_CONTENT);
int iHotness = c.getColumnIndex(KEY_HOTNESS);

for(c.moveToFirst(); !c.isAfterLast(); c.moveToNext()){
result = result + c.getString(iRow) + " " + c.getString(iName) + " " + c.getString(iHotness) + "\n";
}

return result;
}

שמחזירה מחרוזת לכאן:


mySQLiteAdapter = new SQLiteAdapter(this);
mySQLiteAdapter.openToRead();
tvContent.setText(mySQLiteAdapter.Blip());
mySQLiteAdapter.close();

האפליקציה לא עולה כשאני עושה את זה (כלומר מנסה להציג נתונים מטבלה).

**בכוונה לא הדבקתי כאן את כל הקוד כי הוא קצת עמוס ומסורבל, אז בתור התחלה- איפה טעיתי?

תודה,

שחר.

פורסם

איזה הודעת שגיאה אתה מקבל?

פורסם
  • מחבר

איזה הודעת שגיאה אתה מקבל?

באמולטור זה מציג לי "Unfortunatly, sqlDatabase has stoped"

ובConsole:


[2012-09-14 11:09:28 - Unexpected error while launching logcat. Try reselecting the device.] device not found
com.android.ddmlib.AdbCommandRejectedException: device not found
at com.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:752)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:373)
at com.android.ddmlib.Device.executeShellCommand(Device.java:462)
at com.android.ddmuilib.logcat.LogCatReceiver$1.run(LogCatReceiver.java:109)
at java.lang.Thread.run(Unknown Source)

כמו כן, למה משמש ה LogCat?

תודה.

  • 4 שבועות מאוחר יותר...
פורסם

יש מדריך מעולה באתר (ובספר) של For Dummies.

http://www.dummies.com

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.