Job Assured Training at Felight, Bangalore
Home / Old Batches / [Kabali] Source Code (18th Oct 2016)
[Kabali] Source Code (18th Oct 2016)

[Kabali] Source Code (18th Oct 2016)

package com.felight.kabali;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;

public class WebViewDemoActiviy extends AppCompatActivity {

    private WebView wvResult;
    private ProgressBar pbWeb;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_web_view_demo_activiy);
        wvResult = (WebView) findViewById(R.id.wvResult);
        pbWeb = (ProgressBar) findViewById(R.id.pbWeb);


    }

    @Override
    protected void onStart() {
        super.onStart();



        wvResult.setWebViewClient(new WebViewClient(){
            @Override
            public void onPageFinished(WebView view, String url) {
                pbWeb.setVisibility(View.INVISIBLE);
                super.onPageFinished(view, url);
            }
        });

        WebSettings webSettings = wvResult.getSettings();
        webSettings.setJavaScriptEnabled(true);

        wvResult.loadUrl("https://www.apple.com");



        wvResult.setWebChromeClient(new WebChromeClient());
    }
}


public class Util {


    public static void toastIt(Context context, String msg){
        Toast toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
        toast.setGravity(Gravity.CENTER,0,0);
        toast.show();

    }
}


public boolean onCreateOptionsMenu(Menu menu) {

    menu.add("Help");
    menu.add("Settings");
    menu.add("About");


    return super.onCreateOptionsMenu(menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    Util.toastIt(getBaseContext(), item.getTitle().toString());
   // Toast.makeText(getBaseContext(),item.getTitle(), Toast.LENGTH_SHORT).show();
    return super.onOptionsItemSelected(item);
}

About vinaynoah

I am no one. In fact there is no 1. I am you, I am no where and I am everywhere, If you are pure then u see the utter pureness in me, If you are ugly u will see the height of it in me. I am just your mirror. There is nothing I achieved and there is nothing to achieve. All is here at this moment, right here right now. Come and share my Joy. Lets celebrate :-)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Scroll To Top