티스토리

STUDY BITS
검색하기

블로그 홈

STUDY BITS

choiseokwon.tistory.com/m

야매 프로그래머

구독자
13
방명록 방문하기
공지 Welcome 모두보기

주요 글 목록

  • 안드로이드 APK dependency graph (APK 종속 그래프) Android dependency visualizer (By alexzaitsev) https://github.com/alexzaitsev/apk-dependency-graph 안드로이드 개발 프로젝트를 시각적으로 볼 수 있게 도와주는 도구입니다. (클래스들끼리 얼마나 잘 이어져 있는지) 잘 짜인 앱일수록 아래와 같은 사진처럼 나오고 소스가 정리가 잘 안 돼 있거나 최적화가 미흡하면 아래와 같이 나옵니다. (무조건 이런 식은 아님) 사용 방법 (Java 7+ 필요) 압축 해제한 폴더에서 cmd로 아래 명령어를 입력하세요. run 개발.apk 필터옵션 필터옵션은 com.example.test 처럼 특정 패키지만 필터링하거나 nofilter를 하시면 됩니다. (라이브러리를 많이 사용하므로 패키지 지정 추천).. 공감수 1 댓글수 0 2016. 11. 15.
  • Android Widget Update Manually (위젯 수동 업데이트) 위젯 업데이트할 부분에 추가 YourWidget을 자신의 AppWidgetProvider widget으로 바꾼다. val intentAction = Intent(context, YourWidget::class.java) intentAction.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE) val ids = AppWidgetManager.getInstance(context).getAppWidgetIds(ComponentName(context, YourWidget::class.java)) intentAction.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids) context.sendBroadcast(intentActio.. 공감수 1 댓글수 0 2016. 10. 23.
  • 안드로이드 원하는 장소 구글 맵으로 열기 Uri gmmIntentUri = Uri.parse("geo:xxx, yyy"); Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); mapIntent.setPackage("com.google.android.apps.maps"); if (mapIntent.resolveActivity(getPackageManager()) != null) { startActivity(mapIntent); } geo 구하는 법 1. https://www.google.co.kr/maps 에 들어간다. 2. 원하는 장소에서 마우스 우클릭을 하여 '이곳이 궁금한가요?'를 클릭한다. 3. 아래 레이아웃의 숫자를 클릭한다. 4. 왼쪽 레이아웃에서 숫자를 복사한다. xxx.. 공감수 1 댓글수 0 2016. 8. 17.
  • 안드로이드 버전(Version) String 구하기 PackageInfo pInfo = null; try{ pInfo = getPackageManager().getPackageInfo(getPackageName(), 0); } catch(PackageManager.NameNotFoundException e) { // e.printStackTrace(); } String version = pInfo.versionName; 공감수 0 댓글수 0 2016. 8. 17.
  • 안드로이드 String 빈 값("")일 경우 String Test; // Test가 "" 일 경우와 " " 와 같이 띄어쓰기로만 이루어진 경우 TestB == true Boolean TestB = Test.trim().isEmpty(); 공감수 2 댓글수 0 2016. 8. 15.
  • 안드로이드 요일 구하기 Calendar calendar = Calendar.getInstance(); int day = calendar.get(Calendar.DAY_OF_WEEK); String today = ""; switch (day) { case Calendar.SUNDAY: today = "일"; break; case Calendar.MONDAY: today = "월"; break; case Calendar.TUESDAY: today = "화"; break; case Calendar.WEDNESDAY: today = "수"; break; case Calendar.THURSDAY: today = "목"; break; case Calendar.FRIDAY: today = "금"; break; case Calendar.SA.. 공감수 1 댓글수 0 2016. 8. 15.
  • 안드로이드 매일 일정 시각 알람 AlarmManager manager = (AlarmManager) YourContext.getSystemService(Context.ALARM_SERVICE); /* 알람 설정 */ Intent yourintent = new Intent(YourContext, YourThing.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(YourContext, 0, yourintent, 0); /* 6:50:00 AM 알람 */ Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.set(Calendar.HOUR.. 공감수 1 댓글수 0 2016. 8. 15.
  • 안드로이드 날짜 차이 계산 public static int getDifference(String ddays) { SimpleDateFormat mFormat = new SimpleDateFormat("yyyy.MM.dd"); Date d = null; try { d = mFormat.parse(ddays); } catch (ParseException e) { // TODO Auto-generated catch block } Calendar getDay = Calendar.getInstance(); getDay.setTime(d); getDay.set(Calendar.HOUR_OF_DAY, 0); getDay.set(Calendar.MINUTE, 0); getDay.set(Calendar.SECOND,0); getDay.set(Ca.. 공감수 2 댓글수 0 2016. 8. 15.
  • 안드로이드 데이터 연결되있는지 확인하기 소스 public static boolean isConnected() { ConnectivityManager cm = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); // 인터넷 연결 유형 확인: boolean isWiFi = activeNetwork.getType() == ConnectivityManager.TYPE_WIFI; return activeNetwork != null && activeNetwork.isConnectedOrConnecting(); } if (isConnected()) 퍼미션 필요 공감수 1 댓글수 0 2015. 4. 7.
  • 안드로이드 평점 하러가기 소스 String appUrl = "https://play.google.com/store/apps/details?id=" + this.getPackageName(); Intent rateIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(appUrl)); startActivity(rateIntent); 프래그먼트는 this -> getActivity() 공감수 0 댓글수 0 2015. 4. 7.
  • 안드로이드 클립보드에 복사하기 소스 android.content.ClipboardManager clipboard = (android.content.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); android.content.ClipData clip = android.content.ClipData.newPlainText("LABEL", "TEXT"); clipboard.setPrimaryClip(clip); TEXT에 복사하고 싶은 글을 입력하면 된다. 공감수 1 댓글수 0 2014. 8. 31.
  • 안드로이드 메일 보내기 소스 Intent send = new Intent(Intent.ACTION_SENDTO); String uriText = "mailto:" + Uri.encode(mail) + "?subject=" + Uri.encode(subject) + "&body=" + Uri.encode(body); Uri uri = Uri.parse(uriText); send.setData(uri); context.startActivity(Intent.createChooser(send, "Send mail...")); mail, subject, body는 String mail = user@gmail.com subject = 제목 body = 본문 내용 공감수 1 댓글수 0 2014. 8. 30.
  • 안드로이드 재부팅 소스 // 루팅된 폰 이상 ProcessBuilder pb = new ProcessBuilder(new String[] { "su", "-c", "/system/bin/reboot" }); Process process = pb.start(); process.waitFor(); // 혹은, 하지만 System 펌웨어 키로 사인된 어플리케이션만 가능함 PowerManager powerManager = (PowerManager)getSystemService(Context.POWER_SERVICE); powerManager.reboot(null); 공감수 1 댓글수 0 2014. 8. 18.
  • 안드로이드 코딩을 좀 더 간단하게 "ButterKnife" 링크: https://github.com/JakeWharton/butterknife ButterKnife는 Annotation기능을 이용하여 코딩을 쉽게할 수 있는 방법입니다. ※ Bind를 시켜야 사용 가능 (Kotlin과 비슷) class Example extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.simple_activity); // Bind 하세요. ButterKnife.bind(this); } } @BindView 를 이용하면 자동으로 ID 설정과 캐스트를 해줌 // With ButterKnife.. 공감수 1 댓글수 2 2014. 7. 27.
  • Fragment에서 getSupportActionBar() 사용하기 ((MainActivity) getActivity()).getSupportActionBar() 공감수 1 댓글수 0 2014. 7. 6.
  • 안드로이드 애니메이션 라이브러리 모음 1. SlidingUpPanelLayout 다운로드: https://github.com/umano/AndroidSlidingUpPanel/releases주소: https://github.com/umano/AndroidSlidingUpPanel 2. FoldableLayout 주소 및 다운로드: https://github.com/alexvasilkov/FoldableLayout 3. android-flip 주소 및 다운로드: https://github.com/openaphid/android-flip 4. SwipeBackLayout 주소 및 다운로드: https://github.com/Issacw0ng/SwipeBackLayout 6. Android-ParallaxHeaderViewPager 주소 및 다운.. 공감수 0 댓글수 0 2014. 7. 6.
  • 안드로이드 추천 라이브러리 (Circular Progress Button) 제작자: dmytrodanylyk주소: https://github.com/dmytrodanylyk/circular-progress-button XML 기본 상태 [0]프로그래스 상태 [1-99]완료 상태 [100]에러 상태 [-1] 나머지는 Sample을 참고하세요. 공감수 0 댓글수 0 2014. 7. 6.
  • 안드로이드 추천 라이브러리 FlatUI 이번에 소개해드릴 라이브러리는 FlatUI 입니다. 이 라이브러리는 편안하게 앱에 FlatUI를 적용할 수 있습니다. FlatButton, FlatTextView, FlatEditText, FlatRadioButton, FlatCheckBox, FlatSeekbar, FlatToggleButton 의 View를 지원합니다. 사용법도 간단합니다. 메인 액티비티에 이 문구를 추가합니다.// screen sizes. If you skip this there may be problem with different screen densities FlatUI.initDefaultValues(this); // Setting default theme to avoid to add the attribute "theme" t.. 공감수 0 댓글수 0 2014. 6. 29.
  • 안드로이드 앱 개발 시 배경화면을 타일로 설정하기 '타일(패턴) 배경화면' 패턴 이미지를 만드세요. (※ 서로서로 이어지게 만드세요.) 샘플 그리고 Eclipse 나 Android Studio를 실행하세요. 그다음, drawable 폴더를 만들고 xml 하나를 만드세요. Bitmap으로 그다음은 내용을 이렇게 바꿔주세요. (android:src 에는 알맞은 패턴을 넣으세요.) 그런 다음 layout 에서 배경을 바꾸세요. 결과 소스파일에 몇몇 패턴을 추가시켜놨으니 참고하세요^^ 이미지 크기 참조 xxxhdpi - 64x64 xxhdpi - 48x48 xhdpi - 32x32 hdpi - 24x24 mdpi - 16x16 공감수 0 댓글수 0 2014. 4. 20.
  • build.prop 내용 불러오기 '=' 뒤에 내용을 불러온다. ex) ro.product.model을 불러오게 하면, 'ro.product.model=기기명' 이 아니라 '기기명'만 출력됨 public static String getProp(String prop) { try { Process process = Runtime.getRuntime().exec("getprop " + prop); BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(process.getInputStream())); StringBuilder log = new StringBuilder(); String line; while ((line = bufferedReader.readLine().. 공감수 1 댓글수 0 2014. 2. 6.
  • [TIP] 유용한 Android 앱 라이브러리 1. ActionBarSherlock (액션바 셜록) 거의 무수히 많은 앱들이 이 라이브러리를 사용한다. 설명은 해석하면, 'ActionBarSherlock은 액션바 디자인 패턴을 모든 버전의 안드로이드 버전에서 가능하게 해주는 라이브러리이다' 라고 써있는것같네요. 기능만 잘 사용한다면 사용법은 무궁무진합니다. 다운로드: 홈페이지: http://actionbarsherlock.com/ 개발자: Jake Wharton - jakewharton@gmail.com 2. Picasso (피카소) 기능을 해석하면 '안드로이드를 위한 강력한 이미지 다운로더/캐셔이다.' 이 라이브러리를 사용하면 이미지 parsing (파싱)이 쉬워진다. 다운로드: 2014년 7월 05일 업데이트 완료 홈페이지: http://squa.. 공감수 0 댓글수 0 2014. 2. 6.
  • [TIP] Android string format (%1$s...) 사용하기 string 을 %1$s, %2$d과 같이 사용하고 싶을 때 사용하는 방법 소스 1. strings.xml 에 원하는 string을 추가한다. %1$s 를 알맞게 넣어준다. Example: %1$s is gonna boom 2. Java에다 알맞게 수정한다. Resources resources = Context.getResources(); // Context에 this나 클래스 네임 String example = String.format(resources.getString(R.string.which_you_want), 변수); 이 형식을 왜 사용할까? 변수와 함께 string을 쓸 경우, locale이 2개 이상일시 편리하다. 참조) values/strings.xml 에 "I have " 와 values.. 공감수 0 댓글수 0 2014. 2. 6.
    문의안내
    • 티스토리
    • 로그인
    • 고객센터

    티스토리는 카카오에서 사랑을 담아 만듭니다.

    © Kakao Corp.