안드로이드 브라우저 호출하기 앱이 예상치 않게 중지되는 문제
Copy
package com.example.people2; import android.app.ActivityManager;import android.app.ListActivity;import android.content.Intent;import android.net.Uri;import android.os.Bundle; public class MainActivity extends ListActivity { /** Called when the activity is first created. */ @SuppressWarnings("deprecation") @Override public void onCreate(Bundle icicle) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.p-ple.kr")); startActivity(intent); //종료 코드 moveTaskToBack(true); finish(); // 메모리 상태에서 완전한 종료를 취한다. ActivityManager am = (ActivityManager)getSystemService(ACTIVITY_SERVICE); am.restartPackage(getPackageName()); } }
풀소스입니다. 문제가 있는 게 일단 브라우저 호출은 됩니다. 그런데 애플리케이션(프로세스)이 예상치 않게 중지되었습니다. 다시 시도해주세요 라고 뜹니다.
답변 1개
답변을 작성하려면 로그인이 필요합니다.