목록Android/Tip&Tech (399)
올해는 머신러닝이다.
출처 : http://hmkcode.com/android-custom-listview-titles-icons-counter/ Android | Custom ListView with Titles, Icons & Counter You can customize the ListView by providing a new layout for the list items “rows”. The new layout can be more than just a single TextView. Here will see how to develop a custom ListView with items having leading icons “ImageView“, trailing counters “TextView” and some tex..
출처 : http://www.kmshack.kr/323 Android View와 관련된 오픈소스들이 많이 공개 되고 있다. 그래서 많이 쓰이고 유용한 오픈소스를 정리 해보았다. 아직 국내에서는 오픈소스가 인색한지 모두 외국에서 만든것들이다. 나도 View관련 오픈소스를 하나준비 하겠다고 준비중인데.. 준비중이기만 하다. 참고로, 잘 알려지고 검증된 오픈소스라도 코드를 하나하나씩 보고 어떻게 구현되어 있는지 꼭 살펴보고 썼으면 좋겠다. 그리고 이제 개발을 시작한지 얼마 안된 분들이라면 이런 오픈소스를 사용함으로 자기 실력을 죽일 수도 있으니 한번씩 구현해보는 것도 좋을듯 하다. 그리고 국내 개발 커뮤니티에 보면 자기가 개발할 것에 대해 오픈소스를 찾음으로써 개발해서 삽질 하기전에 찾아서 다행이다라는 글들을..
출처 : http://kahdev.wordpress.com/2008/09/13/making-a-custom-android-button-using-a-custom-view/ Creating a custom view is as simple as inheriting from the View class and overriding the methods that need to be overridden. In this example, a custom button is implemented in this way. The button shall feature a labelled image (i.e. an image with text underneath). 1 public class CustomImageButton ext..
출처 : http://javaexpert.tistory.com/179#comment9420256 기본적으로 SlidingDrawer 는 오른쪽에서 왼쪽으로 밖에 지원이 안되는가?? -- 왼쪽에서 밀면훨씬편한데.. ㅋㅋ 이것이 xml 코드 public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.subware); drawer = (SlidingDrawer)findViewById(R.id.slidingDrawer); drawer.setOnDrawerScrollListener(new Slid..
출처 : http://blog.naver.com/PostView.nhn?blogId=rosaria1113&logNo=107988257&parentCategoryNo=&categoryNo=76&viewDate=&isShowPopularPosts=false&from=postView
펌 : http://muzesong.tistory.com/38 안드로이드를 하다보면 액티비티가 계속 쌓이는 경우가 있다. 이 경우는 시스템 적으로 아무래도 부담이되고, 물론 눈에 보일정도로 그런다기보다 계속 그렇게 쌓다보면 뒤로가기를 한참을 눌러야 밖으로 빠져나가게 되는 불상사가 생긴다. 이럴 경우 현재 액티비티나 현재액티비티가 아닌 다른 액티비티를 종료시켜서 액티비티를 줄이는 방법이있는데, 우선 현재 액티비티를 죽이는 방법은 간단하다. 어떠한 작업을 완료하고 액티비티를 종료하기를 원한다면 작업 완료 다음줄에 finish(); 이것만 적어주면 된다. 이렇게 되면 저 함수를 만나는 즉시 현재 액티비티가 종료된다. 하지만 A 액티비티에서 B액티비티를 갔는데 A액티비티를 죽이고 싶다면 이렇게 하면된다. 우선 ..
출처 : http://www.kmshack.kr/249 mainActivity.java public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); intentMyService = new Intent(this,PersistentService.class); // 죽지않는 좀비 서비스 receiver = new RestartService(); // 리시버 등록 try{ IntentFilter mainFilter = new IntentFilter("com.jongbum.ServiceTest.ssss"); // xml에서 정의해도 됨 registerReceiver(..
출처 : https://github.com/johannilsson/android-pulltorefresh Pull To Refresh for Android This project aims to provide a reusable pull to refresh widget for Android. Repository at https://github.com/johannilsson/android-pulltorefresh. Usage Layout Activity // Set a listener to be invoked when the list should be refreshed. ((PullToRefreshListView) getListView()).setOnRefreshListener(new OnRefreshLis..
출처 : http://www.kmshack.kr/346 얼마전 ListView 포퍼먼스 팁에 관한 블로그 포스팅을 한적이 있다. Adapter에서 View의 재활용과 함께 ViewHolder Pattern으로 findViewById를 View생성 시점에 setTag()를 하여 재활용에 대해 언급 했다. 이 방법은 각 ListView의 ViewItem별로 각각의 ViewHolder를 가지고 있어야 한다. ListView의 아이템별로 서로 다른 디자인이 필요하기에 View의 종류가 달라 질 수 밖에 없기때문에 ViewHolder도 각각 존재 할 수 밖에 없다. 이렇게 static하게 ViewHolder을 가지고 있는것 보다 유연하게 ViewHolder를 생성 할 수 있는 코드를 생성하는 방법에 대해서 알아보..
출처 : http://www.techrepublic.com/blog/software-engineer/create-a-transparent-progress-dialog-on-android/ A game development hobby project inspired this app developer to figure out a way to create a transparent progress dialog that animates an image. He describes how to do it. Over the last year I've been working hard in my spare time writing a multiplayer game for mobile devices. It's slow going..
[안드로이드] Event 처리 메커니즘 출처 : http://ecogeo.tistory.com/251 안드로이드의 이벤트 처리 과정에 대한 글(http://blog.naver.com/osk1004?Redirect=Log&logNo=50069078782 )을 참조하여 나름대로 분석하여 메모한 결과를 적어본다. 개략적인 이벤트 처리 과정 액티비티 생성시 액티비티의 윈도우를 WindowManagerService에 등록해둠 이벤트 발생시 네이티브 라이브러리(EventHub)를 통해 이벤트 읽음 이벤트 큐(KeyInputQueue)에 이벤트 쌓임 이벤트 디스패치 쓰레드(InputDispatcherThread)는 이벤트큐에서 이벤트를 꺼내어 WindowManagerService의 디스패치 메소드 호출 WindowM..
출처 : http://www.coremodeling.com/android/tutorial/AppWidget/AppWidget.html App Widget 작성자 : 고덕한(deokhan.koh@gmail.com) 소속 : 코아모델링(www.coremodeling.com) 작성일자 : 2011년 9월 22일 Android 홈페이지에 있는 App Widget 문서를 번역하면서 AppWidget 에 대한 개념과 개발하는 방법을 익히도록 합니다. URL 은 http://developer.android.com/guide/topics/appwidgets/index.html 클릭하면 됩니다. App Widget 은 Home Screen 에 보여지는 것과 같이 다른 Application 에 Embedded 될 수 있고..
http://blog.naver.com/PostView.nhn?blogId=huewu&logNo=110099015747&parentCategoryNo=&categoryNo=&viewDate=&isShowPopularPosts=false&from=postView
http://blog.daum.net/hopefullife/226
- Eclipse 자주 쓰는 단축키 - - Eclipse 자주 쓰는 단축키 - ----- 실행 ----- Ctrl + F11 : 바로 전에 실행했던 클래스 실행 ----- 소스 네비게이션 ----- Ctrl + 마우스커서(혹은 F3) : 클래스나 메소드 혹은 멤버를 상세하게 검색하고자 할때 Alt + Left, Alt + Right : 이후, 이전 Ctrl + O : 해당 소스의 메소드 리스트를 확인하려 할때 F4 : 클래스명을 선택하고 누르면 해당 클래스의 Hierarchy 를 볼 수 있다. Alt + ) : 이전(다음) 작업 화면 ----- 문자열 찾기 ----- Ctrl + K : 찾고자 하는 문자열을 블럭으로 설정한 후 키를 누른다. Ctrl + Shift + K : 역으로 찾고자 하는 문자열을 ..
http://arabiannight.tistory.com/trackback/346
In this post I’ll show how you can take a screenshot of your current Activity and save the resulting image on /sdcard. The idea behind taking a screenshot actually is pretty simple: what we need to do is to get a reference of the root view and generate a bitmap copy of this view. Considering that we want to take the screenshot when a button is clicked, the code will look like this: findViewById(..
를 코드로 구현하기 StateListDrawable states = new StateListDrawable(); states.addState(new int[] {android.R.attr.state_pressed}, getResources().getDrawable(R.drawable.pressed)); states.addState(new int[] {android.R.attr.state_focused}, getResources().getDrawable(R.drawable.focused)); states.addState(new int[] { }, getResources().getDrawable(R.drawable.normal)); imageView.setImageDrawable(states);[출처] XM..
1. 환경설정 개요 (Preferences) 안드로이드 플랫폼은 Data를 저장하는 방법으로 환경설정(이하 Preferences), 파일, Local DB, 네트워크를 제공한다. 그 중 Preferences는 가장 간단하게 정보를 저장하는 방법(mechanism)을 제공하며, App이나 그 컴포넌트 (Activity, Service 등)의 환경 설정 정보를 저장/복원하는 용도로 사용된다. ▌Preferences의 형태▐ 안드로이드에서 Preferences는 ListView의 형태로 표현되며 쉬운 Preferences의 구현을 위해 PreferenceActivity 클래스를 제공한다. PreferenceActivity 클래스는 XML 기반의 Preference 정의 문서를 통해 App 파일 저장소에 Pre..
어디서 주은 PPT인데 나름 괜찮은 설명들이 있긴 하다.
출처 : http://blog.daum.net/maleny/89 최근에 인터넷을 배회하다가 저가의 타블렛 PC 하나를 발견하고 앱 개발 테스트용으로 사용하고 다니면서 E-BOOK 이나 읽을 용도로 구입했다. 자체 데이터 통신 기능도 없고 전화기능도 없고 당연히 DMB도 안되고 GPS 도 안되지만 KT 의 Egg 를 들고 다니니까 Wi-Fi 를 이용한 웹 서핑 등 여러가지 필요는 충족 시킬 수 있을 것이라 판단했다. 일단 인터넷 연결을 통한 여러가지 필요한 작업은 만족 스러웠고 AlphaBiz 의 Mobile Client 역활도 잘 수행한다. 다만 스마트폰의 사이즈에 맞게 앱을 만들엇기에 큰 기기에서는 화면이 영 개판 오분.. 하긴 이 타블렛을 산 이유도 이 개판 오분전을 잡기 위해서 이었지만. 문제는 이..
출처 : http://blog.rochdev.com/2011/05/update-ui-when-holding-button.html#!/2011/05/update-ui-when-holding-button.html I got this question recently so thought I would share one of the solutions. What we want is simply to update the user interface when holding down a button. The code should be pretty self-explanatory. The first thing we do is to create a custom button and override events. Then in t..
import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.util.Config; import android.util.TypedValue; import android.view.Display; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.KeyEvent; import android.widget.Button; import android.widget.TextView; public class Calculator extends Activity { EventListene..
App Widget 이란 Home Screen에 노출되는 miniature Application입니다. 보통 시계 어플등이 Widget 형태로 존재 하게 됩니다. App Widget을 구현에 필요 한것들 A. 꼭 필요 한것들 1. AppWidgetProviderInfo object - App Widget을 위한 MetaData, update frequecy 나 layout에 대한 정의. - XML 에 정의 되어야함. 2. AppWidgetProvider - Programming Interface - AppWidget이 Update/Enabled/Disabled/Delete되었을때, BroadCast를 받는 Receiver역할을 한다. 3. View Layout - AppWidget Design , And..
public static void showAsPopup(Activity activity) { //To show activity as dialog and dim the background, you need to declare android:theme="@style/PopupTheme" on for the chosen activity on the manifest activity.requestWindowFeature(Window.FEATURE_ACTION_BAR); activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND, WindowManager.LayoutParams.FLAG_DIM_BEHIND); LayoutParams params..
내부적으로 android:id를 이용을 하고 있어서 따로 커스트마이징을 해서 지정을 해줘야함..귀찮음.. package com.example.setupproject; import android.content.Context; import android.preference.SwitchPreference; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.Checkable; import android.widget.CompoundButton; import android.widget.Switch; public class MySwitchWidget extends S..
출처 : http://lsit81.tistory.com/33 며칠전 BitmapFactory.Options.inPurgeable에 대한 내용을 올렸는데요. BitmapFactory.Options에 대한 정리가 필요할 것 같아 주요 옵션에 대하여 정리를 해보았습니다. 1. Image Width, Height 정보만 가져오기. : BitmapFactory.Options.inJustDecodeBounds = true 이렇게 사용할 경우 Image를 메모리로 로드하지 않은 상태로 Image의 width, height 정보만을 가져올 수 있습니다. ? 1 2 3 4 5 6 BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inJustDecodeBoun..
출처 : http://givenjazz.tistory.com/53 클래스파일: Create9Patch.class 안드로이드는 해상도가 다르다고 해도 같은 화면으로 보여주기 위해 이미지를 늘려주는 나인패치라는 포맷을 사용합니다. 주로 draw9patch라는 툴을 사용합니다만 이걸 만드는 작업이 여간 귀찮은 게 아닙니다. 9패치 만드는 게 너무 귀찮아서 간단히 만들었는데 생각보다 쓸만해서 공개합니다. 그냥 상하좌우 5픽셀 떨어진 곳부터 5픽셀짜리 나인패치를 그려주는 게 전부입니다. 그럼 어떻게 되느냐? 예제를 보면 더 이해가 빠르실 겁니다. 5픽셀짜리 영역을 만들면 위처럼 5픽을 자동으로 지정만 해줘도 그라데이션이 들어가 있는 버튼도 생각보다 깔끔하게 확대가 됩니다. 사용법은 이 글에 첨부된 Create9P..
퍼옴 : http://blog.naver.com/PostView.nhn?blogId=nimbusob&logNo=147715066&parentCategoryNo=&categoryNo=&viewDate=&isShowPopularPosts=false&from=postView 앞선 포스트 Android 개발가이드 - Bitmap.recycle()은 가급적 호출해 주는 편이 좋다. 에서는 명시적인 오브젝트 해제의 필요성을 알아보았다. VM 을 사용하는 언어에서 코딩함에도, c 스타일의 리소스 해제를 왜 해주어야 하는지에 대한 내용이었다. (안드로이드 프레임웍의 문제 및 특수성, 한정적인 VM Heap size 와 같은 이유 등) 그러나 안드로이드의 내부 동작으로 인해 Bitmap.recycle() 과는 별개로 v..