확인. 나는 어딘가에 보았고 나의 작은 두뇌는 활동을 새로 고치는 더 좋은 방법을 이해할 수 없다. 내가 이해할 수있는 제안은 훌륭 할 것이다. :)WebView를 새로 고치는 더 좋은 방법이 있습니까?
가 여기에 자바 코드 : 여기
package com.dge.dges;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
public class dgeActivity extends Activity {
WebView mWebView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings();
mWebView.loadUrl("http://www.websitehere.php");
Button newButton = (Button)findViewById(R.id.new_button);
newButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(dgeActivity.this, dgeActivity.class);
startActivity(intent);
}
});
}
}
그리고 것은 main.xml에
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000"
>
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
/>
<Button
android:id="@+id/new_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Refresh"
/>
</RelativeLayout>
난 그냥 활동 후 활동을 재 적재의 아이디어를 좋아하지 않는다에게 있습니다. webview를 새로 고치는 더 쉬운 방법이 있어야합니다. 도와주세요. 또한 mWebView.reload()
를 호출하지만 재 게시를 인식 할 수 있습니다) 그래서 전체 코드가
newButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
dgeActivity.this.mWebView.loadUrl("http://www.websitehere.php");
}});
이 될 것
mWebView.loadUrl("http://www.websitehere.php");
: :) 경우
당신이 SOOOO ROCK! 정말 고맙습니다. 완벽하게 작동했습니다! WHOO HOOOO !!!! :) – cdg
이제 위젯으로 만 변환하면 .... : D – cdg
조쉬의 답변이 맞습니다. 귀하는 동일한 URL을 다시로드합니다. –