When I press Load Url button on my Activity, it starts a new browser instead of displaying the content in the WebView widget in the default Activity.
Here is the res/layout/main.xml :
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:id="@+id/LinearLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Load Yahoo" android:id="@+id/buttonLoadYahoo"></Button> </LinearLayout> <LinearLayout android:id="@+id/LinearLayout02" android:layout_width="match_parent" android:layout_height="fill_parent"> <WebView android:id="@+id/browserMine" android:layout_height="fill_parent" android:layout_width="fill_parent"></WebView> </LinearLayout> </LinearLayout> And also my src/com/tariknotebook/NoteBook.java file content :
package com.tariknotebook; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.webkit.WebView; import android.widget.Button; public class NoteBook extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button buttonLoadYahoo = (Button) findViewById(R.id.buttonLoadYahoo); final WebView web = (WebView) findViewById(R.id.browserMine); buttonLoadYahoo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { web.loadUrl("http://www.seslisozluk.com"); } }); } }