------

[ AD ] Port Monitor ( Try to use a Best WebSite Monitoring Tool )

------

자동 완성 기능 - 안나올때

Window - Preferences - Java - Editor - Content Asist
- (Auto-activation) - Enable (auto-activation)

위와 같이 해주면 된다.




자동완성 기능 - 목록이 나오지 않을때..

'0.일반개발' 카테고리의 다른 글

대체 편집기 /  (0) 2010.10.07
단축키  (0) 2010.10.07
AsyncTask 왜 사용해야 하나? 흠...  (0) 2010.10.06
안드로이드 user permission 전부 전체 리스트  (0) 2010.10.05
Eclipse 사용법들  (0) 2010.10.05
http://goo.gl/70pR 

Painless Threading
고통 없는 쓰레드

AsyncTask를 사용하거나  사용하지 않더라도, 항상 기억하라 두가지 법칙 싱글 쓰레드 모델에서

Regardless of whether or not you use AsyncTask, always remember these two rules about the single thread model:

  1. Do not block the UI thread, and 

UI 쓰레드를 묶어 두지 말라

 

  1. Make sure that you access the Android UI toolkit only on the UI thread.

오직 UI 쓰레드 위에서만 안드로이드 UI 툴킷을 접근한다는 것을 명심하라

AsyncTask just makes it easier to do both of these things.

AsyncTask는 단지 이런 것의 모두를 쉽게 만들어 준다.



  • You can specify the type, using generics, of the parameters, the progress values and the final value of the task
  • The method doInBackground() executes automatically on a worker thread
  • onPreExecute(), onPostExecute() and onProgressUpdate() are all invoked on the UI thread
  • The value returned by doInBackground() is sent to onPostExecute()
  • You can call publishProgress() at anytime in doInBackground() to execute onProgressUpdate() on the UI thread
  • You can cancel the task at any time, from any thread

  • source code of Shelves (ShelvesActivity.java and AddBookActivity.java)

     Photostream (LoginActivity.java, PhotostreamActivity.java and ViewPhotoActivity.java)


    We highly recommend reading the source code of Shelves to see
    how to persist tasks across configuration changes and
    how to cancel them properly when the activity is destroyed.
    어떻게 액티비티가 파괴될때 그것들을 적절하게 취소하는가


    사용법
    클래스화
     private class DownloadFilesTask extends AsyncTask {     protected Long doInBackground(URL... urls) {         int count = urls.length;         long totalSize = 0;         for (int i = 0; i < count; i++) {             totalSize += Downloader.downloadFile(urls[i]);             publishProgress((int) ((i / (float) count) * 100));         }         return totalSize;     }     protected void onProgressUpdate(Integer... progress) {         setProgressPercent(progress[0]);     }     protected void onPostExecute(Long result) {         showDialog("Downloaded " + result + " bytes");     } }
    

    생성,행
    new DownloadFilesTask().execute(url1, url2, url3);
    


    안드로이드 user permission 전부 전체 리스트


    인터넷 연결  : android.permission.INTERNET
    진동 :
    android.permission.VIBRATE

    http://goo.gl/9uMa 안드로이드 개발자 사이트 문서


    Constants
    String ACCESS_CHECKIN_PROPERTIES Allows read/write access to the "properties" table in the checkin database, to change values that get uploaded.
    String ACCESS_COARSE_LOCATION Allows an application to access coarse (e.g., Cell-ID, WiFi) location
    String ACCESS_FINE_LOCATION Allows an application to access fine (e.g., GPS) location (위치수신)
    String ACCESS_LOCATION_EXTRA_COMMANDS Allows an application to access extra location provider commands
    String ACCESS_MOCK_LOCATION Allows an application to create mock location providers for testing
    String ACCESS_NETWORK_STATE Allows applications to access information about networks
    String ACCESS_SURFACE_FLINGER Allows an application to use SurfaceFlinger's low level features
    String ACCESS_WIFI_STATE Allows applications to access information about Wi-Fi networks (연결상태)
    String ACCOUNT_MANAGER Allows applications to call into AccountAuthenticators.
    String AUTHENTICATE_ACCOUNTS Allows an application to act as an AccountAuthenticator for the AccountManager
    String BATTERY_STATS Allows an application to collect battery statistics
    String BIND_APPWIDGET Allows an application to tell the AppWidget service which application can access AppWidget's data.
    String BIND_DEVICE_ADMIN Must be required by device administration receiver, to ensure that only the system can interact with it.
    String BIND_INPUT_METHOD Must be required by an InputMethodService, to ensure that only the system can bind to it.
    String BIND_WALLPAPER Must be required by a WallpaperService, to ensure that only the system can bind to it.
    String BLUETOOTH Allows applications to connect to paired bluetooth devices
    String BLUETOOTH_ADMIN Allows applications to discover and pair bluetooth devices
    String BRICK Required to be able to disable the device (very dangerous!).
    String BROADCAST_PACKAGE_REMOVED Allows an application to broadcast a notification that an application package has been removed.
    String BROADCAST_SMS Allows an application to broadcast an SMS receipt notification
    String BROADCAST_STICKY Allows an application to broadcast sticky intents.
    String BROADCAST_WAP_PUSH Allows an application to broadcast a WAP PUSH receipt notification
    String CALL_PHONE Allows an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call being placed.
    String CALL_PRIVILEGED Allows an application to call any phone number, including emergency numbers, without going through the Dialer user interface for the user to confirm the call being placed.
    String CAMERA Required to be able to access the camera device.(카메라)
    String CHANGE_COMPONENT_ENABLED_STATE Allows an application to change whether an application component (other than its own) is enabled or not.
    String CHANGE_CONFIGURATION Allows an application to modify the current configuration, such as locale.
    String CHANGE_NETWORK_STATE Allows applications to change network connectivity state
    String CHANGE_WIFI_MULTICAST_STATE Allows applications to enter Wi-Fi Multicast mode
    String CHANGE_WIFI_STATE Allows applications to change Wi-Fi connectivity state
    String CLEAR_APP_CACHE Allows an application to clear the caches of all installed applications on the device.
    String CLEAR_APP_USER_DATA Allows an application to clear user data
    String CONTROL_LOCATION_UPDATES Allows enabling/disabling location update notifications from the radio.
    String DELETE_CACHE_FILES Allows an application to delete cache files.
    String DELETE_PACKAGES Allows an application to delete packages.
    String DEVICE_POWER Allows low-level access to power management
    String DIAGNOSTIC Allows applications to RW to diagnostic resources.
    String DISABLE_KEYGUARD Allows applications to disable the keyguard
    String DUMP Allows an application to retrieve state dump information from system services.(덤프)
    String EXPAND_STATUS_BAR Allows an application to expand or collapse the status bar.
    String FACTORY_TEST Run as a manufacturer test application, running as the root user.
    String FLASHLIGHT Allows access to the flashlight
    String FORCE_BACK Allows an application to force a BACK operation on whatever is the top activity.
    String GET_ACCOUNTS Allows access to the list of accounts in the Accounts Service
    String GET_PACKAGE_SIZE Allows an application to find out the space used by any package.
    String GET_TASKS Allows an application to get information about the currently or recently running tasks: a thumbnail representation of the tasks, what activities are running in it, etc.
    String GLOBAL_SEARCH This permission can be used on content providers to allow the global search system to access their data.
    String HARDWARE_TEST Allows access to hardware peripherals.
    String INJECT_EVENTS Allows an application to inject user events (keys, touch, trackball) into the event stream and deliver them to ANY window.
    String INSTALL_LOCATION_PROVIDER Allows an application to install a location provider into the Location Manager
    String INSTALL_PACKAGES Allows an application to install packages.
    String INTERNAL_SYSTEM_WINDOW Allows an application to open windows that are for use by parts of the system user interface.
    String INTERNET Allows applications to open network sockets.(인터넷)
    String KILL_BACKGROUND_PROCESSES Allows an application to call killBackgroundProcesses(String).
    String MANAGE_ACCOUNTS Allows an application to manage the list of accounts in the AccountManager
    String MANAGE_APP_TOKENS Allows an application to manage (create, destroy, Z-order) application tokens in the window manager.
    String MASTER_CLEAR
    String MODIFY_AUDIO_SETTINGS Allows an application to modify global audio settings
    String MODIFY_PHONE_STATE Allows modification of the telephony state - power on, mmi, etc.
    String MOUNT_FORMAT_FILESYSTEMS Allows formatting file systems for removable storage.
    String MOUNT_UNMOUNT_FILESYSTEMS Allows mounting and unmounting file systems for removable storage.
    String PERSISTENT_ACTIVITY Allow an application to make its activities persistent.
    String PROCESS_OUTGOING_CALLS Allows an application to monitor, modify, or abort outgoing calls.
    String READ_CALENDAR Allows an application to read the user's calendar data.
    String READ_CONTACTS Allows an application to read the user's contacts data.
    String READ_FRAME_BUFFER Allows an application to take screen shots and more generally get access to the frame buffer data
    String READ_HISTORY_BOOKMARKS Allows an application to read (but not write) the user's browsing history and bookmarks.
    String READ_INPUT_STATE Allows an application to retrieve the current state of keys and switches.
    String READ_LOGS Allows an application to read the low-level system log files.
    String READ_OWNER_DATA Allows an application to read the owner's data.
    String READ_PHONE_STATE Allows read only access to phone state.
    String READ_SMS Allows an application to read SMS messages.(문자읽기)
    String READ_SYNC_SETTINGS Allows applications to read the sync settings
    String READ_SYNC_STATS Allows applications to read the sync stats
    String REBOOT Required to be able to reboot the device.
    String RECEIVE_BOOT_COMPLETED Allows an application to receive the ACTION_BOOT_COMPLETED that is broadcast after the system finishes booting.
    String RECEIVE_MMS Allows an application to monitor incoming MMS messages, to record or perform processing on them.
    String RECEIVE_SMS Allows an application to monitor incoming SMS messages, to record or perform processing on them.
    String RECEIVE_WAP_PUSH Allows an application to monitor incoming WAP push messages.
    String RECORD_AUDIO Allows an application to record audio
    String REORDER_TASKS Allows an application to change the Z-order of tasks
    String RESTART_PACKAGES This constant is deprecated. The restartPackage(String) API is no longer supported.
    String SEND_SMS Allows an application to send SMS messages.(문자보내기)
    String SET_ACTIVITY_WATCHER Allows an application to watch and control how activities are started globally in the system.
    String SET_ALWAYS_FINISH Allows an application to control whether activities are immediately finished when put in the background.
    String SET_ANIMATION_SCALE Modify the global animation scaling factor.
    String SET_DEBUG_APP Configure an application for debugging.
    String SET_ORIENTATION Allows low-level access to setting the orientation (actually rotation) of the screen.
    String SET_PREFERRED_APPLICATIONS This constant is deprecated. No longer useful, see addPackageToPreferred(String) for details.
    String SET_PROCESS_LIMIT Allows an application to set the maximum number of (not needed) application processes that can be running.
    String SET_TIME Allows applications to set the system time
    String SET_TIME_ZONE Allows applications to set the system time zone
    String SET_WALLPAPER Allows applications to set the wallpaper
    String SET_WALLPAPER_HINTS Allows applications to set the wallpaper hints
    String SIGNAL_PERSISTENT_PROCESSES Allow an application to request that a signal be sent to all persistent processes
    String STATUS_BAR Allows an application to open, close, or disable the status bar and its icons.
    String SUBSCRIBED_FEEDS_READ Allows an application to allow access the subscribed feeds ContentProvider.
    String SUBSCRIBED_FEEDS_WRITE
    String SYSTEM_ALERT_WINDOW Allows an application to open windows using the type TYPE_SYSTEM_ALERT, shown on top of all other applications.
    String UPDATE_DEVICE_STATS Allows an application to update device statistics.
    String USE_CREDENTIALS Allows an application to request authtokens from the AccountManager
    String VIBRATE Allows access to the vibrator (진동)
    String WAKE_LOCK Allows using PowerManager WakeLocks to keep processor from sleeping or screen from dimming
    String WRITE_APN_SETTINGS Allows applications to write the apn settings
    String WRITE_CALENDAR Allows an application to write (but not read) the user's calendar data.(일정쓰기)
    String WRITE_CONTACTS Allows an application to write (but not read) the user's contacts data.
    String WRITE_EXTERNAL_STORAGE Allows an application to write to external storage (외부 저장소,SDCARD)
    String WRITE_GSERVICES Allows an application to modify the Google service map.
    String WRITE_HISTORY_BOOKMARKS Allows an application to write (but not read) the user's browsing history and bookmarks.
    String WRITE_OWNER_DATA Allows an application to write (but not read) the owner's data.
    String WRITE_SECURE_SETTINGS Allows an application to read or write the secure system settings.
    String WRITE_SETTINGS Allows an application to read or write the system settings.
    String WRITE_SMS Allows an application to write SMS messages.
    String WRITE_SYNC_SETTINGS Allows applications to write the sync settings

    Eclipse 사용법들

    - 소스 폴더(Source Folder)를 분리하는 경우

    각 소스 폴더별로 Output folder를 지정할 수 있음.

    프로젝트 >> Property >> Java Build Path >> Source탭 에서

    Default output folder는 지정하고 Allow output folders for source folders를 체크한다.

    이때 각 source folder마다 output folder를 지정할 수 있는 항목이 생겨 이를 지정하면 된다.

    - Jar 파일 자동으로 생성하기

    먼저 해당 소스와 리소스를 선택한 후 마우스 오른쪽 클릭 메뉴에서 Export를 선택함.

    첫쨔페이지: export destination 선택(Java >> JAR File)

    둘째페이지: export destination Jar File 지정 (JAR File)

    셋째페이지: Save the description of this JAR in the workspace 선택

    => 셋째페이지에서 지정된 위치에 Description file이 생성되며

    이 file에 오른 마우스 클릭 후 Create A JAR를 선택하면 지정된 jar 파일이 자동 생성된다.

    이 file에 오른 마우스 클릭 후 Open Jar Packager를 선택하여 설정을 재변경할 수 있다.

    - library 묶어주기

    수 많은 lib을 하나씩 묶어주면 프로젝트가 지저분해 진다.

    이 때는 Property >> Java Build Path >> Libraries 탭에서 Add Library >> User Library 후

    개인의 취향에 맞게 Library를 등록하면 해당 이름으로 묶여질뿐 아니라 향후 재사용하기 쉽다.

    - jar에 Java Source Attchment하기

    jar파일을 include한 상태에서 해당 jar의 소스가 있으면 이 소스를 볼 수 있는 방법임.

    해당 jar에서 오른 마우스 클릭 후 Properties >> Java Source Attachment 에 Location Path에 소스의 위치를 입력함.

    - Package Explorer와 Navigator의 차이

    Package Explorer는 프로젝트의 타입에 따라 필요한 파일들만 표시됨. (예, Dynamic Web Project에서 classes파일이 안 보이지만 )

    Navigator는 일종의 탐색기로 모든 파일들이 다 표시됨. (예, Navigator에서는 classes파일이 보임.)

    - 단축키

    1. Ctrl+M: 작업화면 최대화

    2. Ctrl+Shift+O: import하기

    3. Shift+Alt+X: 실행하기(T: JUNIT, J: POJO)

    4. Ctrl+/: Comment In/Out

    5. Ctrl+k: 문자 찾기 (반대로는 Ctrl+Shift+k)

    Ctrl+j: 입력하면서 문자 찾기 (status창에서 입력할 수 있음. 사용하기 편함)

    6. Shitf+F2: Java Doc 열기

    7. F4: 해당 클래스의 Hierachy 보기



    전화 기록 CallLog는

    getContentResolver().query( Calls.CONTENT_URI,

    정상 작동한다.


    content://sms/inbox 문제점

    sms문자 내용을 가져오는데 HTC Desire정상이나. Samsung Galaxy S비정상으로 가져 오지 못한다.

    하지만..문자 기록을 가져오는 것은

    Uri.parse("content://sms/");

    가 삼성 갤럭시 에스 에서는 되지 않는다?

    도대체 삼성은 공개된 표준을 왜 ?????/

    android.permission.READ_SMS
    android.permission.WRITE_SMS
    HTML
    Touch button
    

    CSS :
    .btn {
       text-indent: -9999px;
       display: block;
       width: 200px; /* 버튼 넓이 */
       height: 50px; /* 버튼 높이 */
       background: transparent url(img/button.png) no-repeat;
    }
    .btn:active {
       background: transparent url(img/button_press.png) no-repeat;
    }
    
    

    jQuery(JS)
    .btn { /* 위와동일 */
       text-indent: -9999px;
       display: block;
       width: 200px;
       height: 50px;
       background: transparent url(img/button.png) no-repeat;
    }
    .btn.active { /* :active를 .active로 수정 */
       background: transparent url(img/button_press.png) no-repeat;
    }
    
    

    http://goo.gl/86fR  WebDevMobile 웹 개발 모바일
    안드로이드 샘플 예제인 Snake가 키보드로만 제어가 된다?

    스마트폰에서는 어떻게 하지? 헐~~~

    디자이어에서 할려고 하니...
      1) 버튼을 달까  
      2) 아침 터치 좌표값을 받아서 현재 위치랑 비교해서 변환해서 할까?

    흠...

    Snake 터치 버튼 추가

    수정하기...

    흠..


    레이아웃
    
    	
    	
    		
    		 
    			
    						
    			
    			
    				
    	
    	
    		
    		
    	
    
    
    메인 Activity
    implements OnClickListener  {
    
    
    
            // 방향키
            ImageView up = (ImageView)findViewById(R.id.buttonU);
            up.setOnClickListener(this);
            ImageView dn = (ImageView)findViewById(R.id.buttonD);
            dn.setOnClickListener(this);
            ImageView left = (ImageView)findViewById(R.id.buttonL);
            left.setOnClickListener(this);
            ImageView right = (ImageView)findViewById(R.id.buttonR);
            right.setOnClickListener(this);
    
    
    	@Override
    	public void onClick(View v) {
    		// TODO Auto-generated method stub
    		if ( mSnakeView.getMode() !=SnakeView.RUNNING ) return;
    		switch( v.getId() )
    		{
    		case R.id.buttonL:
    			Log.d(ICICLE_KEY,"onClick : R.id.buttonL"  );
    			
                if (mSnakeView.getDirection()!= SnakeView.EAST) {
                	mSnakeView.setmNextDirection( SnakeView.WEST );
                }
                
    			break;
    		case R.id.buttonR:
    			Log.d(ICICLE_KEY,"onClick : R.id.buttonR"  );
    			
                if (mSnakeView.getDirection()!= SnakeView.WEST) {
                	mSnakeView.setmNextDirection( SnakeView.EAST );
                }
                
    			break;
    
    		case R.id.buttonU:
    			Log.d(ICICLE_KEY,"onClick : R.id.buttonU"  );
    			
                if (mSnakeView.getDirection()!= SnakeView.SOUTH) {
                	mSnakeView.setmNextDirection( SnakeView.NORTH );
                }
      
    			break;
    		case R.id.buttonD:
    			Log.d(ICICLE_KEY,"onClick : R.id.buttonD"  );
                if (mSnakeView.getDirection()!= SnakeView.NORTH) {
                	mSnakeView.setmNextDirection( SnakeView.SOUTH );
                }
    
    			break;
    		}
    	}
    
    

    뷰 수정하기
    
    	public int getMode() {
    		return mMode;
    	}
    
    	public int getDirection() {
    		return mDirection;
    	}
    
    	public void setDirection(int Direction) {
    		this.mDirection = Direction;
    	}
    
    	public int getNextDirection() {
    		return mNextDirection;
    	}
    
    	public void setmNextDirection(int NextDirection) {
    		this.mNextDirection = NextDirection;
    	}
    
    


     Hi all.

    I develop an android application for Galaxy S that use UrlConnection for incomming stream connection.

    Here is my my code:
    public static InputStream getInputStream(String path) throws Exception {
                URL aURL = new URL(path);
                URLConnection conn = aURL.openConnection();            
                conn.connect();
                InputStream is = conn.getInputStream();
                return is;
    }

    That code worked properly during application session, but sometimes it generates exception
    java.net.UnknownHostException: Host is unresolved: www.myserver.com:80
            at java.net.Socket.connect(Socket.java:1037)
            at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62)
            at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager$ConnectionPool.getHttpConnection(HttpConnectionManager.java:145)
            at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection(HttpConnectionManager.java:67)
            at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection(HttpURLConnection.java:821)
            at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:807)
            at DownloadService.getInputStream(DownloadService.java:496)

    I can repeat this bug on device and on emulator. 


    PS
    Here is another code that also throws those exception
    public static InputStream getInputStream(String path) throws Exception {
                InputStream is = new URI(path).toURL().openStream();
                return is;
    }

    + Recent posts