ठीक है। मैंने हर जगह देखा है और मेरा छोटा दिमाग सिर्फ एक गतिविधि को ताज़ा करने के लिए एक बेहतर तरीका समझ नहीं सकता है। कोई सुझाव जो मैं समझ सकता हूं वह बहुत अच्छा होगा। :)क्या वेबव्यू रीफ्रेश करने का कोई बेहतर तरीका है?
यहाँ जावा कोड है:
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>
मैं सिर्फ गतिविधि के बाद गतिविधि फिर से स्टैकिंग का विचार पसंद नहीं है। वेबव्यू रीफ्रेश करने का एक आसान तरीका होना चाहिए। कृपया मदद करे। इसलिए पूर्ण कोड
newButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
dgeActivity.this.mWebView.loadUrl("http://www.websitehere.php");
}});
2 होगा
mWebView.loadUrl("http://www.websitehere.php");
) तुम भी mWebView.reload()
फोन, लेकिन यह reposts बारे में पता होना कर सकते हैं: :)
आप SOOOO रॉक !!! बहुत बहुत धन्यवाद। यह पूरी तरह से काम किया! व्हाउ हुू !!!! :) – cdg
अब अगर मैं इसे केवल विजेट में बदल सकता हूं ....: डी – cdg
जोश का जवाब सही है। आपकी इच्छा एक ही यूआरएल को पुनः लोड करना जारी रखेगी। –