아래의 웹액티비티로 Intent의 putExtra로 URL만 인자값으로 날려주면 됨.
Ex)
Intent intent = new Intent(DiscoverSearchActivity.this, WebActivity.class);
try {
// intent.putExtra("Discover_search", searchKey);
Util.log(">>>>>>>>>>>>>>>>>>>>>>>" + Define.audibleURL+searchKey);
intent.putExtra("url", Define.audibleURL+searchKey);
startActivity(intent);
**********************************************
<WebActivity.java>
package com.lge.readersworld.activity;
import com.lge.readersworld.R;
import com.lge.readersworld.util.Util;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.CookieSyncManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class WebActivity extends Activity {
public WebView webview;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.web);
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
String url = getIntent().getStringExtra("url");
Util.log("WEBVIEW URL = " + url);
webview.loadUrl(url);
webview.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url){
CookieSyncManager.getInstance().sync();
}
});
webview.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View arg0, int arg1, KeyEvent arg2) {
return false;
}
});
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onPause() {
super.onPause();
if (CookieSyncManager.getInstance() != null) {
CookieSyncManager.getInstance().stopSync();
}
}
@Override
public void onDestroy() {
super.onDestroy();
}
}
댓글 없음:
댓글 쓰기