728x90

안드로이드 소스에서 Deprecated 라고 나오는 걸 해결하기 위해 검색으로 찾은 결과를 적어둔다.


보통 deprecate 되어도 이전 코드를 지우는 건 아니기 때문에, 전처럼 동작하기는 할 것이다.

향후, 유지보수단계에서 deprecate 코드에 대해서 안정성을 보장하지 않는다는 얘기이기 때문에, 안드로이드 차기 버전 에서는 비정상 동작을 할 가능성이 높아진다.

대체코드를 찾아서 새롭게 구현하는게 현명한 판단이다.


메모리 누수를 일으키는 현상에 대한 정리가 잘된 자료이다.

http://sjava.net/2016/05/%EB%B2%88%EC%97%AD-%EC%95%88%EB%93%9C%EB%A1%9C%EC%9D%B4%EB%93%9C-%EC%95%B1%EC%9D%B4-%EB%A9%94%EB%AA%A8%EB%A6%AC-%EB%88%84%EC%88%98leak%EB%A5%BC-%EB%A7%8C%EB%93%9C%EB%8A%94-8%EA%B0%80%EC%A7%80/


depricated 로 나온 걸 하나 하나 해결하기 위해 찾은 걸 적어나갈 것이다.


URLDecoder.decode(getIntent().getExtras().getString("url"), "UTF-8");

getSettings().setUserAgent(0);  => getSettings().setUserAgentString("Android");

URLEncoder.encode("","UTF-8")


Implicitly using the default locale is a common source of bugs: Use toUpperCase(Locale) instead    NetworkCheck.java
url = url.toLowerCase();  ==> url = url.toLowerCase(Locale.getDefault());

// http://beginnersbook.com/2013/12/java-string-tolowercase-method-example/


The method decode(String) from the type URLDecoder is deprecated

URLEncoder.encode(String s, String enc);
import java.net.URLEncoder;
URLEncoder.encode("This text must be encoded!", "UTF-8");



AlertDialog: BUTTON_POSITIVE, BUTTON_NEUTRAL and BUTTON_NEGATIVE.


AlertDialog alertDialog = new AlertDialog.Builder(activity).create();
       alertDialog.setTitle("  [ 알림 ]");
       alertDialog.setMessage("등록된 휴대폰 번호가 없습니다.");
       alertDialog.setButton("확인", new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int which) {
           }
       });

AlertDialog.Builder alertDialog = new AlertDialog.Builder(activity);
        alertDialog.setTitle("  [ 알림 ]")
        .setMessage("등록된 휴대폰 번호가 없습니다.")
        .setCancelable(false)
        .setNegativeButton("확인",new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                dialog.cancel();
            }
        });
        AlertDialog alert = alertDialog.create();
        alert.show();



alertDialog.setButton("확인", new DialogInterface.OnClickListener() {
   public void onClick(DialogInterface dialog, int which) {

   }
});

alertDialog.setButton(DialogInterface.BUTTON_POSITIVE,"확인", new DialogInterface.OnClickListener() {
   public void onClick(DialogInterface dialog, int which) {

   }
});



// http://www.technotalkative.com/issue-using-setjavascriptenabled-can-introduce-xss-vulnerabilities-application-review-carefully/

@SuppressLint("SetJavaScriptEnabled")
public class MyActivity extends Activity
{
...
}


// 내용 파악이 필요한 부분

showDialog(DIALOG_DOWNLOAD_PROGRESS);
The method showDialog(int) from the type Activity is deprecated
https://developer.android.com/reference/android/app/Activity.html#showDialog%28int%29
This method was deprecated in API level 13.


MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);


MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE,null,Charset.forName("UTF-8"));



NameValuePair deprecated
ContentValues values = new ContentValues();
values.put("key1", "value1");
values.put("key2", 123);



블로그 이미지

Link2Me

,