webview で URL を開こうとしていますが、問題は、url が webview に読み込まれておらず、ブラウザーを選択するためのポップアップが表示され、オプションをクリックするとすぐにそのブラウザーで url が開かれることです。 . 誰かがこれを解決するのを手伝ってくれますか? URL をブラウザではなく webview 自体で開きたいです。
webview の私の xml は:-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg_new" >
<RelativeLayout
android:id="@+id/upBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/wbview_bckbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/back_btn_chng" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/upBar" >
<WebView
android:id="@+id/linkwebview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:scrollbars="none" />
</RelativeLayout>
</RelativeLayout>
そして、これがwebviewの私のコードです:-
public class FbTwtrLink extends Activity {
WebView web;
ImageView img,bckimg,share_btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fb_twtr_link);
img = (ImageView)findViewById(R.id.header);
bckimg = (ImageView) findViewById(R.id.wbview_bckbtn);
web=(WebView)findViewById(R.id.linkwebview);
web.getSettings().setJavaScriptEnabled(true);
web.loadUrl("http://www.google.com");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_fb_twtr_link, menu);
return true;
}
}
そして、そのようにwebviewを呼び出しています:-
fbicon.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent=new Intent(context,FbTwtrLink.class);
//intent.putExtra("fb_link", 1);
startActivity(intent);
}
});