ad728

Thursday, January 18, 2018

AIDE Tutorial - 52 Custom WebView

AIDE Tutorial - 52 Custom WebView


Watch the Video Below:

MainActivity.java
package com.kcgroup.CWeb;
import android.app.*;
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);
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
}});   }}

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">
    <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" />
<Button
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>
Manifest.xml
<uses-permission android:name="android.permission.INTERNET"/>
Share:

2 comments:

  1. could you gimme the zip of this project, so that i can open it directly from aide.

    ReplyDelete

Total Pageviews

Sponsor

Sponsor

ad300