[[Software/Android/¥¢¥×¥ê¥±¡¼¥·¥ç¥ó³«È¯¥Æ¥­¥¹¥È]]

*Chapter 3 : ¥¤¥ó¥Æ¥ó¥È¤Ë¤è¤ë³°Éô¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤È¤ÎÏ¢·È [#t05697a1]

¡¡¤³¤Î¾Ï¤Ç¤Ï²èÁü¥ê¥µ¥¤¥º¥Ä¡¼¥ë¤Î³«È¯¤òÄ̤·¤Æ¡¢¥¤¥ó¥Æ¥ó¥È¤Ë¤è¤ë³°Éô¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤È¤ÎÏ¢·È¤Ë¤Ä¤¤¤Æ²òÀ⤷¤Þ¤¹¡£

¡¡¤³¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï¥¤¥ó¥Æ¥ó¥È¤Ë¤è¤ê¥®¥ã¥é¥ê¡¼¤ä¥«¥á¥é¥¢¥×¥ê¤ò¸Æ¤Ó½Ð¤·¡¢¤½¤³¤«¤é¼õ¤±¼è¤Ã¤¿²èÁü¤ò»ØÄꥵ¥¤¥º¤Ë¥ê¥µ¥¤¥º¤·¤Æ¥®¥ã¥é¥ê¡¼¤ËÊݸ¤ò¹Ô¤¤¤Þ¤¹¡£

¡¡¿·µ¬Android¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥¸¥§¥¯¥È¤ò°Ê²¼¤ÎÀßÄê¤ÇºîÀ®¤·¤Þ¤¹¡£

-Project Name¤Ë¡ÖIResizer¡×¤ÈÆþÎϤ·¤Þ¤¹
-Application Name¤Ë¡ÖIResizer¡×¤ÈÆþÎϤ·¤Þ¤¹
-Package Name¤Ë¡Öcom.beatcraft.iresizer¡×¤ÈÆþÎϤ·¤Þ¤¹
-Create Activity¤Ë¥Á¥§¥Ã¥¯¤òÆþ¤ì¡¢¡ÖIResizerActivity¡×¤ÈÆþÎϤ·¤Þ¤¹ 



####ºîÀ®Ãæ####~
¡¡¤³¤Î¾Ï¤Ç¤Ï¥Õ¥¡¥¤¥ë¸¡º÷¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î³«È¯¤òÄ̤·¤Æ¡¢¼ÂÍÑŪ¤ÊAndroid¥¢¥×¥ê¥±¡¼¥·¥ç¥ó³«È¯¤Î´ðÁäò²òÀ⤷¤Þ¤¹¡£

¡¡Android¤Ë¤Ï¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¤ÇÆ°ºî¤¹¤ë¥µ¡¼¥Ó¥¹¡¢¥Û¡¼¥à²èÌ̤ËÀßÃÖ²Äǽ¤Ê¥¦¥£¥¸¥§¥Ã¥È¤È¤¤¤Ã¤¿ÍÍ¡¹¤Ê·ÁÂ֤Υ¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬Â¸ºß¤·¤Þ¤¹¤¬¡¢ËܾϤǤÏÁ´²èÌ̤òÀêÍ­¤¹¤ë²èÌÌ¡Ê¥¦¥£¥ó¥É¥¦¡Ë¤ò»ý¤Ä¡¢°ìÈÌŪ¤Ê¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò¼è¤ê°·¤¤¤Þ¤¹¡£
~
~

**2-1. ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥¸¥§¥¯¥È¤Î¹½À®Í×ÁÇ [#vea542bc]
**3-1. ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥ì¥¤¥¢¥¦¥ÈºîÀ® [#s1bc295b]

¡¡¤Þ¤º¤Ï¥Ù¡¼¥¹¤È¤Ê¤ë¥×¥í¥¸¥§¥¯¥È¤òÍÑ°Õ¤·¤Þ¤¹¡£°Ê²¼¤ÎÍͤËÀßÄꤷ¡¢¿·µ¬Android¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥¸¥§¥¯¥È¤òºîÀ®¤·¤Þ¤¹¡£
¡¡º£²óºîÀ®¤¹¤ë¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤Ï¡¢½Ä²èÌÌ»þ¤È²£²èÌÌ»þ¤Ç¤½¤ì¤¾¤ì¤Î¥ì¥¤¥¢¥¦¥È¤òÍÑ°Õ¤·¤Þ¤¹¡£¿Þ3-1¤¬½Ä²èÌÌ¡¢¿Þ3-2¤¬²£²èÌ̤Υ¤¥á¡¼¥¸¤Ë¤Ê¤ê¤Þ¤¹¡£

-Project Name¤Ë¡ÖFFind¡×¤ÈÆþÎϤ·¤Þ¤¹
-Application Name¤Ë¡ÖFFind¡×¤ÈÆþÎϤ·¤Þ¤¹
-Package Name¤Ë¡Öcom.beatcraft.ffind¡×¤ÈÆþÎϤ·¤Þ¤¹
-Create Activity¤Ë¥Á¥§¥Ã¥¯¤òÆþ¤ì¡¢¡ÖFFindActivity¡×¤ÈÆþÎϤ·¤Þ¤¹ 

¡¡Android¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥×¥í¥¸¥§¥¯¥È¤ÏÂ礭¤¯Ê¬¤±¤Æ°Ê²¼¤Î3¤Ä¤ÎÍ×ÁǤǹ½À®¤µ¤ì¤Þ¤¹¡£
CENTER:&ref(./03_01.png,);
CENTER:¿Þ3-1~
~
~

|LEFT:|CENTER:|c
|¡¡­¡¥Þ¥Ë¥Õ¥§¥¹¥È¥Õ¥¡¥¤¥ë&br;¡¡­¢ Java¥½¡¼¥¹¥³¡¼¥É&br;¡¡­£¥ê¥½¡¼¥¹|&ref(./02_01.png,);&br;¿Þ2-1|
CENTER:&ref(./03_02.png,);
CENTER:¿Þ3-2~
~

¡¡ºîÀ®¤·¤¿¥×¥í¥¸¥§¥¯¥È¤òPackage Explorer¤Ç³Îǧ¤·¤Ä¤Ä¡¢³ÆÍ×ÁǤˤĤ¤¤Æ²òÀ⤷¤Æ¤¤¤­¤Þ¤¹¡£
~
~

­¡¥Þ¥Ë¥Õ¥§¥¹¥È¥Õ¥¡¥¤¥ë¡ÊAndroidManifest.xml¡Ë~
¡¡¤³¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î̾Á°¤ä¥Ð¡¼¥¸¥ç¥ó¡¢¤É¤Î¤è¤¦¤Ê²èÌ̤ò»ý¤Ä¤«¡¢¤É¤Î¤è¤¦¤Êµ¡Ç½¤ò»ý¤Ä¤«¤È¤¤¤Ã¤¿ÆâÍƤòµ­½Ò¤·¤¿XML¥Õ¥¡¥¤¥ë¤Ç¡¢Package Explorer¤Î¥×¥í¥¸¥§¥¯¥Èľ²¼¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Android¤Ï¤³¤Î¥Þ¥Ë¥Õ¥§¥¹¥È¤Ëµ­½Ò¤µ¤ì¤¿ÆâÍƤò¸µ¤Ë¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò´ÉÍý¤·¤Þ¤¹¡£
¡¡¹õ¤¤Í¾ÇòÉôʬ¤Ï¾¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤«¤é¼õ¤±¼è¤Ã¤¿²èÁü¤ò¥×¥ì¥Ó¥å¡¼É½¼¨¤¹¤ëÎΰè¤È¤Ê¤ê¡¢¤½¤Î²¼¡¢¤â¤·¤¯¤Ï±¦¤ËÁàºîÉôʬ¤¬ÇÛÃÖ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£º£²ó¤ÏÁàºîÉô¤òÊ̥쥤¥¢¥¦¥È¤È¤·¤ÆºîÀ®¤·¡¢¤½¤ì¤¾¤ì¤Î¥ì¥¤¥¢¥¦¥È¤Ç¼è¤ê¹þ¤ó¤ÇÍøÍѤ¹¤ë¤³¤È¤È¤·¤Þ¤¹¡£

¡¡¥ê¥¹¥È2-1¤¬º£²ó¼«Æ°Åª¤ËºîÀ®¤µ¤ì¤¿¥Þ¥Ë¥Õ¥§¥¹¥È¥Õ¥¡¥¤¥ë¤Ç¤¹¡£
¡¡¥ì¥¤¥¢¥¦¥È¤òºîÀ®¤¹¤ëÁ°¤ËÍøÍѤ¹¤ëʸ»úÎó¥ê¥½¡¼¥¹¤òÄêµÁ¤·¤Æ¤ª¤­¤Þ¤¹¡£¥ê¥½¡¼¥¹¤Îstrings.xml¤ò¥À¥Ö¥ë¥¯¥ê¥Ã¥¯¤·¤Æ³«¤­¡¢°Ê²¼¤Îʸ»úÎó¥ê¥½¡¼¥¹¤òÄɲä·¤Þ¤¹¡£

-¥ê¥¹¥È2-1
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.beatcraft.ffind"
     android:versionCode="1"
     android:versionName="1.0" >
 
     <uses-sdk android:minSdkVersion="8" />
 
     <application
         android:icon="@drawable/ic_launcher"
         android:label="@string/app_name" >
         <activity
             android:label="@string/app_name"
             android:name=".FFindActivity" >
             <intent-filter >
                 <action android:name="android.intent.action.MAIN" />
 
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
     </application>
 
 </manifest>
 <string name="select_image">²èÁü¤òÁªÂò</string>
 <string name="take_photo">¼Ì¿¿¤ò»£±Æ</string>
 <string name="label_w">²£</string>
 <string name="label_h">½Ä</string>
 <string name="keep_ratio">ÈæΨ¤ò°Ý»ý</string>
 <string name="save">Êݸ</string>
~

¡¡applicationÍ×ÁǤÎandroid:icon°À­¤¬¤³¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç»ÈÍѤ¹¤ë¥é¥ó¥Á¥ã¡¼¥¢¥¤¥³¥ó¤ò¼¨¤·¡¢android:label°À­¤Ï¤³¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î̾Á°¤ò¼¨¤·¤Þ¤¹¡£~
¡¡¤½¤ì¤¾¤ì¤Î°À­¤ÎÆâÍƤϡ¢¸å½Ò¤¹¤ë¥ê¥½¡¼¥¹¤ò ¡Ödrawable/ic_launcher¡×¡Ö@string/app_name¡×¤È¤¤¤Ã¤¿ID¤Ç»ØÄꤷ¤Æ¤¤¤Þ¤¹¡£
¡¡¤Þ¤º¤ÏÁàºîÉô¤Î¥ì¥¤¥¢¥¦¥È¤òºîÀ®¤·¤Þ¤¹¡£IResizer¤ò¥¯¥ê¥Ã¥¯¤·¤ÆÁªÂò¤·¡¢¥á¥Ë¥å¡¼¤«¤é¡ÖFile > New > Other...¡×¤òÁªÂò¤·¤Þ¤¹¡£"Select a wizard"¥À¥¤¥¢¥í¥°¤¬É½¼¨¤µ¤ì¤¿¤é¡¢¡ÖAndroid > Android XML Layout File¡×¤òÁªÂò¤·¤Æ¡ÖNext¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ²¼¤µ¤¤¡£

¡¡activityÍ×ÁǤˤϤ³¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ë´Þ¤Þ¤ì¤ë¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤Ë´Ø¤¹¤ë¾ðÊó¤òµ­½Ò¤·¤Þ¤¹¡£¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ë»ë³ÐŪ¤Ê¥æ¡¼¥¶¡¼¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤òÄ󶡤¹¤ë¤â¤Î¤Ç¡¢Â¾¤ÎOS¤Ç¸À¤¦¡Ö²èÌ̡פä¡Ö¥¦¥£¥ó¥É¥¦¡×¤ËÁêÅö¤·¤Þ¤¹¡£Ä̾ï¤Ï£±¤Ä¤Î¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤¬Á´²èÌ̤òÀêÍ­¤·¡¢Ê£¿ô¤Î¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤ò»ý¤Ä¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤Ï¤³¤ì¤òÀÚ¤êÂؤ¨¤Æ»ÈÍѤ·¤Þ¤¹¡£~
¡¡activityÍ×ÁÇÆâ¤Ë¤¢¤ëintent-filterÍ×ÁǤˤϡ¢¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤¬¼è¤ê°·¤¤²Äǽ¤Ê¥¤¥ó¥Æ¥ó¥È¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤òµ­½Ò¤·¤Þ¤¹¡£¥¤¥ó¥Æ¥ó¥È¤Ï¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤ä¾¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¡¢¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¥µ¡¼¥Ó¥¹¤Ê¤É¤È¤Î¥á¥Ã¥»¡¼¥¸Á÷¼õ¿®¤Ë»ÈÍѤ¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Ç¡¢²èÌÌÁ«°Ü¤ä¥¢¥×¥ê¥±¡¼¥·¥ç¥ó´Ö¤ÎÏ¢·È¤Ë»ÈÍѤ·¤Þ¤¹¡£
¡¡Â³¤¯"New Android Layout XML File"¤ÇFile¤Ë¡Öcontroller.xml¡×¤ÈÆþÎϤ·¡¢¡ÖFinish¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¥ì¥¤¥¢¥¦¥È¥ê¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤¬ºîÀ®¤µ¤ì¤Þ¤¹¡£ºîÀ®¤·¤¿controller.xml¤ò³«¤­¡¢¥Ü¥¿¥ó¤ä¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤òÇÛÃÖ¤·¤Æ¤¤¤­¤Þ¤¹¡£

¡¡¤³¤Î¥Þ¥Ë¥Õ¥§¥¹¥È¤Ç¤Ï¡¢FFindActivity¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤¬¤³¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¥á¥¤¥ó¤È¤Ê¤ë²èÌ̤Ǥ¢¤ê¡¢Android¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥é¥ó¥Á¥ã¡¼¤ËÅÐÏ¿¤µ¤ìµ¯Æ°²Äǽ¤Ç¤¢¤ë¤³¤È¤¬¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
~
~
¡¡º¸Éô¤ÎPalette¤«¤éForm Widgets¤ò¥¯¥ê¥Ã¥¯¤·¤ÆŸ³«¤·¡¢¡ÖButton¡×¤ò¥É¥é¥Ã¥°¡õ¥É¥í¥Ã¥×¤ÇÇÛÃÖ¤·¤Þ¤¹¡£ÇÛÃÖ¤·¤¿¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¡¢¥ì¥¤¥¢¥¦¥¿²¼Éô¤Î¡ÖProperties¡×¤Ç°Ê²¼¤Î¤è¤¦¤ËÀßÄê¤òÊѹ¹¤·¤Þ¤¹¡£

­¢Java¥½¡¼¥¹¥³¡¼¥É~
¡¡¤³¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò¹½À®¤¹¤ë¥½¡¼¥¹¥³¡¼¥É¤Ç¡¢Package Explorer¤Îsrc²¼¤ËÇÛÃÖ¤µ¤ì¤Þ¤¹¡£¸½Ãʳ¬¤Ç¤Ï¥×¥í¥¸¥§¥¯¥ÈºîÀ®»þ¤Ë¼«Æ°À¸À®¤µ¤ì¤¿FFindActivity.java¤¬¥Ñ¥Ã¥±¡¼¥¸²¼¤ËÃÖ¤«¤ì¤Æ¤¤¤Þ¤¹¡£
-Id¤Ë¡Ö@+id/SelectImage¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Text¤Ë¡Ö@string/select_image¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout height¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout margin left¤ÈLayout margin right¤Ë¡Ö10dip¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout width¤Ë¡Öfill_parent¡×¤ò»ØÄꤷ¤Þ¤¹¡£

-¥ê¥¹¥È2-2 FFindActivity.java :&#160;
 package com.beatcraft.ffind;
 
 import android.app.Activity;
 import android.os.Bundle;
 
 public class FFindActivity extends Activity {
     /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);
     }
 }
~
¡¡Æ±Íͤ˥ܥ¿¥ó¤ò¤â¤¦°ì¤ÄÄɲ䷤ơ¢°Ê²¼¤Î¤è¤¦¤ËÀßÄê¤òÊѹ¹¤·¤Þ¤¹¡£

¡¡FFindActivity.java¡Ê¥ê¥¹¥È2-2¡Ë¤ÎonCreate¥á¥½¥Ã¥É¤Ï¡¢FFindActivity¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤¬À¸À®¤µ¤ì¤ëºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¥á¥½¥Ã¥É¤Ç¡¢¤³¤Î¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤ËɬÍפʽé´üÀßÄê¤ò¤³¤³¤Ëµ­½Ò¤·¤Þ¤¹¡£¤³¤³¤Ç¤Ïsuper¥¯¥é¥¹¤ÎonCreate¤ò¸Æ¤Ó½Ð¤·¤Æ´ðËÜŪ¤Ê½é´üÀßÄê¤ò¹Ô¤Ê¤Ã¤Æ¤¤¤ë¤Û¤«¡¢setContentView¥á¥½¥Ã¥É¤Ç¤³¤Î¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤Î³°´Ñ¤òÀßÄꤷ¤Æ¤¤¤Þ¤¹¡£~
¡¡setContentView¥á¥½¥Ã¥É¤Î°ú¿ô¤ËÅϤ·¤Æ¤¤¤ë¡ÖR.layout.main¡×¤È¤¤¤¦¤Î¤Ï¡¢¸å½Ò¤¹¤ë¥ê¥½¡¼¥¹¤«¤é²èÌ̥쥤¥¢¥¦¥È¤ò»ØÄꤷ¤Æ¤¤¤Þ¤¹¡£
~
~
-Id¤Ë¡Ö@+id/TakePhoto¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Text¤Ë¡Ö@string/take_photo¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout height¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout margin left¤ÈLayout margin right¤Ë¡Ö10dip¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout width¤Ë¡Öfill_parent¡×¤ò»ØÄꤷ¤Þ¤¹¡£

­£¥ê¥½¡¼¥¹~
¡¡¥ê¥½¡¼¥¹¤Ë¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç»ÈÍѤµ¤ì¤ëʸ»úÎó¤ä²èÁü¡¢²»À¼¡¢²èÌ̥쥤¥¢¥¦¥È¤È¤¤¤Ã¤¿ÍÍ¡¹¤Êʪ¤¬´Þ¤Þ¤ì¤Þ¤¹¡£Package Explorer¤Ç¤Ïres²¼¤ËÇÛÃÖ¤µ¤ì¡¢¥ê¥½¡¼¥¹¤Î¼ïÊÌËè¤ËʬÎव¤ì¤Æ¤¤¤Þ¤¹¡£¥×¥í¥¸¥§¥¯¥ÈºîÀ®»þÅÀ¤Ç¤Ï¡¢drawable/layout/values¤È¤¤¤¦»°¼ï¤Î¥ê¥½¡¼¥¹¥Õ¥©¥ë¥À¤¬ºîÀ®¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ 
¡¡Â³¤¤¤Æ²£¥µ¥¤¥º¤ÎÆþÎϹàÌܤòÇÛÃÖ¤·¤Æ¤¤¤­¤Þ¤¹¡£¡ÖLinearLayout (Horizontal)¡×¤ò¥É¥é¥Ã¥°¡õ¥É¥í¥Ã¥×¤ÇÇÛÃÖ¤·¡¢°Ê²¼¤Î¤è¤¦¤ËÀßÄê¤òÊѹ¹¤·¤Þ¤¹¡£

¡¡drawable¤Ë¤Ï²èÁü¥Õ¥¡¥¤¥ë¤Ê¤É¤ÎÉÁ²è²Äǽ¤Ê¥ê¥½¡¼¥¹¤¬ÃÖ¤«¤ì¤Þ¤¹¡£-hdpi/-mdpi/-ldpi¤È¤¤¤¦¥µ¥Õ¥£¥Ã¥¯¥¹¤¬ÉÕÍ¿¤µ¤ì¤¿3¤Ä¤Î¥Õ¥©¥ë¥À¤¬ºîÀ®¤µ¤ì¤Æ¤¤¤Þ¤¹¤¬¡¢¤³¤ì¤ÏAndroid¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò¿ÍͤʴĶ­¤ËưŪ¤ËÂбþ¤µ¤»¤ë¤¿¤á¤Î»ÅÁȤߤǡ¢¤½¤ì¤¾¤ì¹â²òÁüÅÙ/Ãæ²òÁüÅÙ/Äã²òÁüÅÙüËöÍѤÎÉÁ²è¥ê¥½¡¼¥¹¤òÇÛÃÖ¤·¤Þ¤¹¡£~
¡¡¤É¤Î´Ä¶­¤Ç¤âƱ¤¸Êª¤ò»ÈÍѤ¹¤ë¾ì¹ç¤Ï¡¢¥µ¥Õ¥£¥Ã¥¯¥¹¤òÉÕ¤±¤Ê¤¤drawable¥Õ¥©¥ë¥À¤òºîÀ®¤·¡¢¤½¤³¤ËÇÛÃÖ¤¹¤ë¤³¤È¤â²Äǽ¤Ç¤¹¡£Âбþ¤¹¤ë²òÁüÅÙÍÑ¥Õ¥©¥ë¥À¤Ë¥ê¥½¡¼¥¹¤¬Ìµ¤¤¾ì¹ç¤Ï¾¤Î²òÁüÅÙÍѥ꥽¡¼¥¹¤ò¼«Æ°Åª¤Ë¥¹¥±¡¼¥ë¤·¤Æ»ÈÍѤµ¤ì¤Þ¤¹¡£~
¡¡¥Þ¥Ë¥Õ¥§¥¹¥È¤Îandroid:icon°À­¤Ç»ØÄꤷ¤¿¡Ö@drawable/ic_launcher¡×¤¬¼¨¤¹²èÁü¥ê¥½¡¼¥¹¤Î¼ÂÂΡÊic_launcher.png¡Ë¤Ï¤³¤³¤Ë´Þ¤Þ¤ì¤Þ¤¹¡£
-Id¤Ë¡Ö@+id/WLayout¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout height¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout margin left¤ÈLayout margin right¤Ë¡Ö10dip¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout width¤Ë¡Öfill_parent¡×¤ò»ØÄꤷ¤Þ¤¹¡£

¡¡layout¤Ë¤Ï¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤Î²èÌ̥쥤¥¢¥¦¥È¤òµ­½Ò¤·¤¿XML¥Õ¥¡¥¤¥ë¤¬ÃÖ¤«¤ì¤Þ¤¹¡£¥×¥í¥¸¥§¥¯¥ÈºîÀ®»þÅÀ¤Ç¤Ïmain.xml¤È¤¤¤¦¥ì¥¤¥¢¥¦¥È¥Õ¥¡¥¤¥ë¤¬¼«Æ°À¸À®¤µ¤ì¤Æ¤¤¤Þ¤¹¡£~
¡¡FFindActivity.java¤ÎsetContentView¥á¥½¥Ã¥É¤Ç»ØÄꤷ¤¿¡ÖR.layout.main¡×¤¬¤³¤Î¥ì¥¤¥¢¥¦¥È¤ò¼¨¤·¤Æ¤¤¤Þ¤¹¡£
¡¡TextView¤ò¾åµ­¥ì¥¤¥¢¥¦¥È¤ËÄɲä·¡¢°Ê²¼¤Î¤è¤¦¤ËÀßÄê¤òÊѹ¹¤·¤Þ¤¹¡£

¡¡values¤Ë¤Ïʸ»úÎó¤äÎóµó¤È¤¤¤Ã¤¿¡¢ÍÍ¡¹¤ÊÃͤòÄêµÁ¤·¤¿XML¥Õ¥¡¥¤¥ë¤¬ÃÖ¤«¤ì¤Þ¤¹¡£¥×¥í¥¸¥§¥¯¥ÈºîÀ®»þÅÀ¤Ç¤Ïstrings.xml¤È¤¤¤¦Ê¸»úÎó¤òÄêµÁ¤·¤¿XML¥Õ¥¡¥¤¥ë¤¬¼«Æ°À¸À®¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¥Õ¥©¥ë¥À¤Ë¡Ö-ja¡×¤ä¡Ö-en¡×¤È¤¤¤Ã¤¿¥µ¥Õ¥£¥Ã¥¯¥¹¤ò¤Ä¤±¤¿¤â¤Î¤òºîÀ®¤¹¤ë¤³¤È¤Ë¤è¤ê¡¢¸À¸ìÊ̤ÎÃͥ꥽¡¼¥¹¤òÍÑ°Õ¤¹¤ë¤³¤È¤â²Äǽ¤Ç¤¹¡£~
¡¡¥Þ¥Ë¥Õ¥§¥¹¥È¤Îandroid:label°À­¤Ç»ØÄꤷ¤¿¡Ö@string/app_name¡×¤¬¼¨¤¹Ê¸»úÎó¥ê¥½¡¼¥¹¤ÎÆâÍƤ¬¤³¤Îstrings.xml¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
-Id¤Ë¡Ö@+id/WLabel¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Text¤Ë¡Ö@string/label_w¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout height¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout width¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£

¡¡¥ê¥½¡¼¥¹¤Ï¥ê¥½¡¼¥¹ID¤Ë¤è¤Ã¤Æ¥Þ¥Ë¥Õ¥§¥¹¥È¤äJava¥½¡¼¥¹¥³¡¼¥É¡¢Â¾¤Î¥ê¥½¡¼¥¹¤«¤é»²¾È¤µ¤ì¤Þ¤¹¡£¥ê¥½¡¼¥¹ID¤Ë¤ÏXML¥Õ¥¡¥¤¥ë¤Ç»²¾È¤µ¤ì¤ë¾ì¹ç¤ÈJava¥½¡¼¥¹¥³¡¼¥É¤Ç»²¾È¤µ¤ì¤ë¾ì¹ç¤È¤ÇÆó¼ïÎà¤Îµ­Ë¡¤¬¤¢¤ê¡¢°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
¡¡EditText¤ò¾åµ­¥ì¥¤¥¢¥¦¥È¤ËÄɲä·¡¢°Ê²¼¤Î¤è¤¦¤ËÀßÄê¤òÊѹ¹¤·¤Þ¤¹¡£

-XML¥Õ¥¡¥¤¥ë¤«¤é»²¾È¤¹¤ë¾ì¹ç :
--@¥ê¥½¡¼¥¹¼ïÊÌ/¥ê¥½¡¼¥¹Ì¾
-Java¥½¡¼¥¹¥³¡¼¥É¤«¤é»²¾È¤¹¤ë¾ì¹ç :
--R.¥ê¥½¡¼¥¹¼ïÊÌ.¥ê¥½¡¼¥¹Ì¾
~
~
-Id¤Ë¡Ö@+id/WSize¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Input type¤Ë¡Önumber¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout height¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout weight¤Ë¡Ö1¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout width¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£

¡¡drawable¤Èlayout¤Ï¤½¤Î¤Þ¤Þ¥ê¥½¡¼¥¹¼ïÊ̤Ȥʤꡢ¥ê¥½¡¼¥¹Ì¾¤Ë¤Ï¥ê¥½¡¼¥¹¼ÂÂΤΥե¡¥¤¥ë̾¤«¤é¥µ¥Õ¥£¥Ã¥¯¥¹¤ò¼è¤ê½ü¤¤¤¿Êª¤Ë¤Ê¤ê¤Þ¤¹¡£¤³¤ì¤Þ¤Ç¸«¤¿Îã¤Ç¸À¤¨¤Ð¡¢drawable-hdpi/mdpi/ldpi¤Ë´Þ¤Þ¤ì¤ëic_launcher.png¤Î¥ê¥½¡¼¥¹ID¤Ï¡Ö@drawable/ic_launcher¡×¡ÖR.drawable.ic_launcher¡×¡¢layout¤Ë´Þ¤Þ¤ì¤ëmain.xml¤¬¡ÖR.layout.main¡×¤Ë¤Ê¤ë¡¢¤È¸À¤Ã¤¿¶ñ¹ç¤Ç¤¹¡£
¡¡TextView¤ò¾åµ­¥ì¥¤¥¢¥¦¥È¤ËÄɲä·¡¢°Ê²¼¤Î¤è¤¦¤ËÀßÄê¤òÊѹ¹¤·¤Þ¤¹¡£

¡¡values¤Ë´Þ¤Þ¤ì¤ëXML¥Õ¥¡¥¤¥ë¤Î¥ê¥½¡¼¥¹¼ïÊ̤Ïvalues¤È¤Ï¤Ê¤é¤º¡¢¤½¤ì¤¾¤ì¤ÎXML¥Õ¥¡¥¤¥ëÆâ¤ÇÄêµÁ¤µ¤ì¤¿Í×ÁÇ̾¤Ë¤Ê¤ê¤Þ¤¹¡£¼«Æ°À¸À®¤µ¤ì¤¿strings.xml¡Ê¥ê¥¹¥È2-3¡Ë¤Ë¤Ï¡¢resourcesÍ×ÁǤ˰Ϥޤ줿string¤È¤¤¤¦Í×ÁǤ¬Ê¤ó¤Ç¤¤¤Þ¤¹¡£¤³¤ÎÍ×ÁÇ̾¤¬¥ê¥½¡¼¥¹¼ïÊ̤Ȥʤꡢname°À­¤¬¥ê¥½¡¼¥¹Ì¾¤È¤Ê¤ê¤Þ¤¹¡£~
¡¡¥Þ¥Ë¥Õ¥§¥¹¥È¤Ç»ØÄꤷ¤¿¡Ö@string/app_name¡×¤¬¥ê¥½¡¼¥¹ID¤È¤Ê¤ê¡¢¤½¤ì¤¬»Ø¤·¼¨¤¹Ê¸»úÎ󤬡ÖFFind¡×¤È¸À¤Ã¤¿¶ñ¹ç¤Ç¤¹¡£
-Id¤Ë¡Ö@+id/WSuffix¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Text¤Ë¡Öpx¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout height¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout width¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£

-¥ê¥¹¥È2-3 strings.xml :
 < xml version="1.0" encoding="utf-8" >
 <resources>
 
     <string name="hello">Hello World, FFindActivity!</string>
     <string name="app_name">FFind</string>
 
 </resources>
~
~
¡¡½Ä¥µ¥¤¥º¤ÎÆþÎϹàÌܤⲣ¥µ¥¤¥ºÆ±ÍͤËÇÛÃÖ¤·¤Æ¤¤¤­¤Þ¤¹¡£¡ÖLinearLayout (Horizontal)¡×¤ò¥É¥é¥Ã¥°¡õ¥É¥í¥Ã¥×¤ÇÇÛÃÖ¤·¡¢°Ê²¼¤Î¤è¤¦¤ËÀßÄê¤òÊѹ¹¤·¤Þ¤¹¡£

**2-2. ¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤Î¹½À®Í×ÁǤȥ쥤¥¢¥¦¥È [#nd08055e]
-Id¤Ë¡Ö@+id/HLayout¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout height¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout margin left¤ÈLayout margin right¤Ë¡Ö10dip¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout width¤Ë¡Öfill_parent¡×¤ò»ØÄꤷ¤Þ¤¹¡£

¡¡Android¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î´é¤È¤Ê¤ë¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤Ï¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó²èÌ̤Îɽ¼¨¤ÎÏÈÁȤߤòÄ󶡤·¤Þ¤¹¤¬¡¢¤³¤ì¤À¤±¤Ç¤Ï²¿¤«¤òɽ¼¨¤·¤¿¤ê¥æ¡¼¥¶¡¼ÆþÎϤò¼õ¤±ÉÕ¤±¤¿¤ê¤È¤¤¤Ã¤¿¤³¤È¤¬½ÐÍè¤Þ¤»¤ó¡£¤³¤ÎÏȤÎÃæ¤Ë¡¢¥Ó¥å¡¼¡ÊView¡Ë¤ä¥Ó¥å¡¼¥°¥ë¡¼¥×¡ÊViewGroup¡Ë¤È¤¤¤Ã¤¿³¬Áع½Â¤¤ò»ý¤ÄGUIÉôÉʤòÀßÄꤹ¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
¡¡TextView¤ò¾åµ­¥ì¥¤¥¢¥¦¥È¤ËÄɲä·¡¢°Ê²¼¤Î¤è¤¦¤ËÀßÄê¤òÊѹ¹¤·¤Þ¤¹¡£

¡¡¥Ó¥å¡¼¤ÏGUIÉôÉʤδðËܤȤʤë¤â¤Î¤Ç¡¢¥Ü¥¿¥ó¤ä¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤Ê¤É¤ÏÁ´¤Æ¥Ó¥å¡¼¤Ç¤¹¡£¤Þ¤¿¸å½Ò¤Î¥Ó¥å¡¼¥°¥ë¡¼¥×¤â¥Ó¥å¡¼¤Î°ì¼ï¤È¤Ê¤ê¤Þ¤¹¡£¥Ó¥å¡¼¥°¥ë¡¼¥×¤Ï¥Ó¥å¡¼¤òÊ£¿ô¤Þ¤È¤á¤Æ´ÉÍý¤¹¤ë¤â¤Î¤Ç¡¢GUIÉôÉʤò¤É¤Î¤è¤¦¤ËÇÛÃÖ¤¹¤ë¤«¤ò·èÄꤹ¤ë¥ì¥¤¥¢¥¦¥È¤â¤³¤ì¤Ë´Þ¤Þ¤ì¤Þ¤¹¡£
-Id¤Ë¡Ö@+id/HLabel¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Text¤Ë¡Ö@string/label_h¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout height¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout width¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£

¡¡¥ì¥¤¥¢¥¦¥È¤ÏGUIÉôÉʤò¤É¤Î¤è¤¦¤ËÇÛÃÖ¤¹¤ë¤«¤ò·èÄê¤Å¤±¤ë¥Ó¥å¡¼¥°¥ë¡¼¥×¤Ç¡¢LinearLayout¤äRelativeLayout¡¢TableLayout¤È¤¤¤Ã¤¿ÇÛÃÖÊýË¡¤Î°Û¤Ê¤ë¥ì¥¤¥¢¥¦¥È¤¬ÍÑ°Õ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
¡¡EditText¤ò¾åµ­¥ì¥¤¥¢¥¦¥È¤ËÄɲä·¡¢°Ê²¼¤Î¤è¤¦¤ËÀßÄê¤òÊѹ¹¤·¤Þ¤¹¡£

-Id¤Ë¡Ö@+id/HSize¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Input type¤Ë¡Önumber¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout height¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout weight¤Ë¡Ö1¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout width¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£

-LinearLayout
--LinearLayout¤Ï¥Ó¥å¡¼¤òÅÐÏ¿¤·¤¿½çÈÖ¤Ëʤ٤ëɸ½àŪ¤Ê¥ì¥¤¥¢¥¦¥È¤Ç¤¹¡£½ÄÊý¸þ¤Ëʤ٤Ƥ¤¤¯¤«¡¢²£Êý¸þ¤Ëʤ٤Ƥ¤¤¯¤«¤òÁªÂò½ÐÍè¤Þ¤¹¡£
-RelativeLayout
--RelativeLayout¤Ï¥Ó¥å¡¼Æ±»Î¤ÎÇÛÃ֤˴ØÏ¢À­¤ò¤â¤¿¤»¡¢¤½¤ì¤¾¤ì¤Î¥Ó¥å¡¼¤Î°ÌÃÖ´Ø·¸¤ò»ØÄꤹ¤ë¤³¤È¤ÇÊ£»¨¤Ê¥ì¥¤¥¢¥¦¥È¤ò¼Â¸½¤·¤Þ¤¹¡£
-TableLayout
--TableLayout¤Ïɽ·Á¼°¤Ë¥Ó¥å¡¼¤òÇÛÃÖ¤¹¤ë¥ì¥¤¥¢¥¦¥È¤Ç¤¹¡£
¡¡TextView¤ò¾åµ­¥ì¥¤¥¢¥¦¥È¤ËÄɲä·¡¢°Ê²¼¤Î¤è¤¦¤ËÀßÄê¤òÊѹ¹¤·¤Þ¤¹¡£

¡¡¤³¤Î¾¤Ë¤âÍÑÅӤ˱þ¤¸¤¿¤¤¤¯¤Ä¤«¤Î¥ì¥¤¥¢¥¦¥È¤¬Ä󶡤µ¤ì¤Æ¤ª¤ê¡¢¥ì¥¤¥¢¥¦¥È¼«ÂΤⳬÁØŪ¤ËÇÛÃÖ¤¹¤ë¤³¤È¤¬²Äǽ¤Ç¤¹¡£
~
~
-Id¤Ë¡Ö@+id/HSuffix¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Text¤Ë¡Öpx¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout height¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout width¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£

**2-3. ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥ì¥¤¥¢¥¦¥ÈºîÀ® [#c0a8843b]
¡¡Â³¤¤¤ÆPalette¤«¤éForm Widgets¤ò¥¯¥ê¥Ã¥¯¤·¤ÆŸ³«¤·¡¢¡ÖCheckBox¡×¤ò¥É¥é¥Ã¥°¡õ¥É¥í¥Ã¥×¤ÇÇÛÃÖ¤·¤Þ¤¹¡£ÇÛÃÖ¤·¤¿¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÀßÄê¤ò°Ê²¼¤Î¤è¤¦¤ËÊѹ¹¤·¤Þ¤¹¡£

¡¡¤³¤³¤«¤é¤ÏºîÀ®¤·¤¿¥×¥í¥¸¥§¥¯¥È¤ò¤â¤È¤Ë¼ÂºÝ¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ËÁȤßÂؤ¨¤Æ¤¤¤­¤Þ¤¹¡£º£²óºîÀ®¤¹¤ë¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ÏAndroidüËöÆâ¤Î¥Õ¥¡¥¤¥ë¤òÁöºº¤·¡¢ÆþÎϤµ¤ì¤¿¥­¡¼¥ï¡¼¥É¤ò¥Õ¥¡¥¤¥ë̾¤Ë´Þ¤à¥Õ¥¡¥¤¥ë¤ò°ìÍ÷ɽ¼¨¤¹¤ë¤È¤¤¤¦¤â¤Î¤Ç¤¹¡£
-Checked¤Ë¡Ötrue¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Id¤Ë¡Ö@+id/KeepRatio¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Text¤Ë¡Ö@string/keep_ratio¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout height¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout margin left¤ÈLayout margin right¤Ë¡Ö10dip¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout width¤Ë¡Öfill_parent¡×¤ò»ØÄꤷ¤Þ¤¹¡£

¡¡¿Þ2-2¤¬º£²ó¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î²èÌÌ¥¤¥á¡¼¥¸¤È¤Ê¤ê¤Þ¤¹¡£
¡¡ºÇ¸å¤Ë¤â¤¦°ì¤Ä¥Ü¥¿¥ó¤òÄɲä·¤Þ¤¹¡£

CENTER:&ref(./02_02.png,);
CENTER:¿Þ2-2~
~
~
-Id¤Ë¡Ö@+id/Save¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Text¤Ë¡Ö@string/save¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout height¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout margin left¤ÈLayout margin right¤Ë¡Ö10dip¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout width¤Ë¡Öfill_parent¡×¤ò»ØÄꤷ¤Þ¤¹¡£

¡¡Eclipse¤ÎPackage Explorer¤«¤émain.xml¤ò¥À¥Ö¥ë¥¯¥ê¥Ã¥¯¤·¤Æ³«¤­¡¢¾åµ­¥¤¥á¡¼¥¸¤Ë¤¢¤ï¤»¥ì¥¤¥¢¥¦¥È¤òÊѹ¹¤·¤Æ¤¤¤­¤Þ¤¹¡£¼«Æ°À¸À®¤µ¤ì¤¿main.xml¤Ï¿Þ2-3¤Î¤è¤¦¤Ë¡¢½ÄÊý¸þ¤ÎLinearLayout¤òºÆ¾å°Ì¤ËÃÖ¤­¡¢¤½¤³¤ËTextView¤ò1¤ÄÇÛÃÖ¤·¤¿Êª¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
¡¡°Ê¾å¤ÇÁàºîÉô¤Î¥ì¥¤¥¢¥¦¥È¤Ï´°À®¤Ç¤¹¡£´°À®¸å¤Î¥¢¥¦¥È¥é¥¤¥ó¤È¥ì¥¤¥¢¥¦¥È¥¤¥á¡¼¥¸¡Ê¿Þ3-3¡Ë¤ò²¼µ­¤Ë¼¨¤·¤Þ¤¹¡£

CENTER:&ref(./02_03.png,);
CENTER:¿Þ2-3~
|LEFT:|CENTER:|c
|¡¡LinearLayout&br;¡¡¡¡SelectImage&br;¡¡¡¡TakePhoto&br;¡¡¡¡WLayout&br;¡¡¡¡¡¡WLabel&br;¡¡¡¡¡¡WSize&br;¡¡¡¡¡¡WSuffix&br;¡¡¡¡HLayout&br;¡¡¡¡¡¡HLabel&br;¡¡¡¡¡¡HSize&br;¡¡¡¡¡¡HSuffix&br;¡¡¡¡KeepRatio&br;¡¡¡¡Save|&ref(./03_03.png,);&br;¿Þ3-3|
~
~

¡¡¥µ¥ó¥×¥ë¥×¥í¥¸¥§¥¯¥È¤Ç¤Ï¡ÖHello World, FFindActivity!¡×¤Èɽ¼¨¤¹¤ëTextView¤¬ÇÛÃÖ¤µ¤ì¤Æ¤¤¤Þ¤¹¤¬¡¢¤³¤ì¤ÏÉÔÍפȤʤë¤Î¤ÇÃæ±û¤Î¥ì¥¤¥¢¥¦¥¿¤Ç³ºÅö²Õ½ê¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤«¡¢±¦Éô¤ÎOutline¤«¤é¡ÖTextView¡×¤È¤Ê¤Ã¤Æ¤¤¤ë¹Ô¤ò¥¯¥ê¥Ã¥¯¤·¤ÆÁªÂò¤·¡¢ºï½ü¥­¡¼¤ä±¦¥¯¥ê¥Ã¥¯¤Ë¤è¤ë¥Ý¥Ã¥×¥¢¥Ã¥×¥á¥Ë¥å¡¼¤Î¡ÖDelete¡×¤òÁªÂò¤·¤Æºï½ü¤·¤Þ¤¹¡£
¡¡½Ä²èÌÌÍѤΥ쥤¥¢¥¦¥È¤òºîÀ®¤·¤Æ¤¤¤­¤Þ¤·¤ç¤¦¡£¥×¥í¥¸¥§¥¯¥ÈºîÀ®»þ¤Ë¼«Æ°À¸À®¤µ¤ì¤¿main.xml¤ò³«¤­¡¢¡ÖHello World, IResizerActivity!¡×¤È¤¤¤¦¥Æ¥­¥¹¥È¤¬ÀßÄꤵ¤ì¤¿TextView¤òºï½ü¤·¤Þ¤¹¡£

¡¡Â³¤¤¤Æº¸Éô¤ÎPalette¤«¤éLayouts¤ò¥¯¥ê¥Ã¥¯¤·¤ÆŸ³«¤·¡¢LinearLayout (Horizontal)¤òÀè¤Û¤ÉTextView¤¬¤¢¤Ã¤¿¾ì½ê¤Ë¥É¥é¥Ã¥°¡õ¥É¥í¥Ã¥×¤ÇÇÛÃÖ¤·¤Þ¤¹¡£¤³¤ì¤Ç¥Ó¥å¡¼¤ò²£Êý¸þ¤Ëʤ٤ë¤è¤¦Í½¤áÀßÄꤵ¤ì¤¿LinearLayout¤¬ºÇ¾å°Ì¤ÎLinearLayoutÇÛ²¼¤ËÄɲ䵤ì¤Þ¤¹¡£
¡¡¼¡¤Ëº¸Éô¤ÎPalette¤«¤éImages & Media¤ò¥¯¥ê¥Ã¥¯¤·¤ÆŸ³«¤·¡¢¡ÖImageView¡×¤ò¥É¥é¥Ã¥°¡õ¥É¥í¥Ã¥×¤ÇÇÛÃÖ¤·¤Þ¤¹¡Ê¤³¤ÎºÝ¤Ë¡ÖResource Chooser¡×¤È¤¤¤¦¥À¥¤¥¢¥í¥°¤¬É½¼¨¤µ¤ì¤¿¾ì¹ç¤Ï¡ÖClear¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ²¼¤µ¤¤¡Ë¡£ÇÛÃÖ¤·¤¿²èÁü¥Ó¥å¡¼¤ò¥¯¥ê¥Ã¥¯¤·¡¢¥ì¥¤¥¢¥¦¥¿²¼Éô¤Î¡ÖProperties¡×¤Ç°Ê²¼¤Î¤è¤¦¤ËÀßÄê¤òÊѹ¹¤·¤Þ¤¹¡£

¡¡¼¡¤Ë¤³¤Î¥ì¥¤¥¢¥¦¥È¤Ë¥­¡¼¥ï¡¼¥É¤òÆþÎϤ¹¤ë¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤È¸¡º÷¥Ü¥¿¥ó¤òÇÛÃÖ¤·¤Þ¤¹¡£º¸Éô¤ÎPaltette¤«¤éText Fields¤ò¥¯¥ê¥Ã¥¯¤·¤ÆŸ³«¤·¡¢¡Öabc¡×¤È½ñ¤«¤ì¤¿¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¡ÊPlain Text¡Ë¤òº£Äɲä·¤¿¥ì¥¤¥¢¥¦¥È¾å¤ËÇÛÃÖ¤·¤Þ¤¹¡£ÇÛÃÖ¤·¤¿¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤ò¥¯¥ê¥Ã¥¯¤·¡¢¥ì¥¤¥¢¥¦¥¿²¼Éô¤Î¡ÖProperties¡×¡Ê¢¨¡Ë¤Ç°Ê²¼¤Î¤è¤¦¤ËÀßÄê¤òÊѹ¹¤·¤Þ¤¹¡£~
¢¨Properties¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢Eclipse¤Î¥á¥Ë¥å¡¼¤«¤é¡ÖWindow > Show View > Other...¡×¤òÁªÂò¤·¤Æ"Show View"¥À¥¤¥¢¥í¥°¤òɽ¼¨¤·¡¢¡ÖGeneral > Properties¡×¤òÁªÂò¤·¤Æ¡ÖOK¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ²¼¤µ¤¤¡£
-Adjust view bounds¤Ë¡Ötrue¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Id¤Ë¡Ö@+id/Preview¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Scale type¤Ë¡ÖfitCenter¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout height¤Ë¡Ö0dip¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout margin¤Ë¡Ö5dip¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout weight¤Ë¡Ö1¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout width¤Ë¡Öfill_parent¡×¤ò»ØÄꤷ¤Þ¤¹¡£

-Id¤Ë¡Ö@+id/FindTarget¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout height¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout weight¤Ë¡Ö1¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout width¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Single line¤Ë¡Ötrue¡×¤ò»ØÄꤷ¤Þ¤¹¡£
¡¡¤³¤³¤ÇÀè¤Û¤ÉºîÀ®¤·¤¿ÁàºîÉô¥ì¥¤¥¢¥¦¥È¤ò¼è¤ê¹þ¤ß¤Þ¤¹¡£¥ì¥¤¥¢¥¦¥¿²¼Éô¤Ë¤¢¤ë¡Ömain.xml¡×¥¿¥Ö¤ò¥¯¥ê¥Ã¥¯¤·¤ÆXML¥¨¥Ç¥£¥¿¤òɽ¼¨¤·¡¢¾åµ­ImageView¤Î²¼¤Ë°Ê²¼¤òÄɲä·¤Þ¤¹¡£

     <include
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         layout="@layout/controller" />

¡¡¤³¤ì¤ÇÀè¤Û¤ÉºîÀ®¤·¤¿ÁàºîÉô¤Î¥ì¥¤¥¢¥¦¥È¤¬¼è¤ê¹þ¤Þ¤ì¡¢¿Þ3-1¤Î¤è¤¦¤Ê¥ì¥¤¥¢¥¦¥È¤Ë¤Ê¤ê¤Þ¤¹¡Ê¢¨¡Ë¡£~
¢¨Graphical Layout¥¿¥Ö¤Ç³Îǧ¤¹¤ë¤Ècontroller¥ê¥½¡¼¥¹¤¬Ìµ¤¤¤È¥¨¥é¡¼¤¬½Ð¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£¤³¤Î¾ì¹ç¤Ï°ìÅÙ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò¼Â¹Ô¤·¤¿¤¢¤È¤Ëmain.xml¤òÊĤ¸¡¢Eclipse¤òºÆµ¯Æ°¤¹¤ë¤ÈÀµ¾ï¤Ëɽ¼¨¤µ¤ì¤Þ¤¹¡£
~

¡¡Id¤ËÆþÎϤ·¤¿ÆâÍƤϤ³¤Î¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤Î¥ê¥½¡¼¥¹ID¤Ë¤Ê¤ê¤Þ¤¹¤¬¡¢¤³¤Î»þÅÀ¤Ç¤É¤³¤Ë¤âÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£¡Ö@+¥ê¥½¡¼¥¹¼ïÊÌ/¥ê¥½¡¼¥¹Ì¾¡×¤È¤¤¤¦µ­Ë¡¤Ï¡¢¤³¤Î¾ì¤Ç»ØÄꤷ¤¿¥ê¥½¡¼¥¹¼ïÊ̤˥꥽¡¼¥¹Ì¾¤òÄɲ乤뤳¤È¤òɽ¤·¤Þ¤¹¡£
¡¡Æ±Íͤˤ·¤Æ²£²èÌÌÍѤΥ쥤¥¢¥¦¥È¤âºîÀ®¤·¤Þ¤¹¡£¤Þ¤º¤ÏIResizer¤Îres¥Õ¥©¥ë¥À¤ò±¦¥¯¥ê¥Ã¥¯¤·¡¢¥á¥Ë¥å¡¼¤«¤é¡ÖNew > Folder¡×¤òÁªÂò¤·¡Ölayout-land¡×¥Õ¥©¥ë¥À¤òºîÀ®¤·¤Þ¤¹¡£¤³¤Î¥Õ¥©¥ë¥À¤ËÇÛÃÖ¤µ¤ì¤¿¥ì¥¤¥¢¥¦¥È¤Ï¡¢²£²èÌÌ»þ¤ËÍ¥ÀèŪ¤ËÍøÍѤµ¤ì¤Þ¤¹¡£

¡¡Layout height¤ÈLayout width¤Ï¤³¤Î¥Ó¥å¡¼¤Î¹â¤µ¤ÈÉý¤ò·èÄꤹ¤ë°À­¤Ç¡¢wrap_content¤ò»ØÄꤹ¤ë¤È¤½¤Î¥Ó¥å¡¼¼«¿È¤¬É¬ÍפȤ¹¤ë¥µ¥¤¥º¤Ë¼«Æ°Åª¤ËÄ´À°¤µ¤ì¤Þ¤¹¡£¤³¤Î¾¡¢¿Æ¤È¤Ê¤ë¥Ó¥å¡¼¤Î¥µ¥¤¥º¤Ë¥Õ¥£¥Ã¥È¤µ¤»¤ëfill_parent¡ÊAPI level 8°Ê¹ß¤Ç¤Ïmatch_parent¡Ë¤ä¡¢¥µ¥¤¥º¤òľÀÜ»ØÄꤹ¤ë¤³¤È¤¬²Äǽ¤Ç¤¹¡£~
¡¡Layout weight¤Ï¿Æ¥Ó¥å¡¼Æâ¤Ç»ÈÍѲÄǽ¤ÊÎΰè¤ò¤É¤ÎÄøÅ٤νŤߤÇÀêÍ­¤¹¤ë¤«¤ò·èÄꤹ¤ë°À­¤Ç¡¢1¤ò»ØÄꤷ¤¿¾ì¹ç¡¢Â¾¤Î¥Ó¥å¡¼¤¬ÇÛÃÖ¤µ¤ì¤¿»Ä¤ê¤ÎÎΰèÁ´¤Æ¤ò»ÈÍѤ·¤Þ¤¹¡£
¡¡layout¥Õ¥©¥ë¥À¤Ë¤¢¤ëmain.xml¤ò¥É¥é¥Ã¥°¡õ¥É¥í¥Ã¥×¤Çlayout-land¥Õ¥©¥ë¥À¤Ë¥³¥Ô¡¼¤·¡¢¤³¤ì¤ò²£²èÌÌÍѤËÊѹ¹¤·¤Æ¤¤¤­¤Þ¤¹¡£

¡¡Single line¤òtrue¤Ë¤¹¤ë¤È¡¢¤³¤Î¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤Ë¤ÏÊ£¿ô¹Ô¤ÎÆþÎϤ¬½ÐÍè¤Ê¤¯¤Ê¤ê¤Þ¤¹¡£¥Õ¥¡¥¤¥ë̾¤Î°ìÉô¤¬²þ¹Ô¤ò´Þ¤àÊ£¿ô¹Ô¤Ë¤Þ¤¿¤¬¤ë¤³¤È¤ÏÍ­¤êÆÀ¤Ê¤¤¤¿¤á¡¢¤³¤³¤Ç¤Ïtrue¤òÀßÄꤷ¤Æ¤¤¤Þ¤¹¡£
¡¡¤Þ¤º¤ÏºÇ¾å°Ì¤Ë¤¢¤ëLinearLayout¤ÎÀßÄê¤ò°Ê²¼¤Î¤è¤¦¤ËÊѹ¹¤·¤Þ¤¹¡£

¡¡°ú¤­Â³¤­¸¡º÷¥Ü¥¿¥ó¤òÄɲä·¤Þ¤¹¡£º¸Éô¤ÎPalette¤«¤éForm Widgets¤ò¥¯¥ê¥Ã¥¯¤·¤ÆŸ³«¤·¡¢¡ÖButton¡×¤ò¥É¥é¥Ã¥°¡õ¥É¥í¥Ã¥×¤Ç¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤Î±¦Â¦¤ËÇÛÃÖ¤·¤Þ¤¹¡£ÇÛÃÖ¤·¤¿¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¡¢¥ì¥¤¥¢¥¦¥¿²¼Éô¤Î¡ÖProperties¡×¤Ç°Ê²¼¤Î¤è¤¦¤ËÀßÄê¤òÊѹ¹¤·¤Þ¤¹¡£
-Orientation¤ò¡Öhorizontal¡×¤ËÊѹ¹¤·¤Þ¤¹¡£

-Id¤Ë¡Ö@+id/FindButton¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Text¤Ë¡Ö@string/find_button¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout height¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout weight¤ò¶õ¤Ë¤·¤Þ¤¹¡£
-Layout width¤Ë¡Öwrap_content¡×¤ò»ØÄꤷ¤Þ¤¹¡£
¡¡Â³¤¤¤Æ¥×¥ì¥Ó¥å¡¼ÍѤβèÁü¥Ó¥å¡¼¡ÊPreview¡Ë¤ÎÀßÄê¤ò°Ê²¼¤Î¤è¤¦¤ËÊѹ¹¤·¤Þ¤¹¡£

¡¡Layout weight¤ò¶õ¤Ë¤¹¤ë¤³¤È¤Ç¤³¤Î¥Ü¥¿¥ó¤Ïɽ¼¨¤Ë­¤ê¤ë¤À¤±¤ÎÂ礭¤µ¤ËÄ´À°¤µ¤ì¤Þ¤¹¡£
-Layout height¤ò¡Öfill_parent¡×¤ËÊѹ¹¤·¤Þ¤¹¡£

¡¡Text°À­¤Ï¤³¤Î¥Ü¥¿¥ó¤Ëɽ¼¨¤¹¤ë¥é¥Ù¥ë¤Îʸ»úÎó¤ò»ØÄꤷ¤Þ¤¹¡£@string/find_button¤È¤¤¤¦¥ê¥½¡¼¥¹ID¤Ï¤³¤ÎÃʳ¬¤Ç¤Ï¤Þ¤ÀÄêµÁ¤·¤Æ¤¤¤Ê¤¤¤¿¤á¡¢¤³¤Î¤Þ¤Þ¤Ç¤Ï¥ê¥½¡¼¥¹ID¤¬¤½¤Î¤Þ¤Þ¥Ü¥¿¥ó¤Ëɽ¼¨¤µ¤ì¤Æ¤·¤Þ¤¤¤Þ¤¹¡£
¡¡ºÇ¸å¤Ë¼è¤ê¹þ¤ó¤Àcontroller¥ì¥¤¥¢¥¦¥È¤ÎÀßÄê¤ò°Ê²¼¤Î¤è¤¦¤ËÊѹ¹¤·¤Þ¤¹¡£

¡¡Package Explorer¤«¤éstrings.xml¤ò¥À¥Ö¥ë¥¯¥ê¥Ã¥¯¤·¤Æ³«¤­¡¢Ê¸»úÎó¥ê¥½¡¼¥¹¤òÄɲä·¤Þ¤¹¡£ÉÔÍפˤʤä¿@string/helloʸ»úÎó¥ê¥½¡¼¥¹¤Ïºï½ü¤·¡¢¥ê¥¹¥È2-4¤Î¤è¤¦¤ËÊÔ½¸¤·¤Æ¤¯¤À¤µ¤¤¡£
-Layout height¤ò¡Öfill_parent¡×¤ËÊѹ¹¤·¤Þ¤¹¡£
-Layout width¤ò¡Öwrap_content¡×¤ËÊѹ¹¤·¤Þ¤¹¡£

-¥ê¥¹¥È2-4 strings.xml :
 < xml version="1.0" encoding="utf-8" >
 <resources>
 
     <string name="app_name">FFind</string>
     <string name="find_button">¸¡º÷</string>
 
 </resources>
~
¡¡°Ê¾å¤Ç²£²èÌÌÍѥ쥤¥¢¥¦¥È¤â´°À®¤Ç¤¹¡£Graphcal Layout¥¿¥Ö¤Ç¿Þ3-2¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤³¤È¤ò³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£

¡¡ºÇ¸å¤Ë¸¡º÷·ë²Ì¤òɽ¼¨¤¹¤ë¥Ó¥å¡¼¤òÄɲä·¤Þ¤¹¡£ËÜÍèɽ¼¨ÍѤȤ·¤ÆŬÀڤǤϤ¢¤ê¤Þ¤»¤ó¤¬¡¢ÀâÌÀ¤ò´Êñ¤Ë¤¹¤ë¤¿¤á¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤ò¤³¤³¤Ç¤â»ÈÍѤ·¤Þ¤¹¡£ºÆ¤ÓPalette¤«¤éText Fields¤ò¥¯¥ê¥Ã¥¯¤·¤ÆŸ³«¤·¡¢¥×¥ì¡¼¥ó¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤òFindTarget/FindButton¤Î²¼Éô¤Ë¥É¥é¥Ã¥°¡õ¥É¥í¥Ã¥×¤ÇÇÛÃÖ¤·¤Þ¤¹¡£¤³¤Á¤é¤Î¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤Î¥×¥í¥Ñ¥Æ¥£¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£

-Id¤Ë¡Ö@+id/Result¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout height¤Ë¡Öfill_parent¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout width¤Ë¡Öfill_parent¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Editable¤Ë¡Öfalse¡×¤òÀßÄꤷ¤Þ¤¹¡£
**3-2. ¥æ¡¼¥¶¡¼¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Î¼ÂÁõ [#w40a8ae8]

¡¡Layout height/Layout width¤Ëfill_parent¡ÊAPI level 8°Ê¹ß¤Ç¤Ïmatch_parent¡Ë¤ò»ØÄꤹ¤ë¤³¤È¤Ç¡¢²èÌ̤λĤê¤ò¤³¤Î¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤¬ÀêÍ­¤¹¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£~
¡¡¤³¤Î¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤Ï·ë²Ìɽ¼¨¤ò¹Ô¤¦¤À¤±¤Î¤â¤Î¤Ê¤Î¤Ç¡¢Editable¤Ëfalse¤òÀßÄꤷ¤ÆÊÔ½¸ÉÔ²Äǽ¤Ë¤·¤Æ¤¤¤Þ¤¹¡£
¡¡Á°¹à¤ÇºîÀ®¤·¤¿¥ì¥¤¥¢¥¦¥È¤ò¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤ËÈ¿±Ç¤·¡¢¥Ü¥¿¥ó¤ä¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤Ë½èÍý¤ò¼ÂÁõ¤·¤Æ¤¤¤­¤Þ¤¹¡£

¡¡¤³¤³¤Þ¤Ç¤ÇOutline¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤Ï¤º¤Ç¤¹¡£¿Æ»Ò´Ø·¸¤¬¤ª¤«¤·¤¤¾ì¹ç¡¢Outline¾å¤Ç³Æ¥Ó¥å¡¼Ì¾¤ò¥É¥é¥Ã¥°¡õ¥É¥í¥Ã¥×¤¹¤ë¤³¤È¤ÇÄ´À°¤¬½ÐÍè¤Þ¤¹¡£
¡¡IResizerActivity.java¤ò³«¤­¡¢IResizerActivity¤Ë°Ê²¼¤Î¥á¥ó¥ÐÊÑ¿ô¤òÄɲä·¤Þ¤¹¡£

¡¡¡¦LinearLayout~
¡¡¡¡¡¦linearLayout1~
¡¡¡¡¡¡¡¦FindTarget~
¡¡¡¡¡¡¡¦FindButton~
¡¡¡¡¡¦Result
     private ImageView mPreview;
     private EditText mWSize;
     private EditText mHSize;
 
     private Bitmap mBitmap = null;
     private int mOrgW = 0;
     private int mOrgH = 0;

¡¡ImageView¤ÈEditText¡¢Bitmap¥¯¥é¥¹¤òÍøÍѲÄǽ¤Ë¤¹¤ë¤¿¤á¤Ë¤Ï¥Ñ¥Ã¥±¡¼¥¸¤Îimport¤¬É¬Íפˤʤê¤Þ¤¹¡£Eclipse¤Î¥¨¥Ç¥£¥¿¤Ç¥¯¥é¥¹Ì¾¤Î¾å¤Ë¥Þ¥¦¥¹¥«¡¼¥½¥ë¤òÃÖ¤­¡¢¿Þ3-4¤Î¤è¤¦¤Ê¥Ý¥Ã¥×¥¢¥Ã¥×¥á¥Ë¥å¡¼¤¬É½¼¨¤µ¤ì¤¿¤é¡Öimport 'ImageView' (android.widget)¡×¹Ô¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¼«Æ°Åª¤Ë¤½¤Î¥¯¥é¥¹¤Î¥Ñ¥Ã¥±¡¼¥¸import¤¬ÁÞÆþ¤µ¤ì¤Þ¤¹¡£

¡¡°Ê¾å¤Ç¥ì¥¤¥¢¥¦¥ÈºîÀ®¤Ï´°Î»¤Ç¤¹¡£¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò¼Â¹Ô¤·¤Æ¡¢ºîÀ®¤·¤¿¥ì¥¤¥¢¥¦¥È¤¬È¿±Ç¤µ¤ì¤Æ¤¤¤ë¤«¤ò³Îǧ¤·¤Æ²¼¤µ¤¤¡£
CENTER:&ref(./03_04.png,);
CENTER:¿Þ3-4~
~
~

**2-4. ¸¡º÷½èÍý¤Î¼ÂÁõ [#hf8cfb80]
¡¡mBitmap¡¢mOrgW¤ÈmOrgH¤Î»°¤Ä¤Î¥á¥ó¥ÐÊÑ¿ô¤Ï¾¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤«¤é¼èÆÀ¤·¤¿²èÁü¤È¤½¤Î¥µ¥¤¥º¤òÊÝ»ý¤¹¤ë¤¿¤á¤Îʪ¤Ç¤¹¡£

¡¡¤³¤³¤«¤é¤ÏAndroid¤Î¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤òÁöºº¤·¡¢»ØÄê¤Î¥­¡¼¥ï¡¼¥É¤ò»ý¤Ä¥Õ¥¡¥¤¥ë¤ò¥ê¥¹¥È¥¢¥Ã¥×¤¹¤ë½èÍý¤ò¼ÂÁõ¤·¤Þ¤¹¡£
¡¡Â³¤¤¤Æ¡¢¤³¤Î¥¯¥é¥¹¤Ç³Æ¥Ü¥¿¥ó¤Î¥¯¥ê¥Ã¥¯½èÍý¤ò¹Ô¤¦¤¿¤áandroid.view.View¤Îimport¤ÈView.OnClickListener¤Îimplements¤òÄɲä·¤Þ¤¹¡£

¡¡Package Explorer¤ÇFFindActivity.java¤ò¥À¥Ö¥ë¥¯¥ê¥Ã¥¯¤·¤Æ³«¤­¡¢onCreate¥á¥½¥Ã¥É¤Î¸å¤Ë°Ê²¼¤Îprivate¥á¥½¥Ã¥É¤òÄɲä·¤Þ¤¹¡£
 import android.view.View;
 
 public class IResizerActivity extends Activity implements View.OnClickListener {

-¥ê¥¹¥È2-5 :
 private void listFile(String target, String folder, ArrayList<String> list) {
      File f = new File(folder);
      File fl[] = f.listFiles();
      if (fl != null) {
          for (int i = 0; i < fl.length; ++i) {
               if (list.size() == 5000) {
                    break;
               }
¡¡onCreate¥á¥½¥Ã¥É¤Î¸å¤ËonClick¥á¥½¥Ã¥É¤ÈÆó¤Ä¤Îprivate¥á¥½¥Ã¥É¤òÄɲä·¤Þ¤¹¡Ê¥ê¥¹¥È3-1¡Ë¡£onClick¥á¥½¥Ã¥É¤Î½èÍý¤Ï¸å¤Û¤É¼ÂÁõ¤¹¤ë¤¿¤á¡¢¶õ¤Î¤Þ¤Þ¤Ë¤·¤Æ¤ª¤­¤Þ¤¹¡£

-¥ê¥¹¥È3-1 : 
 @Override
 publiic void onClick(View view) {
 }
 
               File tmp = fl[i];
               String name = tmp.getName();
               if (name.contains(target) == true) {
                   list.add(name);
               }
               if (tmp.isDirectory() == true) {
                    try {
                         String c = tmp.getAbsolutePath();
                         if (c.equals(tmp.getCanonicalPath()) == true) {
                             if (c != null) {
                                 listFile(target, c, list);
                             }                               
                        }
                    }
                    catch (Exception e) {
                         e.printStackTrace();
                    }
               }
          }
      }
 private void setupUI() {
     setContentView(R.layout.main);
 
     Button button;
     button = (Button) findViewById(R.id.SelectImage);
     button.setOnClickListener(this);
 
     button = (Button) findViewById(R.id.TakePhoto);
     button.setOnClickListener(this);
 
     button = (Button) findViewById(R.id.Save);
     button.setOnClickListener(this);
 
     mPreview = (ImageView) findViewById(R.id.Preview);
     mWSize = (EditText) findViewById(R.id.WSize);
     mHSize = (EditText) findViewById(R.id.HSize);
     setPreview();
     
     mWSize.setOnFocusChangeListener(new View.OnFocusChangeListener() {
         @Override
         public void onFocusChange(View v, boolean flag) {
             if (flag == false) {
                 CheckBox keepRatio = (CheckBox) findViewById(R.id.KeepRatio);
                 if (keepRatio.isChecked() == true) {
                     String base = mWSize.getText().toString().trim();
                     if ((base.equals("") == false)
                             && (mOrgW != 0) && (mOrgH != 0)) {
                         double h = 0;
                         double w = Integer.parseInt(base);
                         double ratio = (double) mOrgH / (double) mOrgW;
                         h = new BigDecimal(w * ratio).setScale(0, BigDecimal.ROUND_HALF_UP).doubleValue();
                         if (h < 1.0) {
                             h = 1.0;
                         }
                         mHSize.setText(String.valueOf((int) h));
                     }
                 }
             }
         }
     });
     mHSize.setOnFocusChangeListener(new View.OnFocusChangeListener() {
         @Override
         public void onFocusChange(View v, boolean flag) {
             if (flag == false) {
                 CheckBox keepRatio = (CheckBox) findViewById(R.id.KeepRatio);
                 if (keepRatio.isChecked() == true) {
                     String base = mHSize.getText().toString().trim();
                     if ((base.equals("") == false)
                             && (mOrgW != 0) && (mOrgH != 0)) {
                         double w = 0;
                         double h = Integer.parseInt(base);
                         double ratio = (double) mOrgW / (double) mOrgH;
                         w = new BigDecimal(w * ratio).setScale(0, BigDecimal.ROUND_HALF_UP).doubleValue();
                         if (w < 1.0) {
                             w = 1.0;
                         }
                         mWSize.setText(String.valueOf((int) w));
                     }
                 }
             }
         }
     });
 }
 
 private void setPreview() {
     if (mBitmap != null) {
         mOrgW = mBitmap .getWidth();
         mOrgH = mBitmap .getHeight();
         mWSize.setText(String.valueOf(mOrgW));
         mHSize.setText(String.valueOf(mOrgH));
         mPreview.setImageBitmap(mBitmap);
     }
 }
~

¡¡¤³¤Î¥á¥½¥Ã¥É¤Ïfolder¤Ç»ØÄꤵ¤ì¤¿¥Õ¥©¥ë¥À¤Î¥Õ¥¡¥¤¥ë°ìÍ÷¤ò¼èÆÀ¤·¡¢target¤Ç»ØÄꤵ¤ì¤¿¥­¡¼¥ï¡¼¥É¤Ë°ìÃפ¹¤ëʪ¤¬¤¢¤ì¤Ðlist¤ËÄɲäò¹Ô¤¦ºÆµ¢Åª¥á¥½¥Ã¥É¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡Ê¸¡º÷·ë²Ì¤ÏºÇÂç5000·ï¤Þ¤Ç¤È¤·¤Æ¤¤¤Þ¤¹¡Ë¡£File¥¯¥é¥¹¤ÎlistFiles¥á¥½¥Ã¥É¤Ç°ìÍ÷¤ò¼èÆÀ¤·¡¢¥ê¥¹¥È¤Î³Æ¥Õ¥¡¥¤¥ë¤Ë¤Ä¤¤¤ÆgetName¤Ç¼èÆÀ¤·¤¿¥Õ¥¡¥¤¥ë̾¤ò¥Á¥§¥Ã¥¯¤·¡¢target¤¬´Þ¤Þ¤ì¤Æ¤¤¤ì¤Ð¥ê¥¹¥È¤ËÄɲ䷤Ƥ¤¤Þ¤¹¡£~
¡¡isDirectory¥á¥½¥Ã¥É¤Ç¥Õ¥©¥ë¥À¤Ç¤¢¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤·¡¢¥Õ¥©¥ë¥À¤Ç¤¢¤ì¤ÐƱ¥Õ¥¡¥¤¥ë¤ÎÀäÂХѥ¹¤òÂоݤȤ·¤ÆlistFile¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤·¤Æ¤¤¤Þ¤¹¤¬¡¢getCanonicalPath¥á¥½¥Ã¥É¤È¤ÎÈæ³Ó¤¬false¤È¤Ê¤Ã¤¿¾ì¹ç¤Ïsymbolic link¤ÈȽÃǤ·¡¢ºÆµ¢¸Æ¤Ó½Ð¤·¤ò¹Ô¤Ê¤Ã¤Æ¤¤¤Þ¤»¤ó¡£
¡¡setupUI¥á¥½¥Ã¥É¤Ç¤Ï¤Þ¤º¡¢setContentView¤Çmain¥ì¥¤¥¢¥¦¥È¤ò¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤ËÀßÄꤷ¤¿¤¢¤È¡¢¡Ö²èÁü¤òÁªÂò¡×¡Ö¼Ì¿¿¤ò»£±Æ¡×¡ÖÊݸ¡×¥Ü¥¿¥ó¤òfindViewById¤Ç¼èÆÀ¤·¡¢¤³¤Î¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤òOnClickListener¤È¤·¤ÆÅÐÏ¿¤·¤Æ¤¤¤Þ¤¹¡£

¡¡¤³¤³¤Ç»ÈÍѤ·¤Æ¤¤¤ëFile¥¯¥é¥¹¤ÈArrayList¥¯¥é¥¹¤òÍøÍѲÄǽ¤Ë¤¹¤ë¤¿¤á¡¢Î¾¥Ñ¥Ã¥±¡¼¥¸¤òandroid.app.Activity¤ÎÁ°¤Ç¥¤¥ó¥Ý¡¼¥È¤·¤Þ¤¹¡£
¡¡Â³¤¤¤Æ²èÁü¥×¥ì¥Ó¥å¡¼ÍѤÎImageView¡¢²£/½Ä¥µ¥¤¥ºÆþÎÏÍÑEditText¤ò¼èÆÀ¤·¤ÆÊÝ»ý¤·¤Æ¤ª¤­¡¢setPreview¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤·¤Æ¤¤¤Þ¤¹¡£setPreview¥á¥½¥Ã¥É¤Ç¤Ï¾¤Î¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤«¤é¼õ¤±¼è¤Ã¤¿²èÁü¤¬¤¢¤ë¾ì¹ç¡¢²èÁü¥×¥ì¥Ó¥å¡¼ÍѤÎImageView¤ËÀßÄꤷ¡¢¥ª¥ê¥¸¥Ê¥ë²èÁü¥µ¥¤¥º¤òÊÝ»ý¤·¤Æ¤¤¤Þ¤¹¡£

 import java.io.File;
 import java.util.ArrayList;
¡¡¤½¤Î¸å²£/½Ä¥µ¥¤¥ºÆþÎÏÍÑEditText¤½¤ì¤¾¤ì¤ËOnFocusChangeListener¤òÅÐÏ¿¤·¤Æ¤¤¤Þ¤¹¡£¤³¤³¤Ç¤Ï¡ÖÈæΨ¤ò°Ý»ý¡×¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤¬¥Á¥§¥Ã¥¯¤µ¤ì¤Æ¤¤¤¿¾ì¹ç¤Ë¡¢¥ê¥µ¥¤¥º¸å¤Î½Ä²£Èæ¤ò²Äǽ¤Ê¸Â¤ê°Ý»ý¤¹¤ë¤¿¤á¤Î¼«Æ°·×»»½èÍý¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£~
¡¡onFocusChange¤Ï¤½¤Î¥¦¥£¥¸¥§¥Ã¥È¤Î¥Õ¥©¡¼¥«¥¹¾õÂÖ¤¬Êѹ¹¤µ¤ì¤ëºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¥á¥½¥Ã¥É¤Ç¡¢°ú¿ôflag¤¬false¤Î¾ì¹ç¤Ï¥Õ¥©¡¼¥«¥¹¤ò¼º¤Ã¤¿¤³¤È¤ò¼¨¤·¤Þ¤¹¡£¤³¤Î¥¿¥¤¥ß¥ó¥°¤Ç¡¢ÆþÎϤµ¤ì¤¿Ãͤ˥ª¥ê¥¸¥Ê¥ë²èÁü¥µ¥¤¥º¤«¤é»»½Ð¤µ¤ì¤¿ÈæΨ¤ò³Ý¤±¡¢»Í¼Î¸ÞÆþ¤·¤¿Êª¤ò¤â¤¦°ìÊý¤Î¥µ¥¤¥º¤È¤·¤ÆÀßÄꤷ¤Æ¤¤¤Þ¤¹¡£·×»»·ë²Ì¤¬0¤Ë¤Ê¤ë¤³¤È¤â¤¢¤ê¤Þ¤¹¤¬¡¢¤³¤Î¾ì¹ç¤Ï1¤Ç¾å½ñ¤­¤¹¤ë¤³¤È¤ÇºÇÄã¸Â¤Î²èÁü¥µ¥¤¥º¤ò³ÎÊݤ·¤Æ¤¤¤Þ¤¹¡£

¡¡¼¡¤Ë¡¢¸¡º÷·ë²Ì¤ò³ÊǼ¤¹¤ë¤¿¤á¡¢onCreate¥á¥½¥Ã¥É¤ÎľÁ°¤Ç°Ê²¼¤Î¥á¥ó¥ÐÊÑ¿ô¤òÄɲä·¤Þ¤¹¡£ArrayList¤Ï»ØÄꥯ¥é¥¹¤Î¥ª¥Ö¥¸¥§¥¯¥È¤òÍ×ÁǤ˻ý¤ÄÇÛÎó¥ê¥¹¥È¤Î¥Æ¥ó¥×¥ì¡¼¥È¥¯¥é¥¹¤Ç¤¹¡£
¡¡»Í¼Î¸ÞÆþ¤Ç»ÈÍѤ·¤¿BigDecimal¤È¡ÖÈæΨ¤ò°Ý»ý¡×¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤òÊÝ»ý¤¹¤ë¤¿¤á¤ÎCheckBox¤òÍøÍѲÄǽ¤È¤¹¤ë¤¿¤á¡¢¼¡¤Îimport¹Ô¤òÄɲä·¤Þ¤¹¡£

 private ArrayList<String> mList;
 import java.math.BigDecimal;
 
 import android.widget.CheckBox;

¡¡onCreate¤ÎsetContentView¸Æ¤Ó½Ð¤·¸å¤Ë¤³¤ÎÇÛÎó¥ê¥¹¥È¤òÀ¸À®¤·¡¢¸¡º÷¥Ü¥¿¥ó¤Î½èÍý¤ò¼ÂÁõ¤·¤Þ¤¹¡Ê¥ê¥¹¥È2-6¡Ë¡£
¡¡°Ê¾å¤ÎºîÀ®¤¬´°Î»¤·¤¿¤é¡¢¼«Æ°À¸À®¤µ¤ì¤¿onCreate¤ò°Ê²¼¤Î¤è¤¦¤ËÊѹ¹¤·¤Þ¤¹¡Ê¥ê¥¹¥È3-2¡Ë¡£

-¥ê¥¹¥È2-6 :
 mList = new ArrayList<String>();
 
 Button button = (Button) findViewById(R.id.FindButton);
 if (button != null) {
      button.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               if (view.getId() == R.id.FindButton) {
                    EditText text;
                    text = (EditText) findViewById(R.id.FindTarget);
                    String target = text.getText().toString();
                    if (target.equals("") != true) {
                        mList.clear();
                        listFile(target, "/", mList);
                        if (mList.size() > 0) {
                            String tmp = "";
                            for (int i = 0; i < mList.size(); ++i) {
                                tmp += mList.get(i) + "\n";
                            }
                            text = (EditText) findViewById(R.id.Result);
                            text.setText(tmp);
                        }
                    }
               }
           }
      });
-¥ê¥¹¥È3-2 : 
 /** Called when the activity is first created. */
 @Override
 publiic void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     requestWindowFeature(Window.FEATURE_NO_TITLE);
     setupUI();
 }
~

¡¡findViewById¥á¥½¥Ã¥É¤Ï¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤ä¥Ó¥å¡¼¤¬»ý¤Ã¤Æ¤¤¤ë»Ò¥Ó¥å¡¼¤ò¥ê¥½¡¼¥¹ID¤Ç¸¡º÷¤·¤ÆÊÖ¤¹¥á¥½¥Ã¥É¤Ç¡¢¤³¤³¤Ç¤Ï¡ÖR.id.FindButton¡×¤ò»ØÄꤷ¤Æ¸¡º÷¥Ü¥¿¥ó¤ò¼èÆÀ¤·¤Æ¤¤¤Þ¤¹¡£~
¡¡¥Ü¥¿¥ó¤Î¼èÆÀ¤ËÀ®¸ù¤·¤¿¾ì¹ç¡¢setOnClickListener¥á¥½¥Ã¥É¤Ç¥¯¥ê¥Ã¥¯»þ¤Ë¼Â¹Ô¤µ¤ì¤ë½èÍý¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£¤³¤³¤Ç¤Ï̵̾¤Î¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¥¯¥é¥¹¤òÀ¸À®¤·¡¢Æ±¥á¥½¥Ã¥É¤Î°ú¿ô¤ËÅϤ·¤Æ¤¤¤Þ¤¹¡£
¡¡¸µ¡¹¤Î¥³¡¼¥É¤Ç¤Ï¤³¤³¤ÇľÀÜsetContentView¤ò¸Æ¤Ó½Ð¤·¤Æ¤¤¤Þ¤·¤¿¤¬¡¢¤³¤ì¤òsetupUI¸Æ¤Ó½Ð¤·¤ËÊѹ¹¤·¤Æ¤¤¤Þ¤¹¡£¤Þ¤¿¡¢requestWindowFeature¥á¥½¥Ã¥É¤ËWindow.FEATURE_NO_TITLE¤òÅϤ·¤Æ¸Æ¤Ó½Ð¤¹¤³¤È¤Ë¤è¤ê¡¢¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤Î¥¿¥¤¥È¥ë¥Ð¡¼¤òÈóɽ¼¨¤Ë¤·¤Æ¤¤¤Þ¤¹¡£¿Þ3-5º¸¤¬¥¿¥¤¥È¥ë¥Ð¡¼¤òɽ¼¨¡¢±¦¤¬Èóɽ¼¨¤È¤·¤¿¤â¤Î¤Ç¤¹¡£

¡¡onClick¤¬¼ÂºÝ¤Ë¥Ü¥¿¥ó¤Î½èÍý¤ò¼ÂÁõ¤¹¤ë¥á¥½¥Ã¥É¤Ë¤Ê¤ê¤Þ¤¹¡£¤³¤Î¥á¥½¥Ã¥É¤Ë¤Ï¥¯¥ê¥Ã¥¯¤ò°ú¤­µ¯¤³¤·¤¿¥Ó¥å¡¼¤¬°ú¿ô¤È¤·¤ÆÅϤµ¤ì¤ë¤¿¤á¡¢getId¥á¥½¥Ã¥É¤Ç¼èÆÀ¤·¤¿¥ê¥½¡¼¥¹ID¤¬¸¡º÷¥Ü¥¿¥ó¤Îʪ¤Ç¤¢¤ë¤«¤ò¥Á¥§¥Ã¥¯¤·¡¢¸¡º÷½èÍý¤ò¹Ô¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£~
¡¡¸¡º÷½èÍý¤Ç¤ÏFindTarget¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤«¤égetText¥á¥½¥Ã¥É¤Ç¼èÆÀ¤·¤¿ÆâÍƤò¥­¡¼¥ï¡¼¥É¤Ë¡¢¥ë¡¼¥È¥Õ¥©¥ë¥À¤ò¸¡º÷¥Õ¥©¥ë¥À¤Ë»ØÄꤷ¤ÆlistFile¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤·¤Æ¤¤¤Þ¤¹¡£¥­¡¼¥ï¡¼¥É¤¬¶õ¤Î¾ì¹ç¤Ï¸¡º÷¤ò¼Â¹Ô¤»¤º¡¢¤Þ¤¿¸¡º÷Á°¤Ë·ë²Ì¥ê¥¹¥È¤ò¥¯¥ê¥¢¤·¤Æ¤¤¤ëÅÀ¤Ë¤âÃí°Õ¤·¤Æ²¼¤µ¤¤¡£

¡¡ºÇ¸å¤Ë·ë²Ì¥ê¥¹¥È¤ÎÆâÍƤò¥Á¥§¥Ã¥¯¤·¡¢¶õ¤Ç¤Ê¤±¤ì¤Ð¥ê¥¹¥È¤ÎÆâÍƤòResult¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤Ë¥»¥Ã¥È¤·¤Þ¤¹¡£

¡¡°Ê¾å¤Ç¼ÂÁõ¤Ï´°Î»¤Ç¤¹¡£Áᮼ¹Ԥ·¤Æ¤ß¤Þ¤·¤ç¤¦¡£
CENTER:&ref(./03_05.png,);
CENTER:¿Þ3-5~
~
~

**2-5. ANRÌäÂê¤È¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥Þ¥ë¥Á¥¹¥ì¥Ã¥É²½ [#y84bfe9d]
¡¡¤³¤³¤Þ¤Ç¤Ç°ìÅÙ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò¼Â¹Ô¤·¤Æ¤ß¤Þ¤·¤ç¤¦¡£AndroidüËö¤ò·¹¤±¤Æ¡¢½Ä²èÌÌɽ¼¨¤È²£²èÌÌɽ¼¨¤òÀÚ¤êÂؤ¨¤Æ¤ß¤Æ²¼¤µ¤¤¡£¥¨¥ß¥å¥ì¡¼¥¿¤Ç¼Â¹Ô¤·¤Æ¤¤¤ë¾ì¹ç¤ÏCtrl+F12¤Ç½Ä²£ÀÚÂؤò¹Ô¤¦¤³¤È¤¬½ÐÍè¤Þ¤¹¡ÊWindows¤Î¾ì¹ç¡Ë¡£

¡¡Á°¹à¤Ç´°À®¤·¤¿¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤¹¤¬¡¢¸¡º÷·ë²Ì¤¬Â¿¤¯¤Ê¤ë¤È¿Þ2-4¤Î¤è¤¦¤Ê¥¨¥é¡¼¤¬È¯À¸¤·¤ÆÍî¤È¤µ¤ì¤Æ¤·¤Þ¤¦¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£

CENTER:&ref(./02_04.png,);
CENTER:¿Þ2-4~
~
~
**3-3. ¥¤¥ó¥Æ¥ó¥È¤Ë¤è¤ë³°Éô¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤· [#h775ca68]

¡¡¤³¤ì¤ÏANR¡ÊApplication Not Responding¡Ë¤È¸Æ¤Ð¤ì¡¢Android¤Î¥Ý¥ê¥·¡¼¤Ë¤è¤êȯÀ¸¤¹¤ë¸½¾Ý¤Ç¤¹¡£
¡¡¤³¤³¤«¤é¤Ï¡Ö²èÁü¤òÁªÂò¡×¥Ü¥¿¥ó¤È¡Ö¼Ì¿¿¤ò»£±Æ¡×¥Ü¥¿¥ó¤Î½èÍý¤ò¼ÂÁõ¤·¡¢¥¤¥ó¥Æ¥ó¥È¤Ç³°Éô¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò¸Æ¤Ó½Ð¤¹¼ê½ç¤ò²òÀ⤷¤Þ¤¹¡£

¡¡Android¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ÏÄ̾Æä˲¿¤â°Õ¼±¤»¤º¤ËºîÀ®¤·¤¿¾ì¹ç¡¢UI¤ÎÉÁ²è¤ò´Þ¤àÁ´¤Æ¤Î½èÍý¤¬¥á¥¤¥ó¥¹¥ì¥Ã¥É¤È¸Æ¤Ð¤ì¤ëñ°ì¤Î¥¹¥ì¥Ã¥É¤ÇÆ°ºî¤·¤Þ¤¹¡£°ìÊý¤Ç¡¢Android¤Ï¤³¤Î¥á¥¤¥ó¥¹¥ì¥Ã¥É¤¬5Éðʾå±þÅú¤·¤Ê¤¤¾ì¹ç¡¢Àè¤ÎANR¤ò°ú¤­µ¯¤³¤·¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò¶¯À©Åª¤Ë½ªÎ»¤µ¤»¤è¤¦¤È¤·¤Þ¤¹¡£
¡¡¤Þ¤º¤Ï³°Éô¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Ë»ÈÍѤ¹¤ëÆó¤Ä¤ÎÄê¿ô¤È¡¢¥«¥á¥é¤«¤é¤Î¥Ç¡¼¥¿¼õ¤±¼è¤ê¤Ë»ÈÍѤ¹¤ë¥á¥ó¥ÐÊÑ¿ô¤òIResizerActivity¥¯¥é¥¹¤ËÄɲä·¤Þ¤¹¡£

¡¡Android¤Ï¸µ¡¹¥¹¥Þ¡¼¥È¥Õ¥©¥óÍѤÎOS¤È¤·¤Æ³«È¯¤µ¤ì¤¿¤¿¤á¡¢¥·¥¹¥Æ¥àÁ´ÂΤΥ쥹¥Ý¥ó¥¹¤òÂè°ì¤Ë¹Í¤¨¤ÆÀ߷פµ¤ì¤Æ¤¤¤Þ¤¹¡£¤³¤Î¤¿¤á¡¢Ä¹»þ´Ö±þÅú¤ò»ß¤á¤Æ¤·¤Þ¤¦¤è¤¦¤Ê¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ïµö¤µ¤ì¤Þ¤»¤ó¡£²¾¤Ë¤½¤Î¤è¤¦¤Ê¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤¿¾ì¹ç¤Ç¤â¡¢¥·¥¹¥Æ¥à¦¤Ç¶¯À©Åª¤Ë»ß¤á¤é¤ì¤ë¤è¤¦¤Ë¤¹¤ë¤³¤È¤Ç¡¢ÅÅÏ䬤«¤«¤Ã¤Æ¤­¤¿¤Î¤Ë½Ð¤é¤ì¤Ê¤¤¡¢¤È¤¤¤Ã¤¿Ã×̿Ū¤ÊÌäÂ꤬µ¯¤­¤Ê¤¤¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤Î¤Ç¤¹¡£
 public static final int REQUEST_SELECT_IMAGE = 1234;
 public static final int REQUEST_TAKE_PHOTO = 1235;
 
 private Uri mUriFromCamera;

¡¡¤Þ¤¿¥¢¥×¥ê¥±¡¼¥·¥ç¥óñÂΤǹͤ¨¤Æ¤â¡¢¥á¥¤¥ó¥¹¥ì¥Ã¥É¤Ë»þ´Ö¤Î¤«¤«¤ë½èÍý¤ò¹Ô¤ï¤»¤ë¤È¡Ö¥Ü¥¿¥ó¤ò²¡¤·¤Æ¤âÈ¿±þ¤¬Ìµ¤¤¡×¡ÖĹ»þ´Ö²èÌ̤¬¸Ç¤Þ¤ë¡×¤È¤¤¤Ã¤¿°õ¾Ý¤ò¥æ¡¼¥¶¡¼¤ËÍ¿¤¨¤«¤Í¤Ê¤¤¤Î¤ÇÈò¤±¤ë¤Ù¤­¤Ç¤·¤ç¤¦¡£
¡¡Â³¤¤¤ÆÁ°¹à¤ÇÄɲä·¤¿onClick¥á¥½¥Ã¥É¤ò°Ê²¼¤Î¤è¤¦¤ËÊѹ¹¤·¤Þ¤¹¡Ê¥ê¥¹¥È3-3¡Ë¡£

¡¡¤³¤¦¤·¤¿ÌäÂê¤òÈò¤±¤ë¤¿¤á¡¢»þ´Ö¤Î¤«¤«¤ë½èÍý¤Ï¥á¥¤¥ó¥¹¥ì¥Ã¥É¤È¤ÏʬΥ¤·¡¢¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¤Ç¼Â¹Ô¤¹¤ëɬÍפ¬½Ð¤Æ¤­¤Þ¤¹¡£¤½¤³¤Ç¤³¤³¤«¤é¤ÏÀè¤Û¤ÉºîÀ®¤·¤¿¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò¡¢¥¯¥ê¥Ã¥¯»þ¤Ë¹Ô¤¦½èÍý¤òÊÌ¥¹¥ì¥Ã¥É¤Ç¼Â¹Ô¤¹¤ë¤è¤¦½¤Àµ¤·¤Æ¤¤¤­¤Þ¤¹¡£¥ê¥¹¥È2-7¤¬onClickÆâ¤Î½èÍý¤òÊÌ¥¹¥ì¥Ã¥É²½¤·¤¿Êª¤Ë¤Ê¤ê¤Þ¤¹¡£

-¥ê¥¹¥È2-7 :
 public void onClick(View view) {
     if (view.getId() == R.id.FindButton) {
          Thread t = new Thread() {
               @Override
               public void run() {
                  EditText text;
                  text = (EditText) findViewById(R.id.FindTarget);
                  String target = text.getText().toString();
                  if (target.equals("") != true) {
                       mList.clear();
                      listFile(target, "/", mList);
                      if (mList.size() > 0) {
                          String tmp = "";
                          for (int i = 0; i < mList.size(); ++i) {
                               tmp += mList.get(i) + "\n";
                          }
                          text = (EditText) findViewById(R.id.Result);
                          text.setText(tmp);
                      }
                  }
               }
          };
          t.start();
-¥ê¥¹¥È3-3 : 
 @Override
 publiic void onClick(View view){
     int id = view.getId();
 
     switch (id) {
     case R.id.SelectImage:
         selectImage();
         break;
 
     case R.id.TakePhoto:
         takePhoto();
         break;
     }
 }
~

¡¡onClick¤ÇFindButton¤«¤É¤¦¤«³Îǧ¤·¤¿¸å¡¢Thread¥¯¥é¥¹¤Î¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤·¡¢¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤¿run¥á¥½¥Ã¥É¤ÎÃæ¤Ë¸¡º÷½èÍý¤ò°Ü¤·¤Æ¤¤¤Þ¤¹¡£¥¹¥ì¥Ã¥É¤Îstart¥á¥½¥Ã¥É¤Ë¤è¤êÊÌ¥¹¥ì¥Ã¥É¤¬³«»Ï¤µ¤ì¤Æ¡¢run¥á¥½¥Ã¥É¤¬¤½¤³¤Ç¼Â¹Ô¤µ¤ì¤Þ¤¹¡£~
¡¡»þ´Ö¤Î¤«¤«¤ë½èÍý¤¬ÊÌ¥¹¥ì¥Ã¥É¤Ë°ÜÆ°¤·¤¿¤¿¤á¡¢¸¡º÷¥Ü¥¿¥ó¤ò²¡¤¹¤È¤¹¤°²èÌÌÁàºî¤¬¹Ô¤¨¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£¤·¤«¤·¡¢Android¤Ç¤ÏUI¤Ë´Ø¤ï¤ëÉÁ²è½èÍý¤Ï¥á¥¤¥ó¥¹¥ì¥Ã¥É¤Ç¤·¤«¹Ô¤¨¤Ê¤¤¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤¿¤á¡¢Result¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤Ë·ë²Ì¤ò¥»¥Ã¥È¤¹¤ëºÝ¤Ë¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥¨¥é¡¼¤¬µ¯¤­¤Æ¤·¤Þ¤¤¤Þ¤¹¡Ê¿Þ2-5¡Ë¡£
¡¡°ú¿ô¤ËÅϤµ¤ì¤¿view¤«¤égetId¥á¥½¥Ã¥É¤ÇID¤ò¼èÆÀ¤·¡¢¡Ö²èÁü¤òÁªÂò¡×¥Ü¥¿¥ó¤Ç¤¢¤ì¤ÐselectImage¡¢¡Ö¼Ì¿¿¤ò»£±Æ¡×¥Ü¥¿¥ó¤Ç¤¢¤ì¤ÐtakePhoto¥á¥½¥Ã¥É¤Î¸Æ¤Ó½Ð¤·¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£

CENTER:&ref(./02_05.png,);
CENTER:¿Þ2-5~
~
~
¡¡¤³¤ì¤é¤Î¥á¥½¥Ã¥É¤Ç»ÈÍѤ¹¤ëʸ»úÎó¥ê¥½¡¼¥¹¤òÄɲ䷤Ƥª¤­¤Þ¤¹¡£strings.xml¤ò³«¤­°Ê²¼¤òÄɲ䷤Ʋ¼¤µ¤¤¡£

¡¡»þ´Ö¤Î¤«¤«¤ë½èÍý¤ÏÊÌ¥¹¥ì¥Ã¥É¤Ç¹Ô¤ï¤»¤Ä¤Ä¡¢½èÍý¤¬´°Î»¤·¤¿¸å¤ÎÉÁ²è½èÍý¤ò¥á¥¤¥ó¥¹¥ì¥Ã¥É¤Ç¼Â¹Ô¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£¤³¤ì¤Ë¤Ï¤¤¤¯¤Ä¤«¤Î²ò·èË¡¤¬¤¢¤ê¤Þ¤¹¤¬¡¢¤³¤³¤Ç¤ÏHandler¥¯¥é¥¹¤Îpost¥á¥½¥Ã¥É¤ò»ÈÍѤ·¤Þ¤¹¡£~
¡¡Handler¥¯¥é¥¹¤òÍøÍѲÄǽ¤Ë¤¹¤ë¤¿¤á¡¢android.os.Bundle¤Î¥¤¥ó¥Ý¡¼¥È¹Ô¤Î¸å¤Ë°Ê²¼¤òÄɲä·¤Þ¤¹¡£
      <string name="app_notfound">Âбþ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡£</string>

 import android.os.Handler;
¡¡¥ê¥¹¥È3-4¤¬selectImage¥á¥½¥Ã¥É¤Ë¤Ê¤ê¤Þ¤¹¡£Intent¡¢AlertDialog¡¢DialogInterface¤òÍøÍѤ¹¤ë¤¿¤á¥Ñ¥Ã¥±¡¼¥¸¤Îimport¤â˺¤ì¤º¤Ë¹Ô¤Ê¤Ã¤Æ²¼¤µ¤¤¡£

¡¡FFindActivity¤Îprivate¥á¥ó¥Ð¤Ë·ë²Ìɽ¼¨ÍѤÎString¤ÈHandler¥¯¥é¥¹¤òÄɲä·¤Þ¤¹¡£

 private String mResult;
 private Handler mHandler = new Handler();

¡¡onClick¤Î¤¦¤ÁUI¤òÁàºî¤¹¤ëɬÍפ¬¤¢¤ë²Õ½ê¤ò½¤Àµ¤·¤Þ¤¹¡Ê¥ê¥¹¥È2-8¡Ë¡£

-¥ê¥¹¥È2-8 :
 public void onClick(View view) {
     if (view.getId() == R.id.FindButton) {
          Thread t = new Thread() {
               @Override
               public void run() {
                  EditText text;
                  text = (EditText) findViewById(R.id.FindTarget);
                  String target = text.getText().toString();
                  if (target.equals("") != true) {
                      mList.clear();
                      listFile(target, "/", mList);
                      if (mList.size() > 0) {
                          mResult = "";
                          for (int i = 0; i < mList.size(); ++i) {
                               mResult += mList.get(i) + "\n";
                          }
                          mHandler.post(new Runnable() {
                               @Override
                               public void run() {
                                 EditText text = (EditText) findViewById(R.id.Result);
                                 text.setText(mResult);
                               }
                          });
                      }
                  }
               }
          };
          t.start();
-¥ê¥¹¥È3-4 : 
 private void selectImage() {
     try {
         Intent intent = new Intent(Intent.ACTION_PICK);
         intent.setType("image/*");
         startActivityForResult(intent, REQUEST_SELECT_IMAGE);
     }
     catch (Exception e) {
         AlertDialog.Builder builder = null;
         builder = new AlertDialog.Builder(this);
         builder.setMessage(getString(R.string.app_notfound));
         builder.setNeutralButton("OK",
             new DialogInterface.OnClickListener() {
                 @Override
                 public void onClick(DialogInterface dialog, int which) {
                 }
             }
         );
         builder.show();
     }
 }
~

¡¡¸¡º÷·ë²Ì¤Î¥µ¥¤¥º¤ò³Îǧ¤·¤¿¸å¡¢¥ê¥¹¥ÈÆâ¤Î¥Ç¡¼¥¿¤ò·ë²Ìɽ¼¨ÍÑʸ»úÎó¤Ë³ÊǼ¤·¡¢Handler¤Îpost¥á¥½¥Ã¥É¤ÇRunnable¤Ê¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¥¯¥é¥¹¤ò¥á¥¤¥ó¥¹¥ì¥Ã¥É¤ËÁ÷¿®¤·¤Æ¤¤¤Þ¤¹¡£Runnable¤ò¼õ¿®¤·¤¿¥á¥¤¥ó¥¹¥ì¥Ã¥É¤¬¤³¤Îrun¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤·¡¢Æ±¥á¥½¥Ã¥ÉÆâ¤Ë¼ÂÁõ¤µ¤ì¤¿½èÍý¤ò¼Â¹Ô¤·¤Þ¤¹¡£
¡¡try¥Ö¥í¥Ã¥¯¤Ç°Ï¤Þ¤ì¤¿Éôʬ¤Ç¤Ï¡¢¤Þ¤ºIntent.ACTION_PICK¤ò°ú¿ô¤Ë¤·¤¿¥¤¥ó¥Æ¥ó¥È¤òÀ¸À®¤·¤Æ¤¤¤Þ¤¹¡£¥³¥ó¥Æ¥­¥¹¥È¤È¥¯¥é¥¹¤òľÀÜ»ØÄꤷ¤¿¤â¤Î¤È°ã¤¤¡¢"¥Ç¡¼¥¿¼èÆÀ¤Î¤¿¤á"¤È¤¤¤Ã¤¿¤è¤¦¤ÊÛ£Ëæ¤Ê»ØÄê¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¤¬¡¢¤³¤¦¤·¤ÆÀ¸À®¤µ¤ì¤¿¥¤¥ó¥Æ¥ó¥È¤Ç¤ÏÂбþ²Äǽ¤Ê¥³¥ó¥Ý¡¼¥Í¥ó¥È¤òAndroid¤¬¼«Æ°Åª¤Ëõ¤·½Ð¤·¤Æ¤¯¤ì¤Þ¤¹¡£Î¾¼Ô¤ò¶èÊ̤¹¤ë¤¿¤á¡¢Á°¼Ô¤ò¡ÖÌÀ¼¨Åª¤Ê¥¤¥ó¥Æ¥ó¥È¡×¡¢¸å¼Ô¤ò¡Ö°ÅÌÛŪ¤Ê¥¤¥ó¥Æ¥ó¥È¡×¤È¸Æ¤Ó¤Þ¤¹¡£

¡¡¤³¤ì¤Ç»þ´Ö¤Î¤«¤«¤ë¸¡º÷½èÍý¤òÊÌ¥¹¥ì¥Ã¥É¤ËÄɤ¤½Ð¤·¡¢¸¡º÷½ªÎ»¸å¤Ë¥á¥¤¥ó¥¹¥ì¥Ã¥É¤Ç·ë²Ìɽ¼¨¤ò¹Ô¤¦¤³¤È¤¬½ÐÍè¤Þ¤·¤¿¡£
¡¡º£²ó¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤Ï²èÁü¥Ç¡¼¥¿¤òɬÍפȤ¹¤ë¤¿¤á¡¢¥¤¥ó¥Æ¥ó¥È¤ÎsetType¥á¥½¥Ã¥É¤Ë¡Öimage/*¡×¤òÅϤ·¤ÆÂоݤò¹Ê¤ê¹þ¤ó¤Ç¤¤¤Þ¤¹¡£¸Æ¤Ó½Ð¤·À褫¤é¤Î¥Ç¡¼¥¿¤ò¼õ¤±¼è¤ë¤¿¤á¡¢startActivity¤Ç¤Ï¤Ê¤¯startActivityForResult¥á¥½¥Ã¥É¤ò»ÈÍѤ·¡¢¤³¤Î¸Æ¤Ó½Ð¤·¤ËÂФ¹¤ë·ë²Ì¤¬Ê֤äƤ­¤¿¤«¤É¤¦¤«¤òȽÃǤ¹¤ë¤¿¤á¤ËÀèÄøÄɲä·¤¿Äê¿ô "REQUEST_SELECT_IMAGE"¤òÅϤ·¤Æ¤¤¤Þ¤¹¡£

**2-6. AsyncTask¤Ë¤è¤ë¥Þ¥ë¥Á¥¹¥ì¥Ã¥É½èÍý [#mf2fe384]
¡¡»ØÄꤷ¤¿¥¤¥ó¥Æ¥ó¥È¤ËÂбþ²Äǽ¤Ê¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤òAndroid¤¬¸«¤Ä¤±¤é¤ì¤Ê¤«¤Ã¤¿¾ì¹ç¡¢ActivityNotFoundÎã³°¤¬È¯À¸¤·¤Þ¤¹¡£¤³¤ì¤ËÂбþ¤¹¤ë¤¿¤á¡¢catch¥Ö¥í¥Ã¥¯¤Ç¤ÏAlertDialog.Builder¤òÍøÍѤ·¤Æ·Ù¹ð¥À¥¤¥¢¥í¥°¤òÀ¸À®¤·É½¼¨¤·¤Æ¤¤¤Þ¤¹¡£

¡¡Á°¹à¤Ç¤ÏThread¤ÈHandler¤ò»ÈÍѤ·¤Æ»þ´Ö¤Î¤«¤«¤ë½èÍý¤ò¥á¥¤¥ó¥¹¥ì¥Ã¥É¤«¤éʬΥ¤·¤Þ¤·¤¿¤¬¡¢Android¤Ç¤Ï¤³¤¦¤·¤¿½èÍý¤ÎÀÚ¤êʬ¤±¤ò´Êñ¤Ë¼ÂÁõ¤¹¤ë¤³¤È¤Î½ÐÍè¤ëAsyncTask¤È¤¤¤¦¥æ¡¼¥Æ¥£¥ê¥Æ¥£¥¯¥é¥¹¤¬Ä󶡤µ¤ì¤Æ¤¤¤Þ¤¹¡£FFind¤ò¤³¤ÎAsyncTask¤òÍøÍѤ·¤¿Êª¤Ëºî¤êÂؤ¨¤Æ¤ß¤Þ¤·¤ç¤¦¡£
¡¡Â³¤¤¤ÆtakePhoto¥á¥½¥Ã¥É¤â¼ÂÁõ¤·¤Æ¤¤¤­¤Þ¤¹¡Ê¥ê¥¹¥È3-5¡Ë¡£¿·¤¿¤Ë»ÈÍѤ¹¤ëContentValues¡¢MediaStore¤Î¥Ñ¥±¡¼¥¸import¤â˺¤ì¤º¤Ë¹Ô¤Ê¤Ã¤Æ²¼¤µ¤¤¡£

¡¡AsyncTask¤Ë¤Ï¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¤Ç¹Ô¤¦É¬Íפ¬¤¢¤ë½èÍý¤ò¼ÂÁõ¤¹¤ë¥á¥½¥Ã¥É¤ä¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É½èÍý¤Î´°Î»¸å¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¥á¥½¥Ã¥É¤¬ÍÑ°Õ¤µ¤ì¤Æ¤ª¤ê¡¢¤³¤ì¤é¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤¹¤ë¤³¤È¤ÇÈóƱ´ü½èÍý¤ò´Êñ¤Ë¼Â¸½½ÐÍè¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£ÂåɽŪ¤Êʪ¤ò°Ê²¼¤Ëµó¤²¤Æ¤¤¤­¤Þ¤¹¡£

-onPreExecute
--¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É½èÍý¤Î¼Â¹ÔÁ°¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ëÁ°½èÍýÍѤΥ᥽¥Ã¥É¤Ç¡¢¥á¥¤¥ó¥¹¥ì¥Ã¥É¤Ç¼Â¹Ô¤µ¤ì¤Þ¤¹¡£
-doInBackground
--¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É½èÍýÍѤΥ᥽¥Ã¥É¤Ç¡¢¥á¥¤¥ó¥¹¥ì¥Ã¥É¤È¤ÏÊÌ¥¹¥ì¥Ã¥É¤Ç¼Â¹Ô¤µ¤ì¤Þ¤¹¡£
-onProgressUpdate
--¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É½èÍý¤Î¿Ê¹Ô¾õ¶·¹¹¿·»þ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¥á¥½¥Ã¥É¤Ç¡¢¥á¥¤¥ó¥¹¥ì¥Ã¥É¤Ç¼Â¹Ô¤µ¤ì¤Þ¤¹¡£
-onPostExecute
--¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É½èÍý¤Î´°Î»¸å¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¸å½èÍýÍѤΥ᥽¥Ã¥É¤Ç¡¢¥á¥¤¥ó¥¹¥ì¥Ã¥É¤Ç¼Â¹Ô¤µ¤ì¤Þ¤¹¡£

¡¡¤³¤³¤«¤é¤Ï¼ÂºÝ¤ËAsyncTask¤Î¥µ¥Ö¥¯¥é¥¹¤òºîÀ®¤·¡¢FFind¤ËɬÍפʽèÍý¤ò¼ÂÁõ¤·¤Æ¤¤¤­¤Þ¤¹¡£Eclipse¤ÎPackage Explorer¤ÇFFind¤ò¥¯¥ê¥Ã¥¯¤·¤ÆÁªÂò¤·¡¢¥á¥Ë¥å¡¼¤«¤é¡ÖFile > New > Class¡×¤òÁªÂò¤·¤Þ¤¹¡£

CENTER:&ref(./02_06.png,);
CENTER:¿Þ2-6~
-¥ê¥¹¥È3-5 : 
 private void takePhoto() {
     try {
         Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
         ContentValues values = new ContentValues();
         values.put(MediaStore.Images.Media.MIME_TYPE, "image/*");
         mUriFromCamera = getContentResolver().insert(
             MediaStore.Images.Media. EXTERNAL_CONTENT_URI, values);
         intent.putExtra(MediaStore.EXTRA_OUTPUT, mUriFromCamera);
         startActivityForResult(intent, REQUEST_TAKE_PHOTO);
     }
     catch (Exception e) {
         AlertDialog.Builder builder = null;
         builder = new AlertDialog.Builder(this);
         builder.setMessage(getString(R.string.app_notfound));
         builder.setNeutralButton("OK",
             new DialogInterface.OnClickListener() {
                 @Override
                 public void onClick(DialogInterface dialog, int which) {
                 }
             }
         );
         builder.show();
     }
 }
~
~

¡¡¿Þ2-6¤Î¥À¥¤¥¢¥í¥°¤¬É½¼¨¤µ¤ì¤¿¤é¡¢Package¤Ë¡Öcom.beatcraft.ffind¡×¡¢Name¤Ë¡ÖFindTask¡×¡¢Superclass¤Ë¡Öandroid.os.AsyncTask<String, Integer, Void>¡×¤ÈÆþÎϤ·¤Æ¡ÖFinish¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Þ¤¹¡£¤³¤ì¤ÇFindTask.java¤È¤¤¤¦Java¥½¡¼¥¹¥³¡¼¥É¤¬¼«Æ°À¸À®¤µ¤ì¡¢FFind¤Î¥×¥í¥¸¥§¥¯¥È¤ËÄɲ䵤ì¤Þ¤¹¡£
¡¡¥«¥á¥é¤ò¸Æ¤Ó½Ð¤¹¥¤¥ó¥Æ¥ó¥È¤Ë¤ÏMediaStore.ACTION_IMAGE_CAPTURE¤ò»ØÄꤷ¤Þ¤¹¡£Intent.ACTION_PICK¤Ç¤ÏÁªÂò¤·¤¿²èÁü¤òUri¤È¤·¤ÆÊÖ¤·¤Æ¤¯¤ì¤ë¤Î¤Ç¤¹¤¬¡¢¥«¥á¥é¤«¤é¤Ï¥µ¥à¥Í¥¤¥ë¤Î¥Ç¡¼¥¿¤¬³ÈÄ¥¥Ç¡¼¥¿¤È¤·¤ÆÊ֤äƤ­¤Þ¤¹¡£¼ÂºÝ¤Î»£±Æ¥Ç¡¼¥¿¤òƱÍͤ˼è¤ê°·¤¦¤¿¤á¡¢"image/*"¤òMIME¥¿¥¤¥×¤ËÀßÄꤷ¤¿ContentValues¤òContentResolver¤ËÄɲä·¡¢³ä¤êÅö¤Æ¤é¤ì¤¿Uri¤ò¥¤¥ó¥Æ¥ó¥È¤Î³ÈÄ¥¥Ç¡¼¥¿MediaStore.EXTRA_OUTPUT¤È¤·¤ÆÄɲ乤ë¤È¡¢»£±Æ¤·¤¿²èÁü¤¬¤³¤ÎUri¤ËÊݸ¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£~
¡¡¤³¤ì¤òÀèÄøÄɲä·¤¿¥á¥ó¥ÐÊÑ¿ômUriFromCamera¤ËÊÝ»ý¤·¤Æ¤ª¤¯¤³¤È¤Ç¡¢¥«¥á¥é¤«¤é²èÁü¤ò¼èÆÀ¤¹¤ë¾ì¹ç¤Ë»²¾È½ÐÍè¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤Þ¤¹¡£·ë²Ì¤¬¥«¥á¥é¤«¤éÊ֤äƤ­¤¿¤³¤È¤òȽÃǤ¹¤ë¤¿¤á¡¢startActivityForResult¤Ë¤ÏÄê¿ô"REQUEST_TAKE_PHOTO"¤òÅϤ·¤Æ¤¤¤Þ¤¹¡£

¡¡Superclass¤ÎÍó¤ËÆþÎϤ·¤¿Ä̤ꡢAsyncTask¤Ï3¤Ä¤Î·¿¤ò»ØÄꤹ¤ë¥Æ¥ó¥×¥ì¡¼¥È¥¯¥é¥¹¤Ë¤Ê¤Ã¤Æ¤ª¤ê¡¢1¤Ä¤á¤ÏdoInBackground¥á¥½¥Ã¥É¤Î°ú¿ô¤Î·¿¡¢2¤Ä¤á¤ÏonProgressUpdate¥á¥½¥Ã¥É¤Î°ú¿ô¤Î·¿¡¢3¤Ä¤á¤ÏonPostExecute¥á¥½¥Ã¥É¤Î°ú¿ô¤Î·¿¤ò»ØÄꤷ¤Þ¤¹¡£
¡¡ºÆ¤Ó¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò¼Â¹Ô¤·¤Æ¡Ö²èÁü¤òÁªÂò¡×¡Ö¼Ì¿¿¤ò»£±Æ¡×¥Ü¥¿¥ó¤ÎÆ°ºî¤ò³Îǧ¤·¤Æ¤ß¤Þ¤·¤ç¤¦¡£Âбþ²Äǽ¤Ê¥³¥ó¥Ý¡¼¥Í¥ó¥È¤¬Ê£¿ô¸«¤Ä¤«¤Ã¤¿¾ì¹ç¡¢¿Þ3-6¤Î¤è¤¦¤Ê¥À¥¤¥¢¥í¥°¤¬É½¼¨¤µ¤ì¤Þ¤¹¤¬¡¢´ðËÜŪ¤Ë¤É¤Á¤é¤òÁª¤ó¤Ç¤âÌäÂꤢ¤ê¤Þ¤»¤ó¡£

¡¡ºîÀ®¤µ¤ì¤¿FindTask.java¤ò¥À¥Ö¥ë¥¯¥ê¥Ã¥¯¤·¤Æ³«¤­¡¢¥á¥ó¥ÐÊÑ¿ô¤È¥³¥ó¥¹¥È¥é¥¯¥¿¤òÄɲä·¤Þ¤¹¡Ê¥ê¥¹¥È2-9¡Ë¡£

-¥ê¥¹¥È2-9 :
 private FFindActivity mActivity;
 
 public FindTask(FFindActivity activity) {
     mActivity = activity;
 }
CENTER:&ref(./03_06.png,);
CENTER:¿Þ3-6~
~

¡¡¸¡º÷½èÍý¤È·ë²Ì¤ÎÈ¿±Ç¤òFFindActivity¤Ç¹Ô¤¦¤¿¤á¡¢¤³¤ì¤òÊÝ»ý¤¹¤ë¤¿¤á¤ÎÊÑ¿ô¤òÄɲ䷤Ƥ¤¤Þ¤¹¡£¥³¥ó¥¹¥È¥é¥¯¥¿¤ÇFFindActivity¤ò°ú¿ô¤Ë¼è¤ê¡¢Äɲä·¤¿ÊÑ¿ô¤Ë³ÊǼ¤·¤Þ¤¹¡£~
¡¡Â³¤¤¤ÆdoInBackground¤Î½èÍý¤ò¼ÂÁõ¤·¤Þ¤¹¡Ê¥ê¥¹¥È2-10¡Ë¡£

-¥ê¥¹¥È2-10 :
 @Override
 protected Void doInBackground(String... arg0) {
     String target = arg0[0];
     mActivity.listFile(target);
     return null;
 }
~
**3-4. ³°Éô¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤«¤é¤Î¥Ç¡¼¥¿¼èÆÀ [#a8315a05]

¡¡doInBackground¤Î°ú¿ô¤Ï¥Æ¥ó¥×¥ì¡¼¥È¤Ç»ØÄꤷ¤¿·¿¤Î²ÄÊÑĹ°ú¿ô¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤Î¤Ç¡¢¤³¤³¤«¤é°ì¤ÄÌܤÎÍ×ÁǤò¼è¤ê½Ð¤·¡¢¸¡º÷¥­¡¼¥ï¡¼¥É¤È¤·¤ÆFFindActivity¤ÎlistFile¥á¥½¥Ã¥É¤ËÅϤ·¤Æ¤¤¤Þ¤¹¡£¤³¤³¤Ç¸Æ¤Ó½Ð¤·¤Æ¤¤¤ëlistFile¥á¥½¥Ã¥É¤Ï¤³¤ì¤Þ¤Ç¤Ë¼ÂÁõ¤·¤¿¸¡º÷¥á¥½¥Ã¥É¤Ç¤Ï¤Ê¤¯FindTask¤«¤é¸¡º÷½èÍý¤ò¸Æ¤Ó½Ð¤¹¤¿¤á¤ËÍøÍѤ¹¤ë¤â¤Î¤Ç¡¢¤³¤Î¸å¤Ç¼ÂÁõ¤·¤Æ¤¤¤­¤Þ¤¹¡Ê°ú¿ô¤¬°Û¤Ê¤ë¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡Ë¡£~
¡¡°ú¤­Â³¤­onPostExecute¥á¥½¥Ã¥É¤ò¼ÂÁõ¤·¤Þ¤¹¡Ê¥ê¥¹¥È2-11¡Ë¡£
¡¡Á°¹à¤Þ¤Ç¤Ç³°Éô¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤¬½ÐÍè¤Þ¤·¤¿¡£¤³¤³¤«¤é¤Ï³°Éô¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤«¤éÅϤµ¤ì¤¿¥Ç¡¼¥¿¤ò¼õ¤±¼è¤ê¡¢²èÌ̤ËÈ¿±Ç¤¹¤ë¤Þ¤Ç¤ò¼ÂÁõ¤·¤Æ¤¤¤­¤Þ¤¹¡£

-¥ê¥¹¥È2-11 :
 @Override
 protected void onPostExecute(Void v) {
     mActivity.result();
     mActivity = null;
 }
~
¡¡startActivityForResult¤Ç¸Æ¤Ó½Ð¤·¤¿¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤«¤é¤Î·ë²Ì¤ÏonActivityResult¥á¥½¥Ã¥É¤Ç¼õ¤±¼è¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡Ê¥ê¥¹¥È3-6¡Ë¡£

¡¡onPostExecute¤Ï¸¡º÷¤¬´°Î»¤·¤¿ºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¤Î¤Ç¡¢FFindActivity¤Îresult¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤·¤Æ¸¡º÷·ë²Ì¤ÎÈ¿±Ç¤ò¹Ô¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡Êresult¥á¥½¥Ã¥É¤Ï¸å¤Û¤É¼ÂÁõ¤·¤Þ¤¹¡Ë¡£

¡¡°Ê¾å¤ÇFindTask¤Î¼ÂÁõ¤Ï¤Ò¤È¤Þ¤º´°Î»¤Ç¤¹¡£Â³¤¤¤ÆFFindActivity¤ò¡¢¤³¤ÎFindTask¤òÍøÍѤ·¤¿·Á¤Ë½¤Àµ¤·¤Æ¤¤¤­¤Þ¤¹¡£FindButton¤ËOnClickListener¤òÀßÄꤹ¤ëºÝ¤ÎonClick¤ò¡¢°Ê²¼¤Î¤è¤¦¤Ë½¤Àµ¤·¤Þ¤¹¡Ê¥ê¥¹¥È2-12¡Ë¡£

-¥ê¥¹¥È2-12 :
 public void onClick(View view) {
      if (view.getId() == R.id.FindButton) {
          EditText text;
          text = (EditText) findViewById(R.id.FindTarget);
          String target = text.getText().toString();
-¥ê¥¹¥È3-6 : 
 protected void onActivityResult(int reqCode, int result, Intent data) {
     super.onActivityResult(reqCode, result, data);
 
          if (target.equals("") == false) {
               mList.clear();
               FindTask task = new FindTask(FFindActivity.this);
               task.execute(target);
          }
      }
 }
~

¡¡¥­¡¼¥ï¡¼¥É¤¬¶õ¤Ç¤Ê¤«¤Ã¤¿¾ì¹çFindTask¤òÀ¸À®¤·¡¢execute¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤·¤Æ¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É½èÍý¤ò³«»Ï¤·¤Æ¤¤¤Þ¤¹¡£¤³¤Î»þ¡¢execute¥á¥½¥Ã¥É¤ËÅϤ·¤¿°ú¿ô¤¬doInBackground¤Ë°ú¤­ÅϤµ¤ì¤Þ¤¹¡£Thread¤ÈHandler¤Ç¹Ô¤Ê¤Ã¤Æ¤¤¤¿½èÍý¤òAsyncTask¤ËÅý¹ç¤·¤¿¤¿¤á¡¢Èó¾ï¤Ë¤¹¤Ã¤­¤ê¤È¤·¤¿µ­½Ò¤Ë¤Ê¤ê¤Þ¤·¤¿¡£¥á¥ó¥ÐÊÑ¿ô¤ÎmHandler¤ÏÉÔÍפȤʤ俤Τǡ¢¤³¤Á¤é¤ÎÀë¸À¤È¥Ñ¥Ã¥±¡¼¥¸¥¤¥ó¥Ý¡¼¥È¤âºï½ü¤·¤Æ¤ª¤­¤Þ¤¹¡£

¡¡FindTask¤«¤é¸Æ¤Ó½Ð¤µ¤ì¤ë¸¡º÷½èÍý¤È·ë²Ìɽ¼¨¤Î¥á¥½¥Ã¥É¤òÄɲä·¤Þ¤¹¡£

-¥ê¥¹¥È2-13 :
 public void listFile(String target) {
     listFile(target, "/", mList);
     if (mList.size() > 0) {
         mResult = "";
         for (int i = 0; i < mList.size(); ++i) {
             mResult += mList.get(i) + "\n";
     Uri uri = null;
 
     if (result == RESULT_OK) {
         if (reqCode == REQUEST_SELECT_IMAGE) {
             uri = data.getData();
         }
         else if (reqCode == REQUEST_TAKE_PHOTO) {
             uri = mUriFromCamera;
         }
         mBitmap = getImage(uri);
         setPreview();
     }
 }
 
 public void result() {
     if (mList.size() > 0) {
         EditText text = (EditText) findViewById(R.id.Result);
         text.setText(mResult);
     else if (reqCode == REQUEST_TAKE_PHOTO) {
         getContentResolver().delete(mUriFromCamera, null, null);
     }
     else {
         Toast.makeText(this, "* NOT FOUND *", Toast.LENGTH_SHORT).show();
     }
 }
~

¡¡FindTask¤ÎdoInBackground¤«¤é¸Æ¤Ó½Ð¤µ¤ì¤¿listFile¥á¥½¥Ã¥É¤Ç¤Ï¡¢ÅϤµ¤ì¤¿¥­¡¼¥ï¡¼¥É¤ò¸¡º÷Âоݡ¢¥ë¡¼¥È¥Õ¥©¥ë¥À¡Ê"/"¡Ë¤ò¸¡º÷³«»Ï¥Õ¥©¥ë¥À¤È¤·¤Æ¼ÂºÝ¤Î¸¡º÷½èÍý¤ò¸Æ¤Ó½Ð¤·¤¿¤¢¤È¡¢·ë²Ì³ÊǼÍѤÎString¤ËÀ°·Á¤·¤Æ³ÊǼ¤·¤Æ¤¤¤Þ¤¹¡£doInBackground¤Ï¥á¥¤¥ó¥¹¥ì¥Ã¥É¤È¤ÏÊ̤Υ¹¥ì¥Ã¥É¤«¤é¸Æ¤Ó½Ð¤µ¤ì¤ë¤¿¤á¡¢¤³¤Î½èÍý¤¬Ä¹»þ´Ö¤«¤«¤Ã¤Æ¤â¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬ANR¤ÇÄä»ß¤µ¤ì¤ë¤³¤È¤Ï¤¢¤ê¤Þ¤»¤ó¡£
¡¡super¥¯¥é¥¹¤ÎonActivityResult¤ò¸Æ¤Ó½Ð¤·¤¿¸å¡¢result¤ò¥Á¥§¥Ã¥¯¤·¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤¬RESULT_OK¤Î¾ì¹ç¡¢¸Æ¤Ó½Ð¤·¤¿¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬¥Ç¡¼¥¿¤òÊÖ¤·¤Æ¤¯¤ì¤¿¤³¤È¤ò¼¨¤·¤Þ¤¹¡£~
¡¡reqCode¤Ë¤ÏstartActivityResult¤ò¸Æ¤Ó½Ð¤·¤¿ºÝ¤Î¥ê¥¯¥¨¥¹¥È¥³¡¼¥É¤¬Æþ¤Ã¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤¬"REQUEST_SELECT_IMAGE"¤Ç¤¢¤ì¤Ð¡Ö²èÁü¤òÁªÂò¡×¤Ç¤Î¸Æ¤Ó½Ð¤·¤È¤Ê¤ê¡¢ÅϤµ¤ì¤¿¥¤¥ó¥Æ¥ó¥È¤«¤égetData¥á¥½¥Ã¥É¤ÇUri¤ò¼èÆÀ½ÐÍè¤Þ¤¹¡£~
¡¡°ìÊý"REQUEST_TAKE_PHOTO"¤Î¾ì¹ç¤Ï¡Ö¼Ì¿¿¤ò»£±Æ¡×¤Ç¤Î¸Æ¤Ó½Ð¤·¤Ë¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢Í½¤áÊÝ»ý¤·¤Æ¤ª¤¤¤¿mUriFromCamera¤ò»ÈÍѤ·¤Æ¤¤¤Þ¤¹¡£¤Þ¤¿¡¢result¤¬RESULT_OK¤Ç¤Ê¤«¤Ã¤¿¾ì¹ç¤ÏContentResolver¤Îdelete¥á¥½¥Ã¥É¤Ç¤³¤ÎUri¤òºï½ü¤·¤Æ¤¤¤Þ¤¹¡£

¡¡FindTask¤ÎonPostExecute¤«¤é¸Æ¤Ó½Ð¤µ¤ì¤¿result¥á¥½¥Ã¥É¤Ç¤Ï¸¡º÷·ë²Ì¤Îʸ»úÎó¤òResult¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤ËÀßÄꤷ¤Æ¤¤¤Þ¤¹¡£onPostExecute¤Ï¥á¥¤¥ó¥¹¥ì¥Ã¥É¤Ç¸Æ¤Ó½Ð¤µ¤ì¤ë¤¿¤á¡¢EditText¤ÎsetText¤ò¼Â¹Ô¤·¤Æ¤â¥¨¥é¡¼¤¬µ¯¤­¤ë¤³¤È¤Ï¤¢¤ê¤Þ¤»¤ó¡£
¡¡¼èÆÀ¤·¤¿Uri¤ò¸å¤Û¤É¼ÂÁõ¤¹¤ëgetImage¥á¥½¥Ã¥É¤Ë°ú¤­ÅϤ·¤Æ¥Ó¥Ã¥È¥Þ¥Ã¥×²èÁü¤ò¼èÆÀ¤·¡¢setPreview¥á¥½¥Ã¥É¤Ç¥×¥ì¥Ó¥å¡¼ÍÑImageView¤Ø¤ÎÀßÄê¤È²èÁü¥µ¥¤¥º¤Î¼èÆÀ¤ò¹Ô¤¤¤Þ¤¹¡£

¡¡¤Þ¤¿¡¢¸¡º÷·ë²Ì¤¬0·ï¤À¤Ã¤¿¾ì¹ç²¿¤âɽ¼¨¤·¤Ê¤¤¤Î¤Ï¤ï¤«¤ê¤Å¤é¤¤¤¿¤á¡¢Toast¤ò»ÈÍѤ·¤ÆÄÌÃΤ¹¤ë¤è¤¦¤Ë¤·¤Þ¤·¤¿¡Ê¿Þ2-7¡Ë¡£Toast¤Ï¥æ¡¼¥¶¡¼¤«¤é¤Î¥ì¥¹¥Ý¥ó¥¹¤òɬÍפȤ·¤Ê¤¤´Êñ¤Ê¥á¥Ã¥»¡¼¥¸¤òɽ¼¨¤¹¤ë¥Ý¥Ã¥×¥¢¥Ã¥×¥À¥¤¥¢¥í¥°¤Ç¡¢ÆÃÄê¤Î½èÍý¤òÄ̲ᤷ¤¿ºÝ¤Ëɽ¼¨¤¹¤ë¤Ê¤É´Ê°×¥Ç¥Ð¥Ã¥°¥Ä¡¼¥ë¤È¤·¤Æ¤âÍøÍѽÐÍè¤Þ¤¹¡Ê⤷¡¢Toast¤â¥á¥¤¥ó¥¹¥ì¥Ã¥É¤«¤é¤Ç¤Ê¤±¤ì¤ÐÍøÍѽÐÍè¤Ê¤¤¤¿¤áÃí°Õ¤¬É¬ÍפǤ¹¡Ë¡£~
¡¡¾°¡¢Toast¤Î»ÈÍѤˤÏandroid.widget.Toast¥Ñ¥Ã¥±¡¼¥¸¤Î¥¤¥ó¥Ý¡¼¥È¤¬É¬ÍפǤ¹¡£
~
¡¡¥ê¥¹¥È3-7¤¬getImage¥á¥½¥Ã¥É¤Ë¤Ê¤ê¤Þ¤¹¡£InputStream¡¢BitmapFactory¥Ñ¥Ã¥±¡¼¥¸¤Îimport¤âÊ»¤»¤Æ¹Ô¤¤¤Þ¤¹¡£

CENTER:&ref(./02_07.png,);
CENTER:¿Þ2-7~
-¥ê¥¹¥È3-7 : 
 private Bitmap getImage(Uri uri) {
     try {
         InputStream is = getContentResolver().openInputStream(uri);
         return BitmapFactory.decodeStream(is);
     }
     catch (Exception e) {
         e.printStackTrace();
         return null;
     }
 }
~
~

¡¡FFind¤ÎAsyncTask²½¤Ï¤³¤ì¤Ç´°Î»¤Ç¤¹¤¬¡¢¤è¤ê¤ï¤«¤ê¤ä¤¹¤¯¡¢¸¡º÷Ãæ¤Ï¥×¥í¥°¥ì¥¹¥À¥¤¥¢¥í¥°¤òɽ¼¨¤¹¤ë¤è¤¦¤Ë¤·¤Æ¤ß¤Þ¤·¤ç¤¦¡£
¡¡ContentResolver¤ÎopenInputStream¥á¥½¥Ã¥É¤ËUri¤òÅϤ¹¤È¡¢¤½¤ÎUri¤Ë¤¢¤ë¥Õ¥¡¥¤¥ë¤ÎInputStream¤¬¼èÆÀ½ÐÍè¤Þ¤¹¡£¤³¤ì¤òBitmapFactory¤ÎdecodeStream¤Ë°úÅϤ·¡¢Bitmap¥ª¥Ö¥¸¥§¥¯¥È¤ò¥Ç¥³¡¼¥É¤·¤ÆÊÖ¤·¤Æ¤¤¤Þ¤¹¡£»ØÄê¤ÎUri¤Ë¥Õ¥¡¥¤¥ë¤¬¤Ê¤«¤Ã¤¿¾ì¹ç¤ËopenInputStream¥á¥½¥Ã¥É¤¬FileNotFoundExceptionÎã³°¤òȯ¹Ô¤¹¤ë¤Î¤Ç¡¢catch¥Ö¥í¥Ã¥¯¤Ç¤Ï¤³¤ì¤ò¼õ¤±¤Ænull¤òÊÖ¤·¤Þ¤¹¡£

¡¡FFindTask.java¤ò³«¤­¡¢¥×¥í¥°¥ì¥¹¥À¥¤¥¢¥í¥°¤Î¥Ñ¥Ã¥±¡¼¥¸¤ò¥¤¥ó¥Ý¡¼¥È¤·¤Þ¤¹¡£
¡¡°Ê¾å¤Ç¥Ç¡¼¥¿¼õ¤±¼è¤ê¤Î¼ÂÁõ¤Ï´°Î»¤Ç¤¹¤¬¡¢Android¤Î¥Ð¡¼¥¸¥ç¥ó¤Ë¤è¤Ã¤Æ¤Ï¥¤¥ó¥Æ¥ó¥È¤Îȯ¹Ô¸å¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç²èÌ̤νIJ£ÀÚÂؤ¬µ¯¤­¤ë¤È¡¢¸µ¤Î¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤¬·ë²Ì¤ò¼õ¤±¼è¤ì¤Ê¤¯¤Ê¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£¤³¤ì¤Ï½Ä²£ÀÚÂؤˤè¤Ã¤Æ°ìÅÙ¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤¬ÇË´þ¤µ¤ì¤ë¡ÊonDestroy¤¬¸Æ¤Ð¤ì¤ë¡Ë¤¿¤á¤Ç¡¢¤³¤ì¤òÈò¤±¤ë¤Ë¤Ï½Ä²£ÀÚÂØ»þ¤Ë¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤ÎÇË´þ¤Ç¤Ï¤Ê¤¯¡¢¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥óÊѹ¹¤¬È¯À¸¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£

 import android.app.ProgressDialog;
¡¡IResizer¤Î¥Þ¥Ë¥Õ¥§¥¹¥È¥Õ¥¡¥¤¥ë¡ÊAndroidManifest.xml¡Ë¤ò³«¤­¡¢android:configChanges°À­¤òIResizerActivity¤ËÄɲä·¤Þ¤¹¡Ê¥ê¥¹¥È3-8¡Ë¡£

¡¡¥×¥í¥°¥ì¥¹¥À¥¤¥¢¥í¥°¤ò¥á¥ó¥ÐÊÑ¿ô¤ËÄɲä·¤Þ¤¹¡£

 private ProgressDialog mDialog;

¡¡onPreExecute¥á¥½¥Ã¥É¤òÄɲä·¡¢¥×¥í¥°¥ì¥¹¥À¥¤¥¢¥í¥°¤ÎÀ¸À®¤Èɽ¼¨¤ò¹Ô¤¤¤Þ¤¹¡Ê¥ê¥¹¥È2-14¡Ë¡£

-¥ê¥¹¥È2-14 :
 @Override
 protected void onPreExecute() {
     mDialog = new ProgressDialog(mActivity);
     mDialog.setMessage(mActivity.getString(R.string.find_progress));
     mDialog.show();
 }
-¥ê¥¹¥È3-8 : 
 <activity
         android:configChanges="orientation"
         android:label="@string/app_name"
         android:name=".IResizerActivity" >
~

¡¡¥À¥¤¥¢¥í¥°¤ÎsetMessage¥á¥½¥Ã¥É¤Ï¥À¥¤¥¢¥í¥°¤Ëɽ¼¨¤¹¤ë¥á¥Ã¥»¡¼¥¸¤òÀßÄꤹ¤ë¥á¥½¥Ã¥É¤Ç¤¹¡£¤³¤³¤Ç»ØÄꤷ¤Æ¤¤¤ëR.string.find_progress¤Ï¸å¤Û¤Éʸ»úÎó¥ê¥½¡¼¥¹¤ËÄɲä·¤Þ¤¹¡£
¡¡Â³¤¤¤ÆIResizerActivity.java¤ËonConfigurationChanged¥á¥½¥Ã¥É¤òÄɲä·¤Þ¤¹¡Ê¥ê¥¹¥È3-9¡Ë¡£

¡¡onPostExecute¥á¥½¥Ã¥É¤ò½¤Àµ¤·¡¢¥×¥í¥°¥ì¥¹¥À¥¤¥¢¥í¥°¤ò¾Ãµî¤·¤Þ¤¹¡Ê¥ê¥¹¥È2-15¡Ë¡£

-¥ê¥¹¥È2-15 :
-¥ê¥¹¥È3-9 : 
 @Override
 protected void onPostExecute(Void v) {
     mDialog.dismiss();
     mDialog = null;
     mActivity.result();
     mActivity = null;
 public void onConfigurationChanged(Configuration newConfig) {
     super.onConfigurationChanged(newConfig);
     setupUI();
 }
~

¡¡¥ê¥½¡¼¥¹¤Îstrings.xml¤ò¥À¥Ö¥ë¥¯¥ê¥Ã¥¯¤·¤Æ³«¤­¡¢°Ê²¼¤Îʸ»úÎó¥ê¥½¡¼¥¹¤òÄɲä·¤Þ¤¹¡£

 <string name="find_progress">¸¡º÷Ãæ...</string>

¡¡°Ê¾å¤Ç½¤Àµ¤Ï´°Î»¤Ç¤¹¡£¸¡º÷Ãæ¤Ï¿Þ2-8¤Î¤è¤¦¤Ê¥À¥¤¥¢¥í¥°¤¬É½¼¨¤µ¤ì¡¢¸¡º÷¤¬½ªÎ»¤¹¤ë¤È¼«Æ°Åª¤Ë¾Ã¤¨¤ë¤³¤È¤ò³Îǧ¤·¤Æ²¼¤µ¤¤¡£


CENTER:&ref(./02_08.png,);
CENTER:¿Þ2-8~
¡¡super¥¯¥é¥¹¤ÎonConfigurationChanged¤ò¸Æ¤Ó½Ð¤·¤¿¤¢¤È¡¢setupUI¤Ç¥ì¥¤¥¢¥¦¥È¤ÎÀßÄê¤ò²þ¤á¤Æ¹Ô¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤ò¤·¤Ê¤¤¤È¡Ê¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤¬ÇË´þ¤µ¤ì¤Ê¤¤¤¿¤á¡ËÀÚÂØÁ°¤Î¥ì¥¤¥¢¥¦¥È¤¬¤½¤Î¤Þ¤Þ¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¤¤Þ¤¹¡£
~
~

¡¡¥×¥í¥°¥ì¥¹¥À¥¤¥¢¥í¥°¤Ï¸½ºß¤Î¿ÊĽ¾õ¶·¤ò¥Ð¡¼¤Ç¼¨¤¹¤Ê¤É¡¢¤¤¤¯¤Ä¤«¤Î¥¹¥¿¥¤¥ë¤¬»ÈÍѲÄǽ¤Ç¤¹¡£AsyncTask¤ÎonProgressUpdate¥á¥½¥Ã¥ÉÆâ¤Ç¥À¥¤¥¢¥í¥°¤Î¿ÊĽ¾õ¶·¤ò¹¹¿·¤·¡¢doInBackground¤Ç¤Î½èÍý¿Ê¹Ô¾õ¶·¤Ë±þ¤¸¤ÆpublishProgress¥á¥½¥Ã¥É¤òŬµ¹¸Æ¤Ó½Ð¤¹¤³¤È¤Ç¡¢¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É½èÍý¤Î¿ÊĽ¤Ë±þ¤¸¤¿É½¼¨¤¬¹Ô¤¨¤Þ¤¹¡£
~
~
**3-5. ¥ê¥µ¥¤¥º²èÁüÊݸ½èÍý¤Î¼ÂÁõ [#af5fc665]

**2-7. ¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤ÎÁ«°Ü [#v5875d61]
¡¡¤³¤³¤«¤é¤Ï¼õ¤±¼è¤Ã¤¿²èÁü¤ò¥ê¥µ¥¤¥º¤·¡¢Êݸ¤¹¤ë¤Þ¤Ç¤Î½èÍý¤ò¼ÂÁõ¤·¤Æ¤¤¤­¤Þ¤¹¡£Êݸ¤ËºÝ¤·¤Æ¤Î»ÅÍͤϰʲ¼¤ÎÄ̤ê¤È¤·¤Þ¤¹¡£

¡¡¤³¤³¤«¤é¤ÏFFind¤Î²þ½¤¤ò¹¹¤Ë¿Ê¤á¤Æ¡¢¸¡º÷·ë²Ì¤òÊÌ¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤Ëɽ¼¨¤·¡¢·ë²Ìɽ¼¨¤â¥ê¥¹¥È¥Ó¥å¡¼¤ò»ÈÍѤ·¤¿Êª¤ËÀ°¤¨¤Æ¤¤¤­¤Þ¤¹¡£
-¥Õ¥©¡¼¥Þ¥Ã¥È¤ÏJPEG¸ÇÄê¤È¤¹¤ë¡£
-¥Õ¥¡¥¤¥ë̾¤Ï¸½ºß»þ¹ï¤òÍѤ¤¤Æ¡ÖYYYYMMDD_HHMMSS.jpg¡×¤È¤¤¤¦·Á¼°¤Ç¼«Æ°À¸À®¤¹¤ë¡£
-ÊݸÀè¤Ï¥«¥á¥é¥Õ¥©¥ë¥À¤Ë¸ÇÄê¤È¤·¡¢¥®¥ã¥é¥ê¡¼¤Ëɽ¼¨¤µ¤ì¤ë¤è¤¦ÅÐÏ¿¤ò¹Ô¤¦¡£
-ÊݸÁ°¤Ë³Îǧ¥À¥¤¥¢¥í¥°¤òɽ¼¨¤¹¤ë¡£

¡¡¤Þ¤º¤Ï·ë²Ìɽ¼¨ÍѤΥ¢¥¯¥Æ¥£¥Ó¥Æ¥£¤òÍÑ°Õ¤·¤Þ¤¹¡£Eclipse¤ÎPackage Explorer¤ÇFFind¤ò¥¯¥ê¥Ã¥¯¤·¤ÆÁªÂò¤·¡¢¥á¥Ë¥å¡¼¤«¤é¡ÖFile > New > Class¡×¤òÁªÂò¤·¤Þ¤¹¡£¥¯¥é¥¹ºîÀ®¥À¥¤¥¢¥í¥°¤¬É½¼¨¤µ¤ì¤¿¤é¡¢Package¤Ë¡Öcom.beatcraft.ffind¡×¡¢Name¤Ë¡ÖResultActivity¡×¡¢Superclass¤Ë¡Öandroid.app.Activity¡×¤ÈÆþÎϤ·¤Æ¡ÖFinish¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Þ¤¹¡£
¡¡¤Þ¤º¤ÏÊݸ½èÍý¤Ç»ÈÍѤ¹¤ëʸ»úÎó¥ê¥½¡¼¥¹¤òÄɲ䷤Ƥª¤­¤Þ¤¹¡£strings.xml¤ò³«¤­¡¢°Ê²¼¤òÄɲ䷤Ʋ¼¤µ¤¤¡£

¡¡ºîÀ®¤µ¤ì¤¿ResultActivity.java¤ò¥À¥Ö¥ë¥¯¥ê¥Ã¥¯¤·¤Æ³«¤­¡¢onCreate¥á¥½¥Ã¥É¤ò¼ÂÁõ¤·¤Æ¤¤¤­¤Þ¤¹¡Ê¥ê¥¹¥È2-16¡Ë¡£Bundle¥¯¥é¥¹¤ò»ÈÍѲÄǽ¤Ë¤¹¤ë¤¿¤á¡¢android.os.Bundle¥Ñ¥Ã¥±¡¼¥¸¤Î¥¤¥ó¥Ý¡¼¥È¤â¹Ô¤Ê¤Ã¤Æ²¼¤µ¤¤¡£
     <string name="cancel">¼è¾Ã</string>
     <string name="save_title">²èÁüÊݸ</string>
     <string name="filename_label">¥Õ¥¡¥¤¥ë̾¡§</string>
     <string name="isize_label">²èÁü¥µ¥¤¥º¡§</string>
     <string name="save_desc">¤ÇÊݸ¤·¤Þ¤¹¡£</string>
     <string name="save_success">Êݸ¤·¤Þ¤·¤¿</string>
     <string name="save_failed">Êݸ¤Ë¼ºÇÔ¤·¤Þ¤·¤¿</string>

-¥ê¥¹¥È2-16 :
 @Override
 public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.result);
 }
~
¡¡Â³¤¤¤Æ³Îǧ¥À¥¤¥¢¥í¥°ÍѤΥ쥤¥¢¥¦¥È¤òºîÀ®¤·¤Æ¤¤¤­¤Þ¤¹¡£IResizer¤Î¥ì¥¤¥¢¥¦¥È¥ê¥½¡¼¥¹¥Õ¥©¥ë¥À¤Ë°Ê²¼¤ÎÆâÍƤÇdialog.xml¤È¤¤¤¦¥ì¥¤¥¢¥¦¥È¥Õ¥¡¥¤¥ë¤òºîÀ®¤·¤Þ¤¹¡Ê¥ê¥¹¥È3-10¡Ë¡£

¡¡Â³¤¤¤Æ¤³¤Î¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤Ç»ÈÍѤ¹¤ë¥ì¥¤¥¢¥¦¥È¡ÊR.layout.result¡Ë¤òºîÀ®¤·¤Þ¤¹¡£FFind¤ò¥¯¥ê¥Ã¥¯¤·¤ÆÁªÂò¤·¡¢¥á¥Ë¥å¡¼¤«¤é¡ÖFile > New > Other...¡×¤òÁªÂò¤·¤Þ¤¹¡£"Select a wizard"¥À¥¤¥¢¥í¥°¡Ê¿Þ2-9¡Ë¤¬É½¼¨¤µ¤ì¤¿¤é¡¢¡ÖAndroid > Android XML Layout File¡×¤òÁªÂò¤·¤Æ¡ÖNext¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ²¼¤µ¤¤¡£

CENTER:&ref(./02_09.png,);
CENTER:¿Þ2-9~
-¥ê¥¹¥È3-10 : 
     <?xml version="1.0" encoding="utf-8"?>
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:orientation="vertical" >
 
 
         <LinearLayout
             android:id="@+id/FileNameLayout"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:layout_marginLeft="5dip"
             android:layout_marginRight="5dip" >
 
             <TextView
                 android:id="@+id/FileLabel"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:text="@string/filename_label" />
 
             <TextView
                 android:id="@+id/FileName"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="5dip"
                 android:layout_weight="1" />
         </LinearLayout>
 
         <LinearLayout
             android:id="@+id/ImageSizeLayout"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:layout_marginLeft="5dip"
             android:layout_marginRight="5dip" >
 
             <TextView
                 android:id="@+id/SizeLabel"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:text="@string/isize_label" />
 
             <TextView
                 android:id="@+id/ImageSize"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="5dip"
                 android:layout_weight="1" />
         </LinearLayout>
 
         <TextView
             android:id="@+id/Description"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:layout_marginLeft="5dip"
             android:layout_marginRight="5dip"
             android:gravity="right"
             android:text="@string/save_desc" />
 
         <LinearLayout
             android:id="@+id/ButtonLayout"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="10dip"
             android:gravity="center_horizontal" >
 
             <Button
                 android:id="@+id/ExecSave"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:text="@string/save" />
 
             <Button
                 android:id="@+id/Cancel"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:text="@string/cancel" />
         </LinearLayout>
 
     </LinearLayout>
~
~

¡¡Â³¤¯"New Android Layout XML File"¤ÇFile¤Ë¡Öresult.xml¡×¤ÈÆþÎϤ·¡¢¡ÖFinish¡×¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¥ì¥¤¥¢¥¦¥È¥ê¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤¬ºîÀ®¤µ¤ì¤Þ¤¹¡£~
¡¡Package Explorer¤«¤éresult.xml¤ò¥À¥Ö¥ë¥¯¥ê¥Ã¥¯¤·¤Æ³«¤­¡¢ºîÀ®¤µ¤ì¤¿¥ì¥¤¥¢¥¦¥È¤Ë¥ê¥¹¥È¥Ó¥å¡¼¤òÄɲä·¤Þ¤¹¡£Palette¤«¤éComposite¤ò¥¯¥ê¥Ã¥¯¤·¤ÆŸ³«¤·¡¢ListView¤ò¥É¥é¥Ã¥°¡õ¥É¥í¥Ã¥×¤ÇÇÛÃÖ¤·¤Þ¤¹¡£ListView¤Ï¹õÅɤê¤ÇÆä˲¿¤âɽ¼¨¤µ¤ì¤Ê¤¤¤¿¤á¤ï¤«¤ê¤Å¤é¤¤¤Î¤Ç¤¹¤¬¡¢CompositeÆâ¤Î°ìÈֺǽé¤Î¹àÌܤ¬ListView¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡Ê¿Þ2-10¡Ë¡£
¡¡¥À¥¤¥¢¥í¥°¤Î¥¢¥¦¥È¥é¥¤¥ó¤È¥ì¥¤¥¢¥¦¥È¥¤¥á¡¼¥¸¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡Ê¿Þ3-7¡Ë¡£

CENTER:&ref(./02_10.png,);
CENTER:¿Þ2-10~
|LEFT:|CENTER:|c
|¡¡LinearLayout&br;¡¡¡¡FileNameLayout&br;¡¡¡¡¡¡FileLabel&br;¡¡¡¡¡¡FileName&br;¡¡¡¡ImageSizeLayout&br;¡¡¡¡¡¡SizeLabel&br;¡¡¡¡¡¡ImageSize&br;¡¡¡¡Description&br;¡¡¡¡ButtonLayout&br;¡¡¡¡¡¡ExecSave&br;¡¡¡¡¡¡Cancel|&ref(./03_07.png,);&br;¿Þ3-7|
~
~

¡¡ÇÛÃÖ¤·¤¿¥ê¥¹¥È¥Ó¥å¡¼¤Î¥×¥í¥Ñ¥Æ¥£¤ò°Ê²¼¤Î¤è¤¦¤ËÀßÄꤷ¤Þ¤¹¡£
¡¡Êݸ»þ¤Î¥Õ¥¡¥¤¥ë̾¤È¥À¥¤¥¢¥í¥°¤òÊÝ»ý¤¹¤ë¤¿¤á¡¢IResizerActivity¤Ë°Ê²¼¤Î¥á¥ó¥ÐÊÑ¿ô¤òÄɲä·¤Þ¤¹¡£

-Id¤Ë¡Ö@+id/Result¡×¤ÈÆþÎϤ·¤Þ¤¹¡£
-Layout height¤Ë¡Öfill_parent¡×¤ò»ØÄꤷ¤Þ¤¹¡£
-Layout width¤Ë¡Öfill_parent¡×¤ò»ØÄꤷ¤Þ¤¹¡£
 private String mFileName = "";
 private Dialog mDialog = null;

¡¡°Ê¾å¤ÇResult¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤Î¥ì¥¤¥¢¥¦¥ÈºîÀ®¤Ï´°Î»¤Ç¤¹¡£Outline¤¬°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤³¤È¤ò³Îǧ¤·¤Æ²¼¤µ¤¤¡£
¡¡IResizerActivity¤Î¡ÖÊݸ¡×¥Ü¥¿¥ó¤Ë±þÅú¤¹¤ë¤¿¤á¡¢onClick¤Îswitch¤Ë°Ê²¼¤Îcase¤òÄɲä·¤Þ¤¹¡£

¡¡¡¦LinearLayout~
¡¡¡¡¡¦Result
     case R.id.Save:
         showConfirmDialog();
         break;

¡¡¥ê¥¹¥È3-11¤¬showConfirmDialog¥á¥½¥Ã¥É¤Ë¤Ê¤ê¤Þ¤¹¡£DateFormat¡¢TextView¤Î¥Ñ¥Ã¥±¡¼¥¸import¤âÄɲ䷤Ʋ¼¤µ¤¤¡£

¡¡Result¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤Î¼ÂÁõ¤ò¿Ê¤á¤ëÁ°¤Ë¡¢FFindActivity¤Î½¤Àµ¤ò¹Ô¤¤¤Þ¤¹¡£FFindActivity¤Ç¤Ï·ë²Ìɽ¼¨¤ò¹Ô¤ï¤Ê¤¯¤Ê¤ë¤¿¤á¡¢¤Þ¤º¤Ï¥ì¥¤¥¢¥¦¥Èmain¤«¤éResult¥Æ¥­¥¹¥È¥Ü¥Ã¥¯¥¹¤òºï½ü¤·¤Þ¤¹¡£

¡¡¼¡¤ËFFindActivity.java¤ò³«¤­¡¢¸¡º÷¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤µ¤ì¤¿ºÝ¤Î½èÍý¤òÊѹ¹¤·¤Þ¤¹¡Ê¥ê¥¹¥È2-17¡Ë¡£

-¥ê¥¹¥È2-17 :
 @Override
 public void onClick(View view) {
     if (view.getId() == R.id.FindButton) {
         EditText text;
         text = (EditText) findViewById(R.id.FindTarget);
         String target = text.getText().toString();
-¥ê¥¹¥È3-11 : 
 private void showConfirmDialog() {
     if ((mBitmap != null)
             && (mWSize.getText().toString().trim().equals("") == false)
             && (mHSize.getText().toString().trim().equals("") == false)) {
         long ctime = System.currentTimeMillis();
         mFileName = DateFormat.format("yyyyMMdd_kkmmss", ctime).toString() + ".jpg";
 
         if (target.equals("") == false) {
             Intent intent = new Intent(getApplicationContext(),
                 com.beatcraft.ffind.ResultActivity.class);
             intent.putExtra("Target", target);
             startActivity(intent);
         }
         mDialog = new Dialog(this);
         mDialog.setContentView(R.layout.dialog);
         mDialog.setTitle(getString(R.string.save_title));
         Button button;
         button = (Button) mDialog.findViewById(R.id.ExecSave);
         button.setOnClickListener(this);
         button = (Button) mDialog.findViewById(R.id.Cancel);
         button.setOnClickListener(this);
         TextView tv;
         tv = (TextView) mDialog.findViewById(R.id.FileName);
         tv.setText(mFileName);
         tv = (TextView) mDialog.findViewById(R.id.ImageSize);
         tv.setText(mWSize.getText().toString() + "x" + mHSize.getText().toString());
         mDialog.show();
     }
 }
~

¡¡FindTask¤òÀ¸À®¤·¡¢¸¡º÷½èÍý¤ò¼Â¹Ô¤·¤Æ¤¤¤¿²Õ½ê¤¬Êѹ¹¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Intent¤Ï¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤ä¥¢¥×¥ê¥±¡¼¥·¥ç¥ó´Ö¤Ç¾ðÊó¤ò¤ä¤ê¼è¤ê¤¹¤ë¤¿¤á¤Î¥á¥Ã¥»¡¼¥¸¥ª¥Ö¥¸¥§¥¯¥È¡Ö¥¤¥ó¥Æ¥ó¥È¡×¤ò¼è¤ê°·¤¦¥¯¥é¥¹¤Ç¡¢¤³¤³¤Ç¤ÏFFindActivity¤«¤éResultActivity¤ò¸Æ¤Ó½Ð¤¹¤¿¤á¤Ë»ÈÍѤ·¤Æ¤¤¤Þ¤¹¡£ÆóÈÖÌܤΰú¿ô¤Ë¡Öcom.beatcraft.ffind.ResultActivity.class¡×¤ÈÅϤ¹¤³¤È¤Ç¡¢¤³¤Î¥¤¥ó¥Æ¥ó¥È¤ÎÁ÷¿®Àè¤òÌÀ¼¨Åª¤Ë»ØÄꤷ¤Æ¤¤¤Þ¤¹¡£~
¡¡Â³¤¯putExtra¥á¥½¥Ã¥É¤Ç¤Ï¡¢¥¤¥ó¥Æ¥ó¥È¤òÁ÷¿®¤¹¤ëºÝ¤ËźÉÕ¤¹¤ë¾ðÊó¤òÄɲ䷤Ƥ¤¤Þ¤¹¡£¤³¤³¤Ç¤Ï¸¡º÷¥­¡¼¥ï¡¼¥É¤Ç¤¢¤ëʸ»úÎótarget¤ò¡¢¡ÖTarget¡×¤È¤¤¤¦Ì¾Á°¤ò¤Ä¤±¤ÆźÉÕ¤·¤Æ¤¤¤Þ¤¹¡£~
¡¡ºÇ¸å¤ËstartActivity¤Ç¥¤¥ó¥Æ¥ó¥È¤òÁ÷¿®¤·¡¢ResultActivity¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£
¡¡¥ê¥µ¥¤¥º¸µ²èÁü¤È¥ê¥µ¥¤¥º²òÁüÅÙ¤¬¶õ¤Ç¤Ê¤¤¤³¤È¤ò³Îǧ¤·¡¢¸½ºßÆü»þ¤«¤é¡ÖYYYYMMDD_HHMMSS.jpg¡×·Á¼°¤Î¥Õ¥¡¥¤¥ë̾¤òºîÀ®¡¢ÊÝ»ý¤·¤Æ¤ª¤­¤Þ¤¹¡£~
¡¡¼¡¤ËDialog¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤·¤ÆÀè¤Û¤É¤Î¥ì¥¤¥¢¥¦¥È¤ò³ä¤êÅö¤Æ¡¢¡ÖÊݸ¡×¡Ö¼è¾Ã¡×ξ¥Ü¥¿¥ó¤ÎOnClickListener¤òIResizerActivity¤Ë¡¢À¸À®¤·¤¿¥Õ¥¡¥¤¥ë̾¤È¥ê¥µ¥¤¥º¸å¤Î²èÁü¥µ¥¤¥º¤ò¥À¥¤¥¢¥í¥°¤Î³Æ¹àÌܤ˥»¥Ã¥È¤·¤Æ¥À¥¤¥¢¥í¥°¤òɽ¼¨¤·¤Þ¤¹¡£

¡¡¤³¤ì¤Þ¤ÇFFindActivity¤Ç¹Ô¤Ê¤Ã¤Æ¤¤¤¿¸¡º÷½èÍý¤È·ë²Ìɽ¼¨¤ÏResultActivity¤Ç¹Ô¤¦¤¿¤á¡¢°Ê²¼¤Î¥á¥ó¥ÐÊÑ¿ô¤È3¤Ä¤Î¥á¥½¥Ã¥É¤òFFindActivity¤«¤é¤Ïºï½ü¤·¡¢ResultActivity¤Ë°ÜÆ°¤·¤Þ¤¹¡£FFindActivity¤ÎonCreate¤Ç¹Ô¤Ê¤Ã¤Æ¤¤¤¿mList¤ÎÀ¸À®½èÍý¤ÈString¥á¥ó¥ÐÊÑ¿ômResult¤âÉÔÍפȤʤ뤿¤á¤¢¤ï¤»¤Æºï½ü¤·¤Æ²¼¤µ¤¤¡£
¡¡¥À¥¤¥¢¥í¥°¤Îξ¥Ü¥¿¥ó¤Ë±þÅú¤¹¤ë¤¿¤á¡¢onClick¤Îswitch¤Ë°Ê²¼¤Îcase¤òÄɲä·¤Þ¤¹¡£

 private ArrayList<String> mList;
 public void listFile(String target)
 public void result()
 private void listFile(String target, String folder, ArrayList<String> list)
     case R.id.ExecSave:
     case R.id.Cancel:
         if (mDialog != null) {
             if (id == R.id.ExecSave) {
                 execSave();
             }
             mDialog.dismiss();
             mDialog = null;
         }
         break;
~

¡¡¤³¤ì¤ÇFFindActivity.java¤Î½¤Àµ¤Ï´°Î»¤Ç¤¹¡£Â³¤¤¤ÆResultActivity.java¤ò³«¤­¡¢É¬ÍפʽèÍý¤ÎÄɲäÈFFindActivity¤«¤é°Ü¿¢¤·¤¿¥á¥½¥Ã¥É¤Î½¤Àµ¤ò¹Ô¤¤¤Þ¤¹¡£ 
¡¡¡ÖÊݸ¡×¡Ö¼è¾Ã¡×ξ¥Ü¥¿¥ó¤È¤â¡¢¥À¥¤¥¢¥í¥°¤¬null¤Ç¤Ê¤±¤ì¤Ðdismiss¥á¥½¥Ã¥É¤ÇÇË´þ¤·¤Æ¤¤¤Þ¤¹¡£ID¤¬ExecSave¡¢¤¹¤Ê¤ï¤Á¡ÖÊݸ¡×¥Ü¥¿¥ó¤Î¾ì¹ç¤Ë¤Ï¼ÂºÝ¤ÎÊݸ½èÍý¤ò¹Ô¤¦execSave¤ò¸Æ¤Ó½Ð¤·¤Þ¤¹¡£~
¡¡¥ê¥¹¥È3-12¤¬execSave¥á¥½¥Ã¥É¤Ë¤Ê¤ê¤Þ¤¹¡£Toast¤Î¥Ñ¥Ã¥±¡¼¥¸import¤â˺¤ì¤º¤Ë¹Ô¤Ê¤Ã¤Æ²¼¤µ¤¤¡£

¡¡¤Þ¤º¤ÏonCreate¤ò½¤Àµ¤·¤Þ¤¹¡£setContentView¸Æ¤Ó½Ð¤·¤Î¤¢¤È¤Ë¡¢¼¡¤ÎÆâÍƤòÄɲä·¤Þ¤¹¡Ê¥ê¥¹¥È2-18¡Ë¡£

-¥ê¥¹¥È2-18 :
 mList = new ArrayList<String>();
          
 Intent intent = getIntent();
 if (intent == null) {
     finish();
-¥ê¥¹¥È3-12 : 
 private void execSave() {
     int w = Integer.parseInt(mWSize.getText().toString());
     int h = Integer.parseInt(mHSize.getText().toString());
     Bitmap bitmap = Bitmap.createScaledBitmap(mBitmap, w, h, true);
 
     try {
         MediaStore.Images.Media.insertImage(getContentResolver(), bitmap, mFileName, null);
         Toast.makeText(this, getString(R.string.save_success), Toast.LENGTH_SHORT).show();
     }
     catch (Exception e) {
         e.printStackTrace();
         Toast.makeText(this, getString(R.string.save_failed), Toast.LENGTH_SHORT).show();
     }
 }
 String target = intent.getStringExtra("Target");
 FindTask task = new FindTask(this);
 task.execute(target);
~

¡¡ºÇ½é¤ËFFindActivity¤«¤é°ú¤­·Ñ¤¤¤ÀArrayList¤ÎÀ¸À®¤ò¹Ô¤Ê¤Ã¤¿¤¢¤È¡¢Â³¤¯getIntent¥á¥½¥Ã¥É¤Ç¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¸Æ¤Ó½Ð¤·»þ¤ËÁ÷¿®¤µ¤ì¤¿¥¤¥ó¥Æ¥ó¥È¤ò¼èÆÀ¤·¤Æ¤¤¤Þ¤¹¡£¤³¤Î¥¤¥ó¥Æ¥ó¥È¤«¤é¸¡º÷¥­¡¼¥ï¡¼¥É¤ò¼õ¤±¼è¤ë¤¿¤á¡¢¤ß¤Ä¤«¤é¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¤Ïfinish¥á¥½¥Ã¥É¤Ç¤³¤Î¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤ò½ªÎ»¤µ¤»¤Þ¤¹¡£~
¡¡getStringExtra¤Ï¥¤¥ó¥Æ¥ó¥È¤«¤éʸ»úÎ󥿥¤¥×¤ÎźÉեǡ¼¥¿¤ò¼èÆÀ¤¹¤ë¥á¥½¥Ã¥É¤Ç¡¢¤³¤³¤Ç¤Ï¡ÖTarget¡×¤È¤¤¤¦Ì¾Á°¤ÎźÉեǡ¼¥¿¤ò¼èÆÀ¤·¡¢¤³¤ì¤ò¥­¡¼¥ï¡¼¥É¤È¤·¤ÆFindTask¤Î¥Õ¥¡¥¤¥ë¸¡º÷¤ò¼Â¹Ô¤·¤Æ¤¤¤Þ¤¹¡£
¡¡²£/½Ä¥µ¥¤¥ºÍÑEditText¤«¤é¥µ¥¤¥º¤ò¼èÆÀ¤·¤¿¤é¡¢Bitmap.createScaledBitmap¤Ë¸µ²èÁü¤È¥µ¥¤¥º¤ò°ú¤­ÅϤ·¤Æ¥ê¥µ¥¤¥º²èÁü¤òÀ¸À®¤·¤Þ¤¹¡£~
¡¡À¸À®¤·¤¿²èÁü¤òMediaStore.Images.Media.insertImage¥á¥½¥Ã¥É¤Ë°ú¤­ÅϤ¹¤È¥«¥á¥é¥Õ¥©¥ë¥À¤Ë²èÁü¤¬Êݸ¤µ¤ì¡¢ContentResolver¤Ë¤è¤ê¥®¥ã¥é¥ê¡¼¤Ë¤âɽ¼¨¤µ¤ì¤ë¤è¤¦ÅÐÏ¿¤µ¤ì¤Þ¤¹¡£¤³¤Î¥á¥½¥Ã¥É¤ÏFileNotFoundExeceptionÎã³°¤òȯ¹Ô¤¹¤ë²ÄǽÀ­¤¬¤¢¤ë¤¿¤átry¥Ö¥í¥Ã¥¯¤Ç°Ï¤ß¡¢catch¥Ö¥í¥Ã¥¯¤Ç¤ÏÊݸ¼ºÇÔ»þ¤Î¥á¥Ã¥»¡¼¥¸¤òToast¤Çɽ¼¨¤¹¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤Þ¤¹¡£

¡¡FindTask¤«¤é¸Æ¤Ó½Ð¤µ¤ì¤ëlistFile¤Ïprivate¤ÎlistFile¥á¥½¥Ã¥É¤Î¤ß¤ËÊѹ¹¤·¤Þ¤¹¡Ê¥ê¥¹¥È2-19¡Ë¡£
¡¡¤³¤ì¤Ç¥ê¥µ¥¤¥º²èÁü¤òÊݸ¤¹¤ë¤³¤È¤¬½ÐÍè¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤·¤¿¡£¿Þ3-8¤Î¤è¤¦¤Ê¥À¥¤¥¢¥í¥°¤¬É½¼¨¤µ¤ì¤ë¤³¤È¤ò³Îǧ¤·¡¢¼ÂºÝ¤ËÊݸ¤·¤Æ¤ß¤Þ¤·¤ç¤¦¡£

-¥ê¥¹¥È2-19 :
 public void listFile(String target) {
     listFile(target, "/", mList);
 }
CENTER:&ref(./03_08.png,);
CENTER:¿Þ3-8~
~

¡¡result¥á¥½¥Ã¥É¤Ç¤Ï·ë²Ì¤ÎÀßÄê¤òEditText¤«¤éListView¤Îʪ¤ØÊѹ¹¤ò¹Ô¤¤¤Þ¤¹¡Ê¥ê¥¹¥È2-20¡Ë¡£
¡¡Êݸ¤Ë¼ºÇÔ¤¹¤ë¾ì¹ç¡¢ÊݸÀ褬³°Éô¥¹¥È¥ì¡¼¥¸¤Ë¤Ê¤Ã¤Æ¤¤¤ë²ÄǽÀ­¤¬¤¢¤ê¤Þ¤¹¡£IResizer¤Î¥Þ¥Ë¥Õ¥§¥¹¥È¥Õ¥¡¥¤¥ë¤ò³«¤¤¤Æ¡¢¼¡¤Î¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó¤òÄɲ䷤Ʋ¼¤µ¤¤¡£

-¥ê¥¹¥È2-20 :
 public void result() {
     if (mList.size() > 0) {
         ListView lv = (ListView) findViewById(R.id.Result);
         String sa[] = new String[mList.size()];
         for (int i = 0; i < mList.size(); ++i) {
             sa[i] = mList.get(i);
         }
         ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
             android.R.layout.simple_list_item_1, sa);
         lv.setAdapter(adapter);
     }
     else {
         Toast.makeText(this, "* NOT FOUND *", Toast.LENGTH_SHORT).show();
     }
 }
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
~

¡¡ListView¤Ï¥¢¥À¥×¥¿¡¼¤È¸Æ¤Ð¤ì¤ë¥¯¥é¥¹¤Ç¥ê¥¹¥È¥Ç¡¼¥¿¤È·ë¤ÓÉÕ¤±¤é¤ì¤Þ¤¹¡£¥¢¥À¥×¥¿¡¼¤Ë¤Ï¤¤¤í¤¤¤í¤Ê¼ïÎब¤¢¤ê¤Þ¤¹¤¬¡¢¤³¤³¤Ç¤Ïʸ»úÎóÇÛÎó¤ò¼è¤ê°·¤¦¤¿¤á¡¢ÇÛÎóÍÑ¥¢¥À¥×¥¿¡¼¤Î¥Æ¥ó¥×¥ì¡¼¥È¥¯¥é¥¹ArrayAdapter¤ò»ÈÍѤ·¤Æ¤¤¤Þ¤¹¡£~
¡¡ArrayAdapter¤Ç¤Ï¥ê¥¹¥È¥Ó¥å¡¼¤Î³ÆÍ×Áǡʥꥹ¥È¥¢¥¤¥Æ¥à¡Ë¤òɽ¼¨¤¹¤ëºÝ¤Ë»ÈÍѤ¹¤ë¥ì¥¤¥¢¥¦¥È¤ò»ØÄꤹ¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¤¬¡¢º£²ó»ÈÍѤ·¤Æ¤¤¤ë¡Öandroid.R.layout.simple_list_item_1¡×¤ÏAndroid¤¬É¸½à¤ÇÍÑ°Õ¤·¤Æ¤¤¤ë¥ì¥¤¥¢¥¦¥È¥ê¥½¡¼¥¹¤Ç¡¢TextView¤ò1¤Ä´Þ¤à¤À¤±¤Îñ½ã¤Ê¥ì¥¤¥¢¥¦¥È¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£¤³¤ÎTextView¤Ë¥ê¥¹¥È¥Ç¡¼¥¿Ãæ¤Î³Æʸ»úÎó¤¬É½¼¨¤µ¤ì¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£~
¡¡ArrayList¤«¤éʸ»úÎóÇÛÎó¤òºîÀ®¤·¡¢¤³¤Î¥Ç¡¼¥¿¤ò¤â¤È¤ËºîÀ®¤·¤¿ArrayAdapter¤òListView¤ÎsetAdapter¥á¥½¥Ã¥É¤Ç´ØÏ¢ÉÕ¤±¤Æ¤¤¤Þ¤¹¡£
**3-6. ¶¦Í­µ¡Ç½¤Ë¤è¤ë¾¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤«¤é¤Î¸Æ¤Ó½Ð¤· [#k99c8e4c]

¡¡ºÇ¸å¤ËFindTask.java¤ò³«¤­¡¢FFindActivity¤È¤Ê¤Ã¤Æ¤¤¤ë²Õ½ê¤òÁ´¤ÆResultActivity¤Ë½ñ¤­´¹¤¨¤ì¤Ð¥½¡¼¥¹¥³¡¼¥É¤Î½¤Àµ¤Ï´°Î»¤Ç¤¹¡£
¡¡Á°¹à¤Þ¤Ç¤Ç¥¤¥ó¥Æ¥ó¥È¤òÍøÍѤ·¤Æ³°Éô¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ÈÏ¢·È¤·¡¢¥Ç¡¼¥¿¤Î¤ä¤ê¼è¤ê¤ò¹Ô¤¦¤³¤È¤¬½ÐÍè¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤·¤¿¤¬¡¢¤â¤¦¾¯¤·¿Ê¤á¤Æ¡¢Android¤Î¶¦Í­µ¡Ç½¤òÍøÍѤ·¤Æ¾¤Î²èÁü¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤«¤éIResizer¤Ø²èÁü¤òÁ÷¿®½ÐÍè¤ë¤è¤¦¤Ë¤·¤Æ¤ß¤Þ¤·¤ç¤¦¡£

¡¡»Ä¤ëºî¶È¤Ï¥Þ¥Ë¥Õ¥§¥¹¥È¤Î½¤Àµ¤Ç¤¹¡£Äɲä·¤¿ResultActivity¤òÍøÍѲÄǽ¤Ë¤¹¤ë¤Ë¤Ï¡¢¥Þ¥Ë¥Õ¥§¥¹¥È¤Ç¤³¤ì¤òÀë¸À¤·¤Ê¤±¤ì¤Ð¤¤¤±¤Þ¤»¤ó¡£Package Explorer¤«¤éAndroidManifest.xml¤ò³«¤­¡¢FFindActivity¤òÀë¸À¤·¤Æ¤¤¤ëactivityÍ×ÁǤΤ¢¤È¤Ë°Ê²¼¤òÄɲä·¤Þ¤¹¡Ê¥ê¥¹¥È2-21¡Ë¡£
¡¡²èÁü¤Î¶¦Í­Àè¤È¤·¤ÆIResizer¤òÁªÂò²Äǽ¤Ë¤¹¤ë¤Ë¤Ï¡¢¥¢¥¯¥Æ¥£¥Ó¥Æ¥£¤Ëandroid.intent.action.SEND¥¤¥ó¥Æ¥ó¥È¥Õ¥£¥ë¥¿¡¼¤òÄɲ乤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£IResizer¤Î¥Þ¥Ë¥Õ¥§¥¹¥È¥Õ¥¡¥¤¥ë¤ò³«¤­¡¢IResizerActivity¤Ë°Ê²¼¤òÄɲ䷤Ʋ¼¤µ¤¤¡£

-¥ê¥¹¥È2-21 :
 <activity
     android:label="@string/app_name"
     android:name=".ResultActivity" >
 </activity>
             <intent-filter >
                 <category android:name="android.intent.category.DEFAULT" />
 
                 <data android:mimeType="image/*" />
 
                 <action android:name="android.intent.action.SEND" />
             </intent-filter>
~

¡¡°Ê¾å¤ÇÁ´¤Æ¤Î½¤Àµ¤¬´°Î»¤·¤Þ¤·¤¿¡£Áᮼ¹Ԥ·¤Æ¤ß¤Þ¤·¤ç¤¦¡Ê¿Þ2-11¡Ë¡£
¡¡¤³¤ì¤Ç²èÁü¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¶¦Í­¥á¥Ë¥å¡¼¤ËIResizer¤¬É½¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£°ú¤­Â³¤­³°Éô¤«¤é¤Î¶¦Í­¤ò½èÍý½ÐÍè¤ë¤è¤¦¡¢IResizerActivity.java¤ËÊѹ¹¤ò²Ã¤¨¤Æ¤¤¤­¤Þ¤¹¡£IResizerActivity¤ÎonCreate¥á¥½¥Ã¥É¤ÇsetupUI¤ò¸Æ¤Ó½Ð¤·¤¿¸å¤Ë¡¢°Ê²¼¤Î¤è¤¦¤ËÄɲ䷤Ʋ¼¤µ¤¤¡£

CENTER:&ref(./02_11.png,);
CENTER:¿Þ2-11~
         if(Intent.ACTION_SEND.equals(getIntent().getAction())) {
              Uri uri = getIntent().getParcelableExtra(Intent.EXTRA_STREAM);
              mBitmap = getImage(uri);
              setPreview();
         }
~

¡¡¤³¤ì¤Ç´°À®¤Ç¤¹¡£¥®¥ã¥é¥ê¡¼¤Ê¤É¤Î¶¦Í­µ¡Ç½¤ò»ý¤Ã¤¿²èÁü¥¢¥×¥ê¤òµ¯Æ°¤·¡¢¶¦Í­¥á¥Ë¥å¡¼¤ËIResizer¤¬É½¼¨¤µ¤ì¤ë¤Î¤ò³Îǧ¤·¤Æ¤ß¤Þ¤·¤ç¤¦¡Ê¿Þ3-9¡Ë¡£

CENTER:&ref(./03_09.png,);
CENTER:¿Þ3-9~
~

**2-8. FFindÁ´¥½¡¼¥¹¥³¡¼¥É/XML¥Õ¥¡¥¤¥ë [#h2f70468]
**3-7. IResizerÁ´¥½¡¼¥¹¥³¡¼¥É/XML¥Õ¥¡¥¤¥ë [#mbd93e73]

-¥ê¥¹¥È2-22 FFindActivity.java :
-¥ê¥¹¥È3-13 IResizerActivity.java : 
 package com.beatcraft.iresizer;
 
 import java.io.InputStream;
 import java.math.BigDecimal;
 
 import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.ContentValues;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.res.Configuration;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.net.Uri;
 import android.os.Bundle;
 import android.provider.MediaStore;
 import android.text.format.DateFormat;
 import android.view.View;
 import android.view.Window;
 import android.widget.Button;
 import android.widget.CheckBox;
 import android.widget.EditText;
 import android.widget.ImageView;
 import android.widget.TextView;
 import android.widget.Toast;
 
 public class FFindActivity extends Activity {
     /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);
 public class IResizerActivity extends Activity implements View.OnClickListener {
      public static final int REQUEST_SELECT_IMAGE = 1234;
      public static final int REQUEST_TAKE_PHOTO = 1235;
 
         Button button = (Button) findViewById(R.id.FindButton);
         if (button != null) {
              button.setOnClickListener(new View.OnClickListener() {
                   @Override
                   public void onClick(View view) {
                        if (view.getId() == R.id.FindButton) {
                            EditText text;
                            text = (EditText) findViewById(R.id.FindTarget);
                            String target = text.getText().toString();
      private ImageView mPreview;
      private EditText mWSize;
      private EditText mHSize;
 
                            if (target.equals("") == false) {
                                 Intent intent = new Intent(getApplicationContext(),
                                    com.beatcraft.ffind.ResultActivity.class);
                                 intent.putExtra("Target", target);
                                 startActivity(intent);
                            }
                        }
                   }
              });
         }
     }
 }
~
~

-¥ê¥¹¥È2-23 ResultActivity.java :
 package com.beatcraft.ffind;
      private Bitmap mBitmap = null;
      private int mOrgW = 0;
      private int mOrgH = 0;
 
 import java.io.File;
 import java.util.ArrayList;
      private Uri mUriFromCamera;
 
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.widget.ArrayAdapter;
 import android.widget.ListView;
 import android.widget.Toast;
      private String mFileName = "";
      private Dialog mDialog = null;
 
 public class ResultActivity extends Activity {
      private ArrayList<String> mList;
 
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.result);
           requestWindowFeature(Window.FEATURE_NO_TITLE);
           setupUI();
 
         mList = new ArrayList<String>();
          
           Intent intent = getIntent();
           if (intent == null) {
                finish();
           if (Intent.ACTION_SEND.equals(getIntent().getAction())) {
                Uri uri = getIntent().getParcelableExtra(Intent.EXTRA_STREAM);
                mBitmap = getImage(uri);
                setPreview();
           }
           String target = intent.getStringExtra("Target");
           FindTask task = new FindTask(this);
           task.execute(target);
      }
 
     public void listFile(String target) {
          listFile(target, "/", mList);
     }
      @Override
      public void onConfigurationChanged(Configuration newConfig) {
           super.onConfigurationChanged(newConfig);
           setupUI();
      }
 
     public void result() {
           if (mList.size() > 0) {
                ListView lv = (ListView) findViewById(R.id.Result);
                String sa[] = new String[mList.size()];
                for (int i = 0; i < mList.size(); ++i) {
                     sa[i] = mList.get(i);
      @Override
      public void onClick(View view) {
           int id = view.getId();
 
           switch (id) {
           case R.id.SelectImage:
                selectImage();
                break;
 
           case R.id.TakePhoto:
                takePhoto();
                break;
 
           case R.id.Save:
                showConfirmDialog();
                break;
 
           case R.id.ExecSave:
           case R.id.Cancel:
                if (mDialog != null) {
                     if (id == R.id.ExecSave) {
                          execSave();
                     }
                     mDialog.dismiss();
                     mDialog = null;
                }
                ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                     android.R.layout.simple_list_item_1, sa);
                lv.setAdapter(adapter);
                break;
           }
           else {
                Toast.makeText(this, "* NOT FOUND *", Toast.LENGTH_SHORT).show();
      }
 
      protected void onActivityResult(int reqCode, int result, Intent data) {
           super.onActivityResult(reqCode, result, data);
 
           Uri uri = null;
 
           if (result == RESULT_OK) {
                if (reqCode == REQUEST_SELECT_IMAGE) {
                     uri = data.getData();
                } else if (reqCode == REQUEST_TAKE_PHOTO) {
                     uri = mUriFromCamera;
                }
                mBitmap = getImage(uri);
                setPreview();
           } else if (reqCode == REQUEST_TAKE_PHOTO) {
                getContentResolver().delete(mUriFromCamera, null, null);
           }
     }
      }
 
     private void listFile(String target, String folder, ArrayList<String> list) {
          File f = new File(folder);
          File fl[] = f.listFiles();
          if (fl != null) {
              for (int i = 0; i < fl.length; ++i) {
                   if (list.size() == 5000) {
                        break;
                   }
      private void setupUI() {
           setContentView(R.layout.main);
 
                   File tmp = fl[i];
                   String name = tmp.getName();
                   if (name.contains(target) == true) {
                       list.add(name);
                   }
                   if (tmp.isDirectory() == true) {
                        try {
                             String c = tmp.getAbsolutePath();
                             if (c.equals(tmp.getCanonicalPath()) == true) {
                                 if (c != null) {
                                     listFile(target, c, list);
                                 }                               
                            }
                        }
                        catch (Exception e) {
                             e.printStackTrace();
                        }
                   }
              }
          }
     }
 }
~
~

-¥ê¥¹¥È2-24 FindTask.java :
 package com.beatcraft.ffind;
           Button button;
           button = (Button) findViewById(R.id.SelectImage);
           button.setOnClickListener(this);
 
 import android.app.ProgressDialog;
 import android.os.AsyncTask;
           button = (Button) findViewById(R.id.TakePhoto);
           button.setOnClickListener(this);
 
 public class FindTask extends AsyncTask<String, Integer, Void> {
      private ResultActivity mActivity;
      private ProgressDialog mDialog;
           button = (Button) findViewById(R.id.Save);
           button.setOnClickListener(this);
 
      public FindTask(ResultActivity activity) {
           mActivity = activity;
           mPreview = (ImageView) findViewById(R.id.Preview);
           mWSize = (EditText) findViewById(R.id.WSize);
           mHSize = (EditText) findViewById(R.id.HSize);
           setPreview();
 
           mWSize.setOnFocusChangeListener(new View.OnFocusChangeListener() {
                @Override
                public void onFocusChange(View v, boolean flag) {
                     if (flag == false) {
                          CheckBox keepRatio = (CheckBox) findViewById(R.id.KeepRatio);
                          if (keepRatio.isChecked() == true) {
                               String base = mWSize.getText().toString().trim();
                               if ((base.equals("") == false) && (mOrgW != 0)
                                         && (mOrgH != 0)) {
                                    double h = 0;
                                    double w = Integer.parseInt(base);
                                    double ratio = (double) mOrgH / (double) mOrgW;
                                    h = new BigDecimal(w * ratio).setScale(0,
                                              BigDecimal.ROUND_HALF_UP).doubleValue();
                                    if (h < 1.0) {
                                         h = 1.0;
                                    }
                                    mHSize.setText(String.valueOf((int) h));
                               }
                          }
                     }
                }
           });
           mHSize.setOnFocusChangeListener(new View.OnFocusChangeListener() {
                @Override
                public void onFocusChange(View v, boolean flag) {
                     if (flag == false) {
                          CheckBox keepRatio = (CheckBox) findViewById(R.id.KeepRatio);
                          if (keepRatio.isChecked() == true) {
                               String base = mHSize.getText().toString().trim();
                               if ((base.equals("") == false) && (mOrgW != 0)
                                         && (mOrgH != 0)) {
                                    double w = 0;
                                    double h = Integer.parseInt(base);
                                    double ratio = (double) mOrgW / (double) mOrgH;
                                    w = new BigDecimal(h * ratio).setScale(0,
                                              BigDecimal.ROUND_HALF_UP).doubleValue();
                                    if (w < 1.0) {
                                         w = 1.0;
                                    }
                                    mWSize.setText(String.valueOf((int) w));
                               }
                          }
                     }
                }
           });
      }
 
      @Override
      protected void onPreExecute() {
           mDialog = new ProgressDialog(mActivity);
           mDialog.setMessage(mActivity.getString(R.string.find_progress));
           mDialog.show();
      private void selectImage() {
           try {
                Intent intent = new Intent(Intent.ACTION_PICK);
                intent.setType("image/*");
                startActivityForResult(intent, REQUEST_SELECT_IMAGE);
           } catch (Exception e) {
                AlertDialog.Builder builder = null;
                builder = new AlertDialog.Builder(this);
                builder.setMessage(getString(R.string.app_notfound));
                builder.setNeutralButton("OK",
                          new DialogInterface.OnClickListener() {
                               @Override
                               public void onClick(DialogInterface dialog, int which) {
                               }
                          });
                builder.show();
           }
      }
    
      @Override
      protected Void doInBackground(String... arg0) {
           String target = arg0[0];
           mActivity.listFile(target);
           return null;
 
      private void takePhoto() {
           try {
                Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                ContentValues values = new ContentValues();
                values.put(MediaStore.Images.Media.MIME_TYPE, "image/*");
                mUriFromCamera = getContentResolver().insert(
                          MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
                intent.putExtra(MediaStore.EXTRA_OUTPUT, mUriFromCamera);
                startActivityForResult(intent, REQUEST_TAKE_PHOTO);
           } catch (Exception e) {
                AlertDialog.Builder builder = null;
                builder = new AlertDialog.Builder(this);
                builder.setMessage(getString(R.string.app_notfound));
                builder.setNeutralButton("OK",
                          new DialogInterface.OnClickListener() {
                               @Override
                               public void onClick(DialogInterface dialog, int which) {
                               }
                          });
                builder.show();
           }
      }
 
      @Override
      protected void onPostExecute(Void v) {
           mDialog.dismiss();
           mDialog = null;
           mActivity.result();
           mActivity = null;
      private void showConfirmDialog() {
           if ((mBitmap != null)
                     && (mWSize.getText().toString().trim().equals("") == false)
                     && (mHSize.getText().toString().trim().equals("") == false)) {
                long ctime = System.currentTimeMillis();
                mFileName = DateFormat.format("yyyyMMdd_kkmmss", ctime).toString()
                          + ".jpg";
 
                mDialog = new Dialog(this);
                mDialog.setContentView(R.layout.dialog);
                mDialog.setTitle(getString(R.string.save_title));
                Button button;
                button = (Button) mDialog.findViewById(R.id.ExecSave);
                button.setOnClickListener(this);
                button = (Button) mDialog.findViewById(R.id.Cancel);
                button.setOnClickListener(this);
                TextView tv;
                tv = (TextView) mDialog.findViewById(R.id.FileName);
                tv.setText(mFileName);
                tv = (TextView) mDialog.findViewById(R.id.ImageSize);
                tv.setText(mWSize.getText().toString() + "x"
                          + mHSize.getText().toString());
                mDialog.show();
           }
      }
 
      private void execSave() {
          int w = Integer.parseInt(mWSize.getText().toString());
           int h = Integer.parseInt(mHSize.getText().toString());
           Bitmap bitmap = Bitmap.createScaledBitmap(mBitmap, w, h, true);
 
           try {
                MediaStore.Images.Media.insertImage(getContentResolver(), bitmap,
                          mFileName, null);
                Toast.makeText(this, getString(R.string.save_success),
                          Toast.LENGTH_SHORT).show();
           } catch (Exception e) {
                e.printStackTrace();
                Toast.makeText(this, getString(R.string.save_failed),
                          Toast.LENGTH_SHORT).show();
           }
      }
 
      private Bitmap getImage(Uri uri) {
           try {
                InputStream is = getContentResolver().openInputStream(uri);
                return BitmapFactory.decodeStream(is);
           } catch (Exception e) {
                e.printStackTrace();
                return null;
           }
      }
 
      private void setPreview() {
           if (mBitmap != null) {
                mOrgW = mBitmap.getWidth();
                mOrgH = mBitmap.getHeight();
                mWSize.setText(String.valueOf(mOrgW));
                mHSize.setText(String.valueOf(mOrgH));
                mPreview.setImageBitmap(mBitmap);
           }
      }
 }
~
~

-¥ê¥¹¥È2-25 main.xml :
-¥ê¥¹¥È3-14 controller.xml : 
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:orientation="vertical" >
 
     <Button
         android:id="@+id/SelectImage"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_marginLeft="10dip"
         android:layout_marginRight="10dip"
         android:text="@string/select_image" />
 
     <Button
         android:id="@+id/TakePhoto"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_marginLeft="10dip"
         android:layout_marginRight="10dip"
         android:text="@string/take_photo" />
 
     <LinearLayout
         android:id="@+id/linearLayout1"
         android:layout_width="match_parent"
         android:layout_height="wrap_content" >
         android:id="@+id/WLayout"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_marginLeft="10dip"
         android:layout_marginRight="10dip" >
 
         <TextView
             android:id="@+id/WLabel"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="@string/label_w" />
 
         <EditText
             android:id="@+id/FindTarget"
             android:id="@+id/WSize"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_weight="1"
             android:singleLine="true" >
             android:inputType="number" >
 
             <requestFocus />
         </EditText>
 
         <Button
             android:id="@+id/FindButton"
         <TextView
             android:id="@+id/WSuffix"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="@string/find_button" />
             android:text="px" />
     </LinearLayout>
 
     <LinearLayout
         android:id="@+id/HLayout"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_marginLeft="10dip"
         android:layout_marginRight="10dip" >
 
         <TextView
             android:id="@+id/HLabel"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="@string/label_h" />
 
         <EditText
             android:id="@+id/HSize"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_weight="1"
             android:inputType="number" >
         </EditText>
 
         <TextView
             android:id="@+id/HSuffix"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="px" />
     </LinearLayout>
 
     <CheckBox
         android:id="@+id/KeepRatio"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_marginLeft="10dip"
         android:layout_marginRight="10dip"
         android:checked="true"
         android:text="@string/keep_ratio" />
 
     <Button
         android:id="@+id/Save"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_marginLeft="10dip"
         android:layout_marginRight="10dip"
         android:text="@string/save" />
 
 </LinearLayout>
~
~

-¥ê¥¹¥È2-26 result.xml :
-¥ê¥¹¥È3-15 layout/main.xml : 
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:orientation="vertical" >
 
     <ListView
         android:id="@+id/Result"
     <ImageView
         android:id="@+id/Preview"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent" >
     </ListView>
         android:layout_height="0dip"
         android:layout_margin="5dip"
         android:layout_weight="1"
         android:adjustViewBounds="true"
         android:scaleType="fitCenter" />
 
     <include
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         layout="@layout/controller" />
 
 </LinearLayout>
~

-¥ê¥¹¥È3-16 layout-land/main.xml : 
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:orientation="horizontal" >
 
     <ImageView
         android:id="@+id/Preview"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:layout_margin="5dip"
         android:layout_weight="1"
         android:adjustViewBounds="true"
         android:scaleType="fitCenter" />
 
     <include
         android:layout_width="wrap_content"
         android:layout_height="fill_parent"
         layout="@layout/controller" />
 
 </LinearLayout>
~

-¥ê¥¹¥È2-27 AndroidManifest.xml :
-¥ê¥¹¥È3-17 dialog.xml : 
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:orientation="vertical" >
 
     <LinearLayout
         android:id="@+id/FileNameLayout"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_marginLeft="5dip"
         android:layout_marginRight="5dip" >
 
         <TextView
             android:id="@+id/FileLabel"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="@string/filename_label" />
 
         <TextView
             android:id="@+id/FileName"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginLeft="5dip"
             android:layout_weight="1" />
     </LinearLayout>
 
     <LinearLayout
         android:id="@+id/ImageSizeLayout"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_marginLeft="5dip"
         android:layout_marginRight="5dip" >
 
         <TextView
             android:id="@+id/SizeLabel"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="@string/isize_label" />
 
         <TextView
             android:id="@+id/ImageSize"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginLeft="5dip"
             android:layout_weight="1" />
     </LinearLayout>
 
     <TextView
         android:id="@+id/Description"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_marginLeft="5dip"
         android:layout_marginRight="5dip"
         android:gravity="right"
         android:text="@string/save_desc" />
 
     <LinearLayout
         android:id="@+id/ButtonLayout"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_marginTop="10dip"
         android:gravity="center_horizontal" >
 
         <Button
             android:id="@+id/ExecSave"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="@string/save" />
 
         <Button
             android:id="@+id/Cancel"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="@string/cancel" />
     </LinearLayout>
 
 </LinearLayout>
~

-¥ê¥¹¥È3-18 AndroidManifest.xml : 
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.beatcraft.ffind"
     package="com.beatcraft.iresizer"
     android:versionCode="1"
     android:versionName="1.0" >
 
     <uses-sdk android:minSdkVersion="8" />
     <uses-sdk android:minSdkVersion="7" />
 
     <application
         android:icon="@drawable/ic_launcher"
         android:label="@string/app_name" >
         <activity
             android:configChanges="orientation"
             android:label="@string/app_name"
             android:name=".FFindActivity" >
             android:name=".IResizerActivity" >
             <intent-filter >
                 <action android:name="android.intent.action.MAIN" />
 
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
             <intent-filter >
                 <category android:name="android.intent.category.DEFAULT" />
 
                 <data android:mimeType="image/*" />
 
                 <action android:name="android.intent.action.SEND" />
             </intent-filter>
         </activity>
         <activity
             android:label="@string/app_name"
             android:name=".ResultActivity" >
         </activity>
     </application>
 
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
 
 </manifest>
~


----
RIGHT:ÆâÆ£


BC::labs¤Ø¤Î¼ÁÌä¤Ï¡¢bc9-dev ¡÷ googlegroups.com¡¡¤Þ¤Ç¤ª´ê¤¤Ãפ·¤Þ¤¹¡£
¥È¥Ã¥×   ¿·µ¬ °ìÍ÷ ñ¸ì¸¡º÷ ºÇ½ª¹¹¿·   ºÇ½ª¹¹¿·¤ÎRSS