Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

´«ÖDz¥¿Íjavaѧϰ 3gÊÖ»ú¿ª·¢Android 3

½ñÌìÊÇѧϰ
Android
µÄµÚÈýÌ죬½ñÌìÖ÷ҪѧÁË
Android
ÄÚÖõÄ
SQLite
Êý¾Ý¿â£¬Ñ§Ï°ÁËÔöɾ¸Ä²é¡£
 
      
SharedPreferences
½øÐÐÊý¾Ý´æ´¢
:
      
Android
ƽ̨¸øÎÒÃÇÌṩÁËÒ»¸ö
SharedPreferences
À࣬ËüÊÇÒ»¸öÇáÁ¿¼¶µÄ´æ´¢À࣬ÌرðÊʺÏÓÃÓÚ±£´æÈí¼þÅäÖòÎÊý¡£Ê¹ÓÃ
SharedPreferences
±£´æÊý¾Ý£¬Æä±³ºóÊÇÓÃ
xml
Îļþ´æ·ÅÊý¾Ý£¬Îļþ´æ·ÅÔÚ
/data/data/<package
name>/shared_prefs
Ŀ¼Ï£º
SharedPreferences
±³ºóÊÇʹÓÃ
xml
Îļþ±£´æÊý¾Ý£¬
getSharedPreferences(name,mode)
·½·¨µÄµÚÒ»¸ö²ÎÊýÓÃÓÚÖ¸¶¨¸ÃÎļþµÄÃû³Æ£¬Ãû³Æ²»Óôøºó׺£¬ºó׺»áÓÉ
Android
×Ô¶¯¼ÓÉÏ¡£
 
      
ʹÓÃ
SQLite
Êý¾Ý¿â´æ´¢Êý¾Ý£º
      
SQLite
£¬
SQLite3
Ö§³Ö
NULL
¡¢
INTEGER
¡¢
REAL
£¨¸¡µãÊý×Ö£©¡¢
TEXT(
×Ö·û´®Îı¾
)
ºÍ
BLOB(
¶þ½øÖƶÔÏó
)
Êý¾ÝÀàÐÍ£¬ËäÈ»ËüÖ§³ÖµÄÀàÐÍÖ»ÓÐÎåÖÖ£¬µ«Êµ¼ÊÉÏ
sqlite3
Ò²½ÓÊÜ
varchar(n)
¡¢
char(n)
¡¢
decimal(p,s)
µÈÊý¾ÝÀàÐÍ£¬Ö»²»¹ýÔÚÔËËã»ò±£´æʱ»áת³É¶ÔÓ¦µÄÎåÖÖÊý¾ÝÀàÐÍ¡£
SQLite
×î´óµÄÌصãÊÇÄã¿ÉÒÔ±£´æÈκÎÀàÐ͵ÄÊý¾Ýµ½ÈκÎ×Ö¶ÎÖУ¬ÎÞÂÛÕâÁÐÉùÃ÷µÄÊý¾ÝÀàÐÍÊÇʲô¡£ÀýÈ磺¿ÉÒÔÔÚ
Integer
ÀàÐ͵Ä×Ö¶ÎÖдæ·Å×Ö·û´®£¬»òÕßÔÚ²¼¶ûÐÍ×Ö¶ÎÖдæ·Å¸¡µãÊý£¬»òÕßÔÚ×Ö·ûÐÍ×Ö¶ÎÖдæ·ÅÈÕÆÚÐÍÖµ¡£
µ«ÓÐÒ»ÖÖÇé¿öÀýÍ⣺¶¨ÒåΪ
INTEGER PRIMARY KEY
µÄ×Ö¶ÎÖ»ÄÜ´æ´¢
64
λÕûÊý£¬
µ±ÏòÕâÖÖ×Ö¶ÎÖб£´æ³ýÕûÊýÒÔÍâµÄÊý¾Ýʱ£¬½«»á²úÉú´íÎó¡£
 
      
SQLiteOpenHelper
¶ÔÊý¾Ý¿â½øÐа汾¹ÜÀí£º
      
ÎÒÃÇ¿ª·¢µÄÈí¼þ¿ÉÄܻᰲװÔڳɰÙÉÏǧ¸öÓû§µÄÊÖ»úÉÏ£¬Èç¹ûÓ¦ÓÃʹÓõ½ÁË
SQLite
Êý
¾Ý¿â£¬ÎÒÃDZØÐëÔÚÓû§³õ´ÎʹÓÃÈí¼þʱ´´½¨³öÓ¦ÓÃʹÓõ½µÄÊý¾Ý¿â±í½á¹¹¼°Ìí¼ÓһЩ³õʼ»¯¼Ç¼£¬ÁíÍâÔÚÈí¼þÉý¼¶µÄʱºò£¬Ò²ÐèÒª¶ÔÊý¾Ý±í½á¹¹½øÐиüС£ÄÇô£¬ÎÒ
ÃÇÈçºÎ²ÅÄÜʵÏÖÔÚÓû§³õ´ÎʹÓûòÉý¼¶Èí¼þʱ×Ô¶¯ÔÚÓû§µÄÊÖ»úÉÏ´´½¨³öÓ¦ÓÃÐèÒªµÄÊý¾Ý¿â±íÄØ£¿×ܲ»ÄÜÔÚÿ¸öÐèÒª°²×°´ËÈí¼þµÄÊÖ»úÉÏͨ¹ýÊÖ¹¤·½Ê½´´½¨Êý¾Ý¿â±í
°É£¿ÒòΪÕâÖÖÐèÇóÊÇÿ¸öÊý¾Ý¿âÓ¦Óö¼ÒªÃæÁٵģ¬ËùÒÔÔÚ
Android
ϵͳ£¬ÎªÎÒÃÇÌṩÁËÒ»¸öÃûΪ
SQLiteOpenHelper
µÄ³éÏóÀ࣬±ØÐë¼Ì³ÐËü²ÅÄÜʹÓã¬Ë


Ïà¹ØÎĵµ£º

Java °´×Ö½Ú½ØÈ¡´øÓкº×ÖµÄ×Ö·û´®µÄÒ»ÖÖ×ö·¨

Java °´×Ö½Ú½ØÈ¡´øÓкº×ÖµÄ×Ö·û´®µÄ½â·¨£¬ÍøÉÏÓв»ÉÙÌÖÂÛ¡£ÕâÀïÎÒÒ²¸ø³öÒ»ÖÖÎÒ×Ô¼ºµÄ´¦Àí£¬»ù±¾Ô­Àí»¹ÊÇͳ¼ÆÒª½ØÈ¡µÄ×Ö½ÚÊýÖÐÊDZíʾºº×ÖµÄ×Ö½ÚÊýÊÇ·ñÊÇżÊý¸ö£¬¼´ÊÇ·ñ¸ÕºÃ°üÀ¨ÁËÍêÕûµÄºº×Ö¡£
/**
 * ±à³Ì£º±àдһ¸ö½ØÈ¡×Ö·û´®µÄº¯Êý£¬ÊäÈëΪһ¸ö×Ö·û´®ºÍ×Ö½ÚÊý£¬Êä³öΪ°´×Ö½Ú½ØÈ¡µÄ×Ö·û´®¡£ µ«ÊÇÒª±£Ö¤ºº×Ö²»±»½Ø°ë¸ ......

JavaÖеġ°==¡±ºÍequal()

Integer n1 = new Integer(1);
Integer n2 = new Integer(1);
System.out.println(n1==n2); // false
Integer n1 = new Integer(3);
Integer n2 = new Integer(3);
System.out.println(n1.equals(n2)); //true

equals()ĬÈÏÒ²ÊDZȽÏreference£¬µ«ÊÇJavaÖеÄclass¸²¸ÇÁËequals()·½·¨ ......

java ɾ³ýList ÖеÄÖظ´Êý¾Ý

1. Ñ­»·listÖеÄËùÓÐÔªËØÈ»ºóɾ³ýÖظ´
public static List removeDuplicate(List list) {
for ( int i = 0 ; i < list.size() - 1 ; i ++ ) {
for ( int j = list.size() - 1 ; j > i; j -- ) {
if (list.get(j).equals(list.get(i))) {
......

´«ÖDz¥¿Íjavaѧϰ 3g¿ª·¢Android2

½ñÌìÊÇѧϰAndroid¿ª·¢µÄµÚ¶þÌ죺
      
½ñÌìÖ÷ҪѧϰÁËÎļþµÄ¶ÁÈ¡¡¢ÒÔ¼°¶ÔxmlÎļþµÄ½âÎö£º
ʹÓÃÎļþ½øÐÐÊý¾Ý´æ´¢£º
ActivityÌṩÁËopenFileOutput()·½·¨¿ÉÒÔÓÃÓÚ°ÑÊý¾ÝÊä³öµ½ÎļþÖУ¬¾ßÌåµÄʵÏÖ¹ý³ÌÓëÔÚJ2SE»·¾³Öб£´æÊý¾Ýµ½ÎļþÖÐÊÇÒ»ÑùµÄ¡£
public class FileActivity extends Acti ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ