본문 바로가기

전체 글

(124)
회전 이동 int dX = targetX - centerX; int dY = targetY - centerY;float radian = (float)Math.atan2(dY, dX); moveX = (int)(centerX + r * Math.cos(radian)); moveY = (int)(centerY + r * Math.sin(radian));
두 점의 거리 int dX = targetX - centerX; int dY = targetY - centerY; int distance = (int)Math.sqrt(Math.pow(Math.abs(dX), 2) + Math.pow(Math.abs(dY), 2));
enum 활용 public enum TestEnum {TEST_0(0, "text 0", 12),TEST_1(1, "text 1", 34)),TEST_2(2, "text 2", 56) private final int value0;private final String value1;private final int value2; TestEnum(int v0, String v1, int v2) {value0 = v0;value1 = v1;value2 = v2;} public int getValue0( ) {return value0;} public String getValue1( ) {return value1} public int getValue2( ) {return value2;} } ... TestEnum test0 = T..
파일 이어받기 private String downloadFile(String urlString, String savePath) { URL url; InputStream inputStream; OutputStream outputStream; HttpURLConnection con; long fileSize = 0; long remains = 0; long fileLength = 0; try { File file = new File(savePath); if(!file.exists()) { file.createNewFile(); } RandomAccessFile output = new RandomAccessFile( file.getAbsolutePath(), "rw"); fileSize = output.length(); o..
Test 파일 다운로드 zip 파일 테스트
Https 및 언어에 따라 Json 다운로드 public static String downloadUrl(String urlString, String locale) throws IOException { InputStream result = null; Writer writer = null; URL url = new URL(urlString); setTrust(); HttpsURLConnection httpsConn = (HttpsURLConnection)url.openConnection(); httpsConn.setHostnameVerifier(new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { return true; } }); Ht..
R.java 관련 [버전업 되면서 리소스들어감 - 유니티 버그] unity 5 이전 버전에서는 Plugin/Android/ 폴더 안에 res 폴더를 두면 최종 R.java에 리소스들이 들어가는데, unity 5에서는 들어가지 않음. Plugin/Android/ 폴더 하위에 라이브러리 프로젝트 폴더 추가. 이 폴더에 project.properties 파일 추가 project.properties 파일의 내용은 아래와 같음 target=android-16android.library=true 이 폴더에 AndroidMenifast.xml 가 존재해야 함 (메인 AndroidMenifast.xml이 있을때 둘이 다르면 빌드시 충돌나는데, 같은거면 충돌 나지 않음) 이 폴더안의 res 폴더 안에 리소스 들이 있으면, 빌드 시 R.j..
단어로 string 을 split string[] separators = new string[] { "Android" };string[] paths = Application.persistentDataPath.Split(separators, System.StringSplitOptions.None);string rootPath = paths[0] + "Folder/"; 갤 노트 4에서 Application.persistentDataPath 는 /storage/emulated/0/Android/com.preject.Temp.apk 이런 식으로 경로 나옴. 위와 같이 Android로 자르면 path[0] 은 /storage/emulated/0/ sd card 경로가 됨