안드로이드 개발 질문/답변
(글 수 45,052)
제가 asset 폴더에 5종류의 html 파일을 넣었는데요..
화면을 터치할 경우에 loadUrl을 호출 하도록 구현 했습니다.
그런데 스크롤을 맨 마지막까지 보내고, 터치를 하면 화면이 변하지 않습니다.
하두 이상해서 타이틀 바에 Progress 상태바를 넣었는데 로딩은 하고 있는 것 같더라구요.
소스코드를 아무리 봐도 잘 모르겠네요.. 뭐가 문제 인지 제발 알려주세요~~~
소스코드와 첨부파일을 올려 둡니다.
(공지사항 읽었습니다.)
public class Nanumgodic extends Activity { /** Called when the activity is first created. */ String[] load = { "file:///android_asset/text_1.html" ,"file:///android_asset/text_2.html" ,"file:///android_asset/text_3.html" ,"file:///android_asset/text_4.html" ,"file:///android_asset/text_5.html" }; WebView text; int count = 0; GestureDetector mDetectorl; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_PROGRESS); setContentView(R.layout.main); mDetectorl = new GestureDetector(new OnGestureListener() { public boolean onSingleTapUp(MotionEvent e) { // TODO Auto-generated method stub text.loadUrl(load[count%load.length]); Toast.makeText(Nanumgodic.this, load[count%load.length], Toast.LENGTH_SHORT).show(); count++; return true; } public void onShowPress(MotionEvent e) { // TODO Auto-generated method stub } public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { // TODO Auto-generated method stub return false; } public void onLongPress(MotionEvent e) { // TODO Auto-generated method stub } public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { // TODO Auto-generated method stub return false; } public boolean onDown(MotionEvent e) { // TODO Auto-generated method stub return false; } }); text = (WebView)findViewById(R.id.web_aa); text.refreshPlugins(true); text.getSettings().setJavaScriptEnabled(true); text.getSettings().setPluginsEnabled(true); text.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); text.getSettings().setAllowFileAccess(true); text.getSettings().setAppCacheEnabled(false); text.setWebChromeClient(new WebChromeClient(){ @Override public void onProgressChanged(WebView view, int newProgress) { Nanumgodic.this.setProgress(newProgress*100); } }); text.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { return mDetectorl.onTouchEvent(event); } }); } }
(공지사항 읽었습니다.)