´«ÖDz¥¿Íjavaѧϰ 3g¿ª·¢Android2
½ñÌìÊÇѧϰAndroid¿ª·¢µÄµÚ¶þÌ죺
½ñÌìÖ÷ҪѧϰÁËÎļþµÄ¶ÁÈ¡¡¢ÒÔ¼°¶ÔxmlÎļþµÄ½âÎö£º
ʹÓÃÎļþ½øÐÐÊý¾Ý´æ´¢£º
ActivityÌṩÁËopenFileOutput()·½·¨¿ÉÒÔÓÃÓÚ°ÑÊý¾ÝÊä³öµ½ÎļþÖУ¬¾ßÌåµÄʵÏÖ¹ý³ÌÓëÔÚJ2SE»·¾³Öб£´æÊý¾Ýµ½ÎļþÖÐÊÇÒ»ÑùµÄ¡£
public class FileActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
...
FileOutputStream outStream = this.openFileOutput("itcast.txt",
Context.MODE_PRIVATE);
outStream.write("´«ÖDz¥¿Í".getBytes());
outStream.close();
}
}
openFileOutput()·½·¨µÄµÚÒ»²ÎÊýÓÃÓÚÖ¸¶¨ÎļþÃû³Æ£¬²»ÄÜ°üº¬Â·¾¶·Ö¸ô·û“/” £¬Èç¹ûÎļþ²»´æÔÚ£¬Android
»á×Ô¶¯´´½¨Ëü¡£´´½¨µÄÎļþ±£´æÔÚ/data/data/<package
name>/filesĿ¼£¬È磺
/data/data/cn.itcast.action/files/itcast.txt
£¬Í¨¹ýµã»÷Eclipse²Ëµ¥“Window”-“Show
View”-“Other”£¬ÔÚ¶Ô»°´°¿ÚÖÐÕ¹¿ªandroidÎļþ¼Ð£¬Ñ¡ÔñÏÂÃæµÄFile ExplorerÊÓͼ£¬È»ºóÔÚFile
ExplorerÊÓͼÖÐÕ¹¿ª/data/data/<package
name>/filesĿ¼¾Í¿ÉÒÔ¿´µ½¸ÃÎļþ¡£
openFileOutput()·½·¨µÄµÚ¶þ²ÎÊýÓÃÓÚÖ¸¶¨²Ù×÷ģʽ£¬ÓÐËÄÖÖģʽ£¬·Ö±ðΪ£º
Context.MODE_PRIVATE
= 0
Context.MODE_APPEND
= 32768
Context.MODE_WORLD_READABLE = 1
Context.MODE_WORLD_WRITEABLE = 2
Context.MODE_PRIVATE
£º
ΪĬÈϲÙ×÷ģʽ£¬´ú±í¸ÃÎļþÊÇ˽ÓÐÊý¾Ý£¬Ö»Äܱ»Ó¦Óñ¾Éí·ÃÎÊ£¬ÔÚ¸ÃģʽÏ£¬Ð´ÈëµÄÄÚÈݻḲ¸ÇÔÎļþµÄÄÚÈÝ£¬Èç¹ûÏë°ÑÐÂдÈëµÄÄÚÈÝ×·¼Óµ½ÔÎļþÖС£¿ÉÒÔʹÓÃContext.MODE_APPEND
Context.MODE_APPEND
£º
ģʽ»á¼ì²éÎļþÊÇ·ñ´æÔÚ£¬´æÔÚ¾ÍÍùÎļþ×·¼ÓÄÚÈÝ£¬·ñÔò¾Í´´½¨ÐÂÎļþ¡£
Context.MODE_WORLD_READABLEºÍContext.MODE_WORLD_WRITEABLEÓÃÀ´¿ØÖÆÆäËûÓ¦ÓÃÊÇ·ñÓÐȨÏÞ¶Áд¸ÃÎļþ¡£
MODE_WORLD_READABLE
£º±íʾµ±Ç°Îļþ¿ÉÒÔ±»ÆäËûÓ¦ÓöÁÈ¡£»MODE_WORLD_WRITEABLE
£º±íʾµ±Ç°Îļþ¿ÉÒÔ±»Æ
Ïà¹ØÎĵµ£º
Ö»Õë¶Ô²»Õý³£µÄÌõ¼þ²ÅʹÓÃÒì³£
Òì³£Ö»Ó¦¸Ã±»ÓÃÓÚ²»Õý³£µÄÌõ¼þ£¬ËüÃÇÓÀÔ¶²»Ó¦±»ÓÃÓÚÕý³£µÄ¿ØÖÆÁ÷¡£
ÏÂÃæÊÇÒ»¸öÓÃÒì³£×÷±éÀú½áÊøÌõ¼þµÄÀÄÓÃÒì³£µÄÀý×Ó£º
//horrible abuse of exceptions. Don't ever do this!
try{
int i=0;
while(true)a[i++].f();
}catch(ArrayIndexOutOfBoundsException e){
......
Java °´×Ö½Ú½ØÈ¡´øÓкº×ÖµÄ×Ö·û´®µÄ½â·¨£¬ÍøÉÏÓв»ÉÙÌÖÂÛ¡£ÕâÀïÎÒÒ²¸ø³öÒ»ÖÖÎÒ×Ô¼ºµÄ´¦Àí£¬»ù±¾ÔÀí»¹ÊÇͳ¼ÆÒª½ØÈ¡µÄ×Ö½ÚÊýÖÐÊDZíʾºº×ÖµÄ×Ö½ÚÊýÊÇ·ñÊÇżÊý¸ö£¬¼´ÊÇ·ñ¸ÕºÃ°üÀ¨ÁËÍêÕûµÄºº×Ö¡£
/**
* ±à³Ì£º±àдһ¸ö½ØÈ¡×Ö·û´®µÄº¯Êý£¬ÊäÈëΪһ¸ö×Ö·û´®ºÍ×Ö½ÚÊý£¬Êä³öΪ°´×Ö½Ú½ØÈ¡µÄ×Ö·û´®¡£ µ«ÊÇÒª±£Ö¤ºº×Ö²»±»½Ø°ë¸ ......
Long long ago in a galaxy far,far away......
HakunaMatata
Ö÷Ò³²©¿ÍÏà²á|¸öÈ˵µ°¸ |ºÃÓÑ
²é¿´ÎÄÕÂ
ΪʲôҪÉèÖÃJAVA_HOME&Path&CLASSPATH&CATALINA_HOME
2008-01-19 14:26
Ê×ÏȵýéÉÜÏÂÃ漸¸ö²ÎÊýµÄ×÷Óãº
current directory(µ±Ç°Ä¿Â¼)£º
µ±Ç°ÔÚÓõÄĿ¼ ......
ÔÚËùÓÐ×é¼þ¶¼·Åµ½JFrameÖ®ºó£¬ÏÈsetSize()£¬È»ºóÔÙsetVisible() ¡£
ÉèÖÃÁË´°¿ÚµÄSize,²¼¾Ö¹ÜÀíÆ÷²ÅÄÜΪ¸÷¸ö×é¼þ°²ÅźÏÊʵÄλÖÃ,Ö®ºóÔÙ°Ñ´°ÌåÏÔʾ³öÀ´setVisible()£¬±ÈÈçÄ㻹²»ÖªµÀ³§·¿µÄ´óС£¬Õâʱ¾ÍÎÞ·¨¾ö¶¨É豸°²·ÅµÄλÖᣠ......
½ñÌ죬ÎÒÃÇ¿ªÊ¼ÁËÙ¡ÀÏʦµÄ½ÌÓý°ì¹«ÏµÍ³µÄÂọ́ºÎÒ×öÁ˼òµ¥µÄ±Ê¼Ç£º
1. ´î½¨ SSH »·¾³
1). ¼ÓÈë Struts:
¢Ù. ¼ÓÈë jar °ü:
struts-1.3.8\apps\struts-b ......