본문 바로가기

전체 글53

Android DownloadManager 처리 WebView에서 Download를 구현해줄 때 서버에서 MIME이나 Filename을 제대로 주지 않는 경우가 많다. 따라서 다음과 같은 기본 뼈다구 작성.. webview.setDownloadListener(new DownloadListener() {@SuppressLint("DefaultLocale")@Overridepublic void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {MimeTypeMap mtm = MimeTypeMap.getSingleton();DownloadManager downloadManager = (DownloadManage.. 2012. 12. 17.
C# 에서 중복 프로그램 실행 방지하기 Program.cs에서 IO랑 Diagnostics 쓴다고 선언해주고~using System.IO; using System.Diagnostics; Main에서 Process있나 체크하고 있으면 현재 프로그램을 종료string processName = Path.GetFileNameWithoutExtension(Application.ExecutablePath); Process[] processes = System.Diagnostics.Process.GetProcessesByName(processName); if (processes.Length > 1) { MessageBox.Show("There is already another instance of the application running"); Appli.. 2012. 11. 14.
안드로이드 서비스나 액티비티에서 위젯의 onUpdate 호출하기 ACTION_APPWIDGET_UPDATE를 Broadcast하면 되는데 이때 Extra로 Widget ID를 넣어 주어야 한다. 다음과 같은 방법으로 위젯 ID들을 획득할 수 있다. mgr.getAppWidgetIds(new ComponentName(this, Widget.class)) 예제 코드를 작성하면 아래와 같다. AppWidgetManager mgr = AppWidgetManager.getInstance(this); Intent update = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE); update.setClass(this, Widget.class); update.putExtra(AppWidgetManager.EXTRA_APPWIDGET_I.. 2012. 2. 14.
안드로이드 하이브리드앱 개발시 Rotation 되면 페이지가 다시 로딩되는 것 막기 -_-; 아놔. 제목 거창하네. AndroidMenifest.xml 에서 .Main activity 정의할때 android:configChanges="orientation" 프로퍼티를 추가해주면 된다. 2011. 10. 12.