<有背景音樂,請打開喇叭,音樂檔很大,請耐心等候>
好久以前曾經寫過同事 Catherine 的婚禮紀錄,後來寫紀錄的網站關了,紀錄也就跟著消失了...嗚...好想哭啊...~>_<~ 現在只好重寫了, 話說美麗的 Catherine 小姐要結婚了,作為同事兼攝影社社長的我能給予最大的祝福,莫過是盡心幫她完成一個美好的婚禮紀錄了,看到她那幸福的模樣讓我也覺得很幸福。
在化妝室的時候幫 Catherine 拍了幾張,看得出來有一點小緊張喔!呵呵...
↘ 

↘

↘

同事 Phil 的小孩來充當小花童,是個小帥哥呢!
↘

小妹妹也很討喜...真可愛...呵呵...so cute...
↘

新郎新娘進場囉!大家掌聲鼓勵鼓勵...
↘

↘

Catherine 發巧克力給大家,為了捕捉現場的氣氛我衝到人群裡近拍,差一點跌個四腳朝天,終於能體會新聞記者有多辛苦了
↘

切蛋糕儀式...
↘

終於到了大家期待的敬酒儀式,嘿嘿...有仇報仇啦...
↘

「得即高歌失即休,多愁多恨亦悠悠;今朝有酒今朝醉,明日愁來明日愁」...大家一起舉杯祝福這對新人吧!乾啦!ㄏㄡ搭啦!
↘

怎麼可以放過這個千載難逢的機會,讓這對新人來個「愛的親親」...嘻嘻...
↘

↘

哇...這個火辣的熱吻真是太激情了...可以確定這對新人增產報國的戰鬥力應該也不在我之下呢...呵呵...
↘

透過酒杯人的表情變得很有趣,有哈哈鏡的效果...^^
↘

這張也是,呵呵...只不過苦主變成新娘了...
↘

新娘的飾品很美麗,我特地拍了幾張...
↘

送客囉!呷甜甜生豪生...
↘

終於結束了,有一個傳說是:「人一生下來就只有一半,於是每個人窮其一生都在找尋那失落的另一半」。如今你找到了妳的另一半,完美了他也完美了妳。看到你們幸福的模樣真替妳感到高興,恭喜ㄋㄟ!一定要永遠幸福下去喔!
↘

張貼者:
yinding
意見 (0)
                                    
張貼者:
yinding
意見 (0)
                                    
Java for-each Loop
簡介
很多程式語言都有支援for-each這類的語法,簡單的說for-each語法就是當我們想要存取一個 Array 或 Collection 裡面所有的元時可以更方便、更有效率的語法。for-each 也有人稱為 enhanced for 或 for-in。
使用上要注意的事項有:
- 只適用於 Java 5.0 以後的版本
 - 只適用於有 implement Iterable
 的類別基本上 Array 與 Collection 類別都沒問題。 - 只能存取裡面元素而不能置換掉它,記住,for-each 裡面的變數是 local 變數離開 for-each 之後就會消失。
 - 只能同時針對一個 Array 或 Collection 進行操作。
 - 只能同時針對一個元素操作。
 - 只能從頭開始訪問每個元素。
 
語法
| for-each 迴圈 | for 迴圈 | 
|---|---|
for (type var : arr) {
    body-of-loop
} | for (int i = 0; i < arr.length; i++) { 
    type var = arr[i];
    body-of-loop
} | 
for (type var : coll) {
    body-of-loop
} | for (Iterator<type> iter = coll.iterator(); iter.hasNext(); ) {
    type var = iter.next();
    body-of-loop
} | 
範例
這是一個使用 for-each 迴圈的程式碼:
double[] ar = {1.2, 3.0, 0.8};
int sum = 0;
for (double d : ar) {  // d gets successively each value in ar.
    sum += d;
}這是一個使用一般 for 迴圈的程式碼:
double[] ar = {1.2, 3.0, 0.8};
int sum = 0;
for (int i = 0; i < ar.length; i++) {  // i indexes each element successively.
    sum += ar[i];
}
張貼者:
yinding
意見 (0)
                                    
| Resource Type | Location | Description | XML | Java | 
| Id | /res/values/any-file | 
  |      ||
| Color | /res/values/any-file | Represents color identifiers pointing to color codes. These  resource IDs are exposed in R.java as R.color.*.  |      
 <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="@color/ red" android:text="Sample Text to Show Red Color"/>  |      int mainBackGroundColor = activity.getResources.getColor(R.color.main_back_ground_color);  | 
| String | /res/values/any-file | Represents string resources. String resources  allow Java-formatted strings and raw HTML in addition to simple strings. These resource IDs are exposed in R.java as R.string.*.  |      
  |      //Read a simple string and set it in a text view
String 
      simpleString = 
      activity.getString(R.string.simple_string);
textView.setText(simpleString);
//Read 
      a quoted string and set it in a text view
String quotedString = 
      activity.getString(R.string.quoted_string);
textView.setText(quotedString);
//Read 
      a double quoted string and set it in a text view
String 
      doubleQuotedString = 
      activity.getString(R.string.double_quoted_string);
textView.setText(doubleQuotedString);
//Read 
      a Java format string
String javaFormatString = 
      activity.getString(R.string.java_format_string);
//Convert the 
      formatted string by passing in arguments
String substitutedString = 
      String.format(javaFormatString, "Hello" , "Android");
//set the output 
      in a text view
textView.setText(substitutedString);
//Read an html 
      string from the resource and set it in a text view
String 
      htmlTaggedString = 
      activity.getString(R.string.tagged_string);
//Convert it to a text span 
      so that it can be set in a text view
//android.text.Html class allows 
      painting of "html" strings
//This is strictly an Android class and does 
      not support all html tags
Spanned textSpan = 
      android.text.Html.fromHtml(htmlTaggedString);
//Set it in a text 
      view
textView.setText(textSpan); | 
| Dimension | /res/values/any-file | Represents dimensions or sizes of various elements 
  |      
  |      float dimen = 
      activity.getResources().getDimension(R.dimen.mysize_in_pixels); | 
| Image | /res/drawable/multiple- files  |      Represents image resources. Supported images include .jpg, .gif, and .png. Each image is in a separate file and gets its own ID based on the file name. These resource IDs are exposed in R.java as R.drawable.*. The image support also includes an image type called a stretchable image that allows portions of an image to stretch while other portions of that image stay static.  |      
  |      //Call getDrawable to get the image
BitmapDrawable d = 
      activity.getResources().getDrawable(R.drawable.sample_image);
//You can 
      use the drawable then to set the 
      background
button.setBackgroundDrawable(d);
//or you can set the 
      background directly from the Resource 
      Id
button.setBackgroundResource(R.drawable.icon); | 
| Color  Drawable  |      /res/values/any-file | Represents rectangle of colors to be used as  view backgrounds or general drawables like bitmaps. You can use this instead of specifying a single colored bitmap as a background. In Java, this is equivalent to creating a colored rectangle and set- ting it as a background for a view. The <drawable> value tag in the values subdirec- tory supports this. These resource IDs are exposed in R.java as R.drawable.*. Android also supports rounded rectangles and gradient rectangles through XML files placed in /res/drawable with the root XML tag <shape>. These resource IDs are also exposed in R.java as R.drawable.*. Each file name in this case translates to a unique drawable ID.  |      
  |      // Get a drawable
ColorDrawble redDrawable 
      =
(ColorDrawable)
activity.getResources().getDrawable(R.drawable.red_rectnagle);
//Set 
      it as a background to a text 
    view
textView.setBackground(redDrawable); | 
| Shape | /res/drawable/multiple- files  |      
  |      // Get a drawable
GradientDrawable roundedRectangle 
      =
(GradientDrawable)
activity.getResources().getDrawable(R.drawable.red_rectnagle);
//Set 
      it as a background to a text 
      view
textView.setBackground(roundedRectangle); | |
| Layout | /res/layout/any-file | 
  |      public void onCreate(Bundle 
      savedInstanceState)
    
      {
        
      super.onCreate(savedInstanceState);
        
      setContentView(R.layout.main);
        
      TextView tv = 
      (TextView)this.findViewById(R.id.text1);
        
      tv.setText("Try this text instead");
    } | |
| Arbitrary  XML Files  |      /res/xml/*.xml | Android allows arbitrary XML files as resources. These files will be compiled by the AAPT com- piler. These resource IDs are exposed in R.java as R.xml.*.  |      
  |      Resources res = 
      activity.getResources();
XmlResourceParser xpp = 
      res.getXml(R.xml.test);
 
private String 
      getEventsFromAnXMLFile(Activity activity)
throws 
      XmlPullParserException, IOException
{
   StringBuffer sb = 
      new StringBuffer();
   Resources res = 
      activity.getResources();
   XmlResourceParser xpp = 
      res.getXml(R.xml.test);
  
   
      xpp.next();
   int eventType = 
      xpp.getEventType();
    while (eventType != 
      XmlPullParser.END_DOCUMENT)
    
      {
        if(eventType == 
      XmlPullParser.START_DOCUMENT)
        
      {
           
      sb.append("******Start 
      document");
        
      }
        else if(eventType == 
      XmlPullParser.START_TAG)
        
      {
           
      sb.append("\nStart tag 
      "+xpp.getName());
        
      }
        else if(eventType == 
      XmlPullParser.END_TAG)
        
      {
           
      sb.append("\nEnd tag 
      "+xpp.getName());
        
      }
        else if(eventType == 
      XmlPullParser.TEXT)
        
      {
           
      sb.append("\nText 
      "+xpp.getText());
        
      }
        eventType = 
      xpp.next();
    }//eof-while
    
      sb.append("\n******End document");
    return 
      sb.toString();
}//eof-function | 
| Arbitrary Raw Resources  |      /res/raw/*.* | Android allows arbitrary noncompiled binary or  text files under this directory. Each file gets a unique resource ID. These resource IDs are exposed in R.java as R.raw.*.  |      String getStringFromRawFile(Activity 
      activity)
{
    Resources r = 
      activity.getResources();
    InputStream is = 
      r.openRawResource(R.raw.test);
    String myText = 
      convertStreamToString(is);
    
      is.close();
    return myText;
}
String 
      convertStreamToString(InputStream is)
{  
    
      ByteArrayOutputStream baos = new 
      ByteArrayOutputStream();
    int i = 
      is.read();
    while (i != -1)
    
      {
        
      baos.write(i);
        i = 
      baos.read();
    }
    return 
      baos.toString();
} | |
| Arbitrary Raw Assets  |      /assets/*.*/*.* | Android allows arbitrary files in arbitrary  subdirec- tories, starting at the /assets subdirectory. These are not really resources, but raw files. This directo- ry, unlike the /res subdirectory, allows an arbitrary depth of subdirectories. These files do not generate any resource IDs. You have to use a relative path name starting at and excluding /assets.  |      //Note: Exceptions are not shown in the code
String 
      getStringFromAssetFile(Activity activity)
{
    
      AssetManager am = activity.getAssets();
    InputStream 
      is = am.open("test.txt");
    String s = 
      convertStreamToString(is);
    
      is.close();
    return s;
} | 

