xml 파일에서 큰 사이즈 이미지를 읽어올때 Out of Memory 가 발생한다.

 

이 경우 Manifest 에

<application

 

android:largeHeap="true"

 

</application>

 

를 넣으면 해결이 된다.

 

뭐 달빅에서 메모리 할당하게 설정하고 그렇게 해야한다는데,

간략히 이유를 설명하자면, 메모리를 실제로? 보이는 것보다 더 할당해주어야한다고 한다고 한다.

정확한 이유는 나중에 다시 공부 해봐야겠다.

'IT > Android' 카테고리의 다른 글

GPS 설정 하기  (0) 2016.08.11

지도 서비스 이용시 GPS 설정을 하지 않으면 현재 위치 기능을 이용할 수 없다.

앱 실행시 GPS 설정이 되어 있지 않으면 설정 화면으로 이동하게 해주는 코드..

해당 함수를 원하는 위치에서 콜 해주면 된다.

앱에서 자동으로 설정해주면 더 좋겠지만 개인정보 때문에 구글에서 막아둔 것 같다

//GPS 설정 체크

   private boolean chkGpsService() {

    

    String gps = android.provider.Settings.Secure.getString(getContentResolver(), android.provider.Settings.Secure.LOCATION_PROVIDERS_ALLOWED);

      

    Log.d(gps, "aaaa");  

    

    if (!(gps.matches(".*gps.*") && gps.matches(".*network.*"))) {

   

     // GPS OFF 일때 Dialog 표시 

     AlertDialog.Builder gsDialog = new AlertDialog.Builder(this); 

     gsDialog.setTitle("위치 서비스 설정");   

     gsDialog.setMessage("무선 네트워크 사용, GPS 위성 사용을 모두 체크하셔야 정확한 위치 서비스가 가능합니다.\n위치 서비스 기능을 설정하시겠습니까?"); 

     gsDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { 

      public void onClick(DialogInterface dialog, int which) { 

       // GPS설정 화면으로 이동 

       Intent intent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); 

       intent.addCategory(Intent.CATEGORY_DEFAULT); 

       startActivity(intent); 

      } 

     })

     .setNegativeButton("NO", new DialogInterface.OnClickListener() {

      public void onClick(DialogInterface dialog, int which) {

       return;

      }

     }).create().show();

     return false;

    

    } else { 

     return true; 

    } 

   }


출처 - http://jinmanp.tistory.com/entry/Android-GPS-%EC%84%A4%EC%A0%95-%EC%B2%B4%ED%81%AC

'IT > Android' 카테고리의 다른 글

큰 이미지 로딩시 Out of Memory 해결 방법  (0) 2016.08.12

+ Recent posts