본문 바로가기

Android

이미지 캡쳐 후 메신저로 전송 경로 예this.getExternalFilesDir(null).getPath();Environment.getExternalStorageDirectory().toString();/storage/emulated/0/Pictures/원하는 폴더명 등 해당 폴더가 없으면 만들고 저장 public void screenShot() { File isPath = new File(Constants.PATH_CAPTURE); if (!isPath.isDirectory()) isPath.mkdirs(); // 파일 지정 String fileName = getCurrentTime("yyyyMMddHHmmss") + ".png"; // 경로 + 파일 File fullName = new File(Constants.PATH_CAP.. 더보기
ArrayList 파일로 저장 및 읽기 경로 예this.getExternalFilesDir(null).getPath();Environment.getExternalStorageDirectory().toString();/storage/emulated/0/Pictures/원하는 폴더명 등 해당 폴더가 없으면 만들고 저장 public void saveCurrentGame() { String pathName = this.getExternalFilesDir(null).getPath(); File isPath = new File(pathName); if (!isPath.isDirectory()) isPath.mkdirs(); File fullName = new File(pathName + File.separator + Constants.FILE_CURRE.. 더보기
Device별 DPI & 리소스 호출 순서 일단 썼던 디바이스들 위주로 정리 size.x(px) size.y(px) size.x(dp) size.y(dp) densityDPI density 갤럭시 S3 1280 720 1280 720 320 2.0 갤럭시 노트4 2560 1440 1280 720 640 4.0 갤럭시 노트 프로 2560 1600 2560 1600 320 2.0 넥서스7 1920 1104 1920 1104 320 2.0 디바이스 상대 크기 720 1600 1104(소프트키) 1200 1 2.222222 1.533333 1.666667 리소스에 Drawable 폴더 상대 크기 ldpi0.75 mdpi 1 tvdpi 1.33 hdpi 1.5 xhdpi 2 xxhdpi 3 xxxhdpi 4 리소스 호출 우선순위현재 sw_dp 하위 sw_.. 더보기
상태바에 알림 생성 상태바에 알림 생성. private static final int NOTIFY_ID = 1234; private void notifyMessage() { String notiTitle = this.getString(R.string.app_name); String notiContent = this.getString(R.string.msg_notify_content); final NotificationManager notiMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Notification noti = new Notification(R.drawable.ic_main, notiTitle, System.currentTimeMillis().. 더보기
TextView에 Marquee 효과 넣기 해당 액티비티의 xml파일에 다음과 같이 설정한다. 각각 맡은 역할이 있는데 마퀴를 정의한다.android:ellipsize="marquee"동작 횟수를 정한다.android:marqueeRepeatLimit="marquee_forever"포커스를 둬야 움직이므로 true로 설정android:focusable="true"여러줄이 나오면 의미가 없으니 한줄로 설정android:singleLine="true" 그리고 액티비티의 자바 소스로 가서 해당 id를 정의한후 포커스를 둔다TextView tv = (TextView)findViewById(R.id.tvMemberMainTitle); tv.setSelected(true); 더보기
ImageView의 이미지 교체 이미지뷰의 이미지를 교체 // 이미지뷰를 가져옴 ImageView page1 = (ImageView) rootView.findViewById(R.id.guide_dot1); ImageView page2 = (ImageView) rootView.findViewById(R.id.guide_dot2); ImageView page3 = (ImageView) rootView.findViewById(R.id.guide_dot3); // 리소스에서 파일 호출 하여 Drawable에 등록 Drawable dotOff = getResources().getDrawable(R.drawable.guide_dot_01); Drawable dotOn = getResources().getDrawable(R.drawable.guid.. 더보기
ProgressBar 프로그래스바 타입1, 2, 3스피너(큰 것부터) / 4 바 타입 더보기
안드로이드 액티비티 화면 꺼지지 않게 다음 한줄을 추가해서 액티비티 실행시 화면이 꺼지지 않게(자동슬립) 할 수 있다. getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); 더보기