AIDE Tutorial - 52 Custom WebView
Watch the Video Below:
MainActivity.java
package com.kcgroup.CWeb;
package com.kcgroup.CWeb;
import android.app.*;
import android.os.*;
import android.widget.*;
import android.view.View.*;
import android.view.*;
import android.webkit.*;
import android.os.*;
import android.widget.*;
import android.view.View.*;
import android.view.*;
import android.webkit.*;
public class MainActivity extends Activity
{Button btn; EditText et;
@Override
protected void onCreate(Bundle savedInstanceState)
{ super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btn=(Button)findViewById(R.id.mainButton);
et=(EditText)findViewById(R.id.mainEditText);
{Button btn; EditText et;
@Override
protected void onCreate(Bundle savedInstanceState)
{ super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btn=(Button)findViewById(R.id.mainButton);
et=(EditText)findViewById(R.id.mainEditText);
btn.setOnClickListener( new View.OnClickListener()
{@Override
public void onClick(View p1)
{String weburl=et.getText().toString();
WebView web=(WebView)findViewById(R.id.mainWebView);
web.setWebViewClient(new WebViewClient());
web.loadUrl(weburl);
// TODO: Implement this method
}}); }}
{@Override
public void onClick(View p1)
{String weburl=et.getText().toString();
WebView web=(WebView)findViewById(R.id.mainWebView);
web.setWebViewClient(new WebViewClient());
web.loadUrl(weburl);
// TODO: Implement this method
}}); }}
Main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/mainEditText"
android:hint="Type your own url Start with http:// or https://"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
android:id="@+id/mainEditText"
android:hint="Type your own url Start with http:// or https://"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<Button
android:text="Go"
android:id="@+id/mainButton"android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:text="Go"
android:id="@+id/mainButton"android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<WebView
android:id="@+id/mainWebView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
android:id="@+id/mainWebView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
Manifest.xml
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET"/>
How to copy text.
ReplyDeletecould you gimme the zip of this project, so that i can open it directly from aide.
ReplyDelete