Example usage for android.view Window FEATURE_NO_TITLE

List of usage examples for android.view Window FEATURE_NO_TITLE

Introduction

In this page you can find the example usage for android.view Window FEATURE_NO_TITLE.

Prototype

int FEATURE_NO_TITLE

To view the source code for android.view Window FEATURE_NO_TITLE.

Click Source Link

Document

Flag for the "no title" feature, turning off the title at the top of the screen.

Usage

From source file:com.dlam.activity.T1Activity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    //??activitycontext?context = getParent();
    //????activitycontext????
    //Context context = this.getParent();

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    mPullListView = new PullToRefreshListView(this);
    setContentView(mPullListView);/*from w w w .j a  v  a 2s  .com*/

    mPullListView.setPullLoadEnabled(true);
    mPullListView.setScrollLoadEnabled(true);
    time = formatDateTime(System.currentTimeMillis());
    getListgetInfoList(Integer.toString(curPage), "0", "0", time, new VolleyDataCallback() {
        @Override
        public void onSuccess(A_ListBean bean) {
            curPage++;
            toaPage = Integer.parseInt(bean.getTotalpage());
            datas = bean.getInfolist();

            mAdapter = new A_ListDataAdapter(T1Activity.this, datas, R.layout.listitem);
            mListView = mPullListView.getRefreshableView();
            mListView.setAdapter(mAdapter);
            mListView.setOnItemClickListener(new OnItemClickListener() {

                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                    myid = datas.get(position).getId().toString();
                    Intent intent = new Intent();
                    switch (datas.get(position).getType1id()) {
                    case "1":
                        intent.putExtra("myid", myid);
                        intent.setClass(T1Activity.this, A_NewsDetailActivity.class);
                        T1Activity.this.startActivity(intent);
                        break;

                    case "2":
                        intent.putExtra("myid", myid);
                        intent.setClass(T1Activity.this, A_ActivityDetailActivity.class);
                        T1Activity.this.startActivity(intent);
                        break;

                    case "3":
                        intent.putExtra("myid", myid);
                        intent.setClass(T1Activity.this, A_ServiceDetailActivity.class);
                        T1Activity.this.startActivity(intent);
                        break;
                    default:
                        break;
                    }
                }
            });
        }
    });

    mPullListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
        @Override
        public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
            //mIsStart = true;
            getUpdateData();
        }

        @Override
        public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
            //mIsStart = false;
            getMoreData();
        }
    });
    setLastUpdateTime();

    // mPullListView.doPullRefreshing(true, 5);

}

From source file:com.cvte.LiZhiDemo.Activity.ImagePagerActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.lizhi_image_pager_layout);

    btCloss = new ImageButton(this);
    btCloss = (ImageButton) findViewById(R.id.close);
    btCloss.setOnClickListener(new OnClickListener() {

        @Override/*from   w  w  w.  j a  va  2s  . c om*/
        public void onClick(View v) {
            finish();

        }
    });

    ArrayList<String> imageUrls = getIntent().getStringArrayListExtra(Extra.IMAGES);
    // ??View?   
    int pagerPosition = getIntent().getIntExtra(Extra.IMAGE_POSITION, 0);

    // ??   
    if (savedInstanceState != null) {
        pagerPosition = savedInstanceState.getInt(STATE_POSITION);
    }

    /**
     * ????       */
    initPoint(imageUrls.size());

    options = new DisplayImageOptions.Builder().resetViewBeforeLoading(true).cacheInMemory(true)
            .imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565)
            .displayer(new FadeInBitmapDisplayer(300)).build();

    pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(new ImagePagerAdapter(imageUrls));

    pager.setCurrentItem(pagerPosition);
    points[pagerPosition].setEnabled(true);
    pager.setOnPageChangeListener(new MyPageChangeListener());

}

From source file:ca.frozen.curlingtv.activities.ScannerFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // get the controls
    View view = inflater.inflate(R.layout.fragment_scanner, container, false);
    message = (TextView) view.findViewById(R.id.scanner_message);
    status = (TextView) view.findViewById(R.id.scanner_status);
    progress = (ProgressBar) view.findViewById(R.id.scanner_progress);
    cancelButton = (Button) view.findViewById(R.id.scanner_cancel);

    // configure the dialog
    Dialog dialog = getDialog();//from ww  w .ja va  2s .  c  om
    if (dialog != null) {
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setCancelable(false);
        dialog.setCanceledOnTouchOutside(false);
        dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
            @Override
            public boolean onKey(android.content.DialogInterface dialog, int keyCode,
                    android.view.KeyEvent event) {
                if ((keyCode == android.view.KeyEvent.KEYCODE_BACK)) {
                    cancel();
                }
                return false;
            }
        });
    }

    // handle the cancel button
    cancelButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            cancel();
            dismiss();
        }
    });

    // create the dismiss handler and runnable
    dismissHandler = new Handler();
    dismissRunner = new Runnable() {
        @Override
        public void run() {
            dismiss();
        }
    };

    // configure the view if we've already done the scan
    if (savedInstanceState != null) {
        DeviceScanner scanner = (scannerWeakRef != null) ? scannerWeakRef.get() : null;
        if (scanner != null) {
            boolean complete = scanner.isComplete();
            scanner.setStatus(complete);
            if (complete) {
                cancelButton.setText(App.getStr(R.string.done));
            }
        }
    }

    return view;
}

From source file:com.teleca.jamendo.activity.SearchActivity.java

/** Called when the activity is first created. */
@SuppressWarnings("unchecked")
@Override//from  w w  w . j  a v a2  s  .c o m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.search);

    mSearchSpinner = (Spinner) findViewById(R.id.SearchSpinner);
    ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.search_modes,
            android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mSearchSpinner.setAdapter(adapter);

    mSearchButton = (Button) findViewById(R.id.SearchButton);
    mSearchButton.setOnClickListener(mSearchButtonListener);

    mSearchEditText = (EditText) findViewById(R.id.SearchEditText);
    mSearchListView = (ListView) findViewById(R.id.SearchListView);

    mViewFlipper = (ViewFlipper) findViewById(R.id.SearchViewFlipper);
    if (mSearchListView.getCount() == 0) {
        mViewFlipper.setDisplayedChild(2); // search list hint
    }

    mGestureOverlayView = (GestureOverlayView) findViewById(R.id.gestures);
    mGestureOverlayView
            .addOnGesturePerformedListener(JamendoApplication.getInstance().getPlayerGestureHandler());
}

From source file:com.frublin.androidoauth2.FsDialog.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSpinner = new ProgressDialog(getContext());
    mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mSpinner.setMessage("Loading...");

    mContent = new LinearLayout(getContext());
    mContent.setOrientation(LinearLayout.VERTICAL);
    setUpTitle();//from w  ww  . ja va2  s.  c  o m
    setUpWebView();
    Display display = getWindow().getWindowManager().getDefaultDisplay();
    final float scale = getContext().getResources().getDisplayMetrics().density;
    float[] dimensions = (display.getWidth() < display.getHeight()) ? DIMENSIONS_PORTRAIT
            : DIMENSIONS_LANDSCAPE;
    addContentView(mContent, new FrameLayout.LayoutParams((int) (dimensions[0] * scale + 0.5f),
            (int) (dimensions[1] * scale + 0.5f)));
}

From source file:com.dazone.crewchat.libGallery.activity.BucketHomeFragmentActivity.java

@SuppressLint("ResourceAsColor")
@Override//from  w w  w. ja v a 2 s .co  m
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Instance = this;
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_home_media_chooser);

    headerBarTitle = (TextView) findViewById(R.id.titleTextViewFromMediaChooserHeaderBar);
    headerBarCamera = (ImageView) findViewById(R.id.cameraImageViewFromMediaChooserHeaderBar);
    headerBarBack = (ImageView) findViewById(R.id.backArrowImageViewFromMediaChooserHeaderView);
    headerBarDone = (TextView) findViewById(R.id.doneTextViewViewFromMediaChooserHeaderView);
    mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);

    headerBarTitle.setText(getResources().getString(R.string.app_name));
    headerBarCamera.setBackgroundResource(R.drawable.ic_camera_unselect_from_media_chooser_header_bar);
    headerBarCamera.setTag(getResources().getString(R.string.image));

    headerBarBack.setOnClickListener(clickListener);
    headerBarCamera.setOnClickListener(clickListener);
    headerBarDone.setOnClickListener(clickListener);

    if (!MediaChooserConstants.showCameraVideo) {
        headerBarCamera.setVisibility(View.GONE);
    }

    mTabHost.setup(this, getSupportFragmentManager(), R.id.realTabcontent);

    if (MediaChooserConstants.showVideo) {
        mTabHost.addTab(
                mTabHost.newTabSpec("tab2")
                        .setIndicator(getResources().getString(R.string.videos_tab) + "      "),
                BucketVideoFragment.class, null);
    }

    if (MediaChooserConstants.showImage) {
        mTabHost.addTab(
                mTabHost.newTabSpec("tab1")
                        .setIndicator(getResources().getString(R.string.images_tab) + "      "),
                BucketImageFragment.class, null);
    }

    mTabHost.getTabWidget().setBackgroundColor(getResources().getColor(R.color.tabs_color));
    mTabHost.getTabWidget().getChildAt(0).setVisibility(View.GONE);

    for (int i = 0; i < mTabHost.getTabWidget().getChildCount(); i++) {

        View childView = mTabHost.getTabWidget().getChildAt(i);
        TextView textView = (TextView) childView.findViewById(android.R.id.title);

        if (textView.getLayoutParams() instanceof RelativeLayout.LayoutParams) {

            RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) textView.getLayoutParams();
            params.addRule(RelativeLayout.CENTER_HORIZONTAL);
            params.addRule(RelativeLayout.CENTER_VERTICAL);
            params.height = RelativeLayout.LayoutParams.MATCH_PARENT;
            params.width = RelativeLayout.LayoutParams.WRAP_CONTENT;
            textView.setLayoutParams(params);

        } else if (textView.getLayoutParams() instanceof LinearLayout.LayoutParams) {
            LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) textView.getLayoutParams();
            params.gravity = Gravity.CENTER;
            textView.setLayoutParams(params);
        }
        textView.setTextColor(ContextCompat.getColor(this, R.color.tabs_title_color));
        textView.setTextSize(convertDipToPixels(10));
    }

    /*      ((TextView)(mTabHost.getTabWidget().getChildAt(1).findViewById(android.R.id.title))).setTextColor(getResources().getColor(R.color.headerbar_selected_tab_color));
          ((TextView)(mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title))).setTextColor(Color.WHITE);*/

    mTabHost.setOnTabChangedListener(new OnTabChangeListener() {

        @Override
        public void onTabChanged(String tabId) {

            FragmentManager fragmentManager = getSupportFragmentManager();
            BucketImageFragment imageFragment = (BucketImageFragment) fragmentManager.findFragmentByTag("tab1");
            BucketVideoFragment videoFragment = (BucketVideoFragment) fragmentManager.findFragmentByTag("tab2");
            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

            if (tabId.equalsIgnoreCase("tab1")) {

                headerBarTitle.setText(getResources().getString(R.string.image));
                headerBarCamera.setBackgroundResource(R.drawable.selector_camera_button);
                headerBarCamera.setTag(getResources().getString(R.string.image));

                if (imageFragment == null) {
                    BucketImageFragment newImageFragment = new BucketImageFragment();
                    fragmentTransaction.add(R.id.realTabcontent, newImageFragment, "tab1");

                } else {

                    if (videoFragment != null) {
                        fragmentTransaction.hide(videoFragment);
                    }

                    fragmentTransaction.show(imageFragment);

                }
                ((TextView) (mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title)))
                        .setTextColor(getResources().getColor(R.color.headerbar_selected_tab_color));
                ((TextView) (mTabHost.getTabWidget().getChildAt(1).findViewById(android.R.id.title)))
                        .setTextColor(Color.WHITE);

            } else {
                headerBarTitle.setText(getResources().getString(R.string.video));
                headerBarCamera.setBackgroundResource(R.drawable.selector_video_button);
                headerBarCamera.setTag(getResources().getString(R.string.video));

                if (videoFragment == null) {

                    final BucketVideoFragment newVideoFragment = new BucketVideoFragment();
                    fragmentTransaction.add(R.id.realTabcontent, newVideoFragment, "tab2");

                } else {

                    if (imageFragment != null) {
                        fragmentTransaction.hide(imageFragment);
                    }

                    fragmentTransaction.show(videoFragment);
                }

                ((TextView) (mTabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title)))
                        .setTextColor(Color.WHITE);
                ((TextView) (mTabHost.getTabWidget().getChildAt(1).findViewById(android.R.id.title)))
                        .setTextColor(getResources().getColor(R.color.headerbar_selected_tab_color));

            }

            fragmentTransaction.commit();
        }
    });

    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) headerBarCamera.getLayoutParams();
    params.height = convertDipToPixels(40);
    params.width = convertDipToPixels(40);
    headerBarCamera.setLayoutParams(params);
    headerBarCamera.setScaleType(ScaleType.CENTER_INSIDE);
    headerBarCamera.setPadding(convertDipToPixels(15), convertDipToPixels(15), convertDipToPixels(15),
            convertDipToPixels(15));

}

From source file:com.tarun.smartwomen.WebViewDemoActivity.java

@SuppressLint({ "JavascriptInterface", "SetJavaScriptEnabled" })
@Override//  w  w  w .  j  ava2 s  . co  m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.mainn);

    Intent intent = getIntent();
    reg = intent.getBooleanExtra("reg", false);

    i = (ImageView) findViewById(R.id.hj);

    try {

        big = new GifAnimationDrawable(getResources().openRawResource(R.raw.anim2));
        // big.setOneShot(true);
        android.util.Log.v("GifAnimationDrawable", "===>Four");
    } catch (IOException ioe) {

    }

    i.setImageDrawable(big);
    big.setVisible(true, true);

    sp = getSharedPreferences("your_prefs", Activity.MODE_PRIVATE);
    // historyStack = new LinkedList<Link>();
    webview = (WebView) findViewById(R.id.webkit);

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

    webSettings.setDomStorageEnabled(true);
    // webview.addJavascriptInterface(new WebViewDemoActivity(), "Android");
    // webview.getSettings().setJavaScriptEnabled(true);

    webview.getSettings().setBuiltInZoomControls(true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
        // webview.getSettings().setPluginState(PluginState.ON);
        // webview.getSettings().setJavaScriptEnabled(true);
    } else {
        // IMPORTANT!! this method is no longer available since Android 4.3
        // so the code doesn't compile anymore
        // webview.getSettings().setPluginsEnabled(true);
    }

    // Internet

    ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(
            Context.CONNECTIVITY_SERVICE);
    connected = false;
    if ((null != connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) && connectivityManager
            .getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED)
            || (null != connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI) && connectivityManager
                    .getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED)) {
        // we are connected to a network
        connected = true;
    }

    if (connected == false) {
        /*
         * Toast.makeText(Rss.this,
         * "Connect to internet and Restart Application",
         * Toast.LENGTH_SHORT).show();
         */
        webview.setVisibility(View.INVISIBLE);

        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(WebViewDemoActivity.this);

        // alertDialogBuilder.setTitle("Please connect to Internet");
        alertDialogBuilder.setMessage(
                "In order to provide the freshest recipes and juicing information this app must be connected to the internet, please check your internet settings");
        // set positive button: Yes message

        alertDialogBuilder.setNegativeButton("Ok", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                // cancel the alert box and put a Toast to the user

                startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0);
            }
        });
        AlertDialog alertDialog = alertDialogBuilder.create();
        // show alert
        alertDialog.show();

    }

    // downloads
    // webview.setDownloadListener(new CustomDownloadListener());

    webview.setWebViewClient(new CustomWebViewClient());

    webview.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onProgressChanged(WebView view, int progress) {

        }

        @Override
        public void onReceivedTitle(WebView view, String title) {
        }

        @Override
        public void onReceivedIcon(WebView view, Bitmap icon) {

        }

    });

    // http://stackoverflow.com/questions/2083909/android-webview-refusing-user-input
    webview.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
            case MotionEvent.ACTION_UP:
                if (!v.hasFocus()) {
                    v.requestFocus();
                }
                break;
            }
            return false;
        }

    });

    if (reg == true) {
        if (Locale.getDefault().getLanguage().equals("es")) {

            webview.loadUrl("http://om-msmartwoman.com/member/register");
            // webview.loadUrl("http://live-juice-guru.gotpantheon.com/user/login");
        } else {
            webview.loadUrl("http://om-msmartwoman.com/member/register");
        }

        webview.requestFocus();
    } else {
        uhdj = sp.getString("your_int_key", "0");

        Log.e("Url is here ..............................", uhdj);
        // Welcome page loaded from assets directory
        if (Locale.getDefault().getLanguage().equals("es")) {

            webview.loadUrl(uhdj);
            // webview.loadUrl("http://live-juice-guru.gotpantheon.com/user/login");
        } else {
            webview.loadUrl(uhdj);
        }

        webview.requestFocus();
    }

}

From source file:com.anhuioss.crowdroid.activity.MoreFunctionActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setLayoutResId(R.layout.activity_more);

    headBack = (Button) findViewById(R.id.head_back);
    headHome = (Button) findViewById(R.id.head_refresh);
    headName = (TextView) findViewById(R.id.head_Name);
    headName.setText(R.string.setting_more);

    // setting item
    account_manage = (TextView) findViewById(R.id.account_manage);
    themes_setting = (TextView) findViewById(R.id.themes_setting);
    browsemode = (TextView) findViewById(R.id.skim);
    weibo_setting = (TextView) findViewById(R.id.weibo_setting);
    setting = (TextView) findViewById(R.id.setting);
    license = (TextView) findViewById(R.id.license);
    officeWeibo = (TextView) findViewById(R.id.office_weibo);
    check_update = (TextView) findViewById(R.id.check_update);
    about = (TextView) findViewById(R.id.about);
    logout = (TextView) findViewById(R.id.logout);
    feedback = (TextView) findViewById(R.id.feedback);

    myHandler = new MyHandler();

    headBack.setOnClickListener(this);
    headHome.setOnClickListener(this);
    headHome.setBackgroundResource(R.drawable.main_home);

    account_manage.setOnClickListener(this);
    themes_setting.setOnClickListener(this);
    browsemode.setOnClickListener(this);
    weibo_setting.setOnClickListener(this);
    setting.setOnClickListener(this);
    license.setOnClickListener(this);
    officeWeibo.setOnClickListener(this);
    check_update.setOnClickListener(this);
    about.setOnClickListener(this);
    logout.setOnClickListener(this);
    feedback.setOnClickListener(this);

}

From source file:com.alex.smartwomanmiddleeastfem.WebViewDemoActivity.java

@SuppressLint({ "JavascriptInterface", "SetJavaScriptEnabled" })
@Override/*from  ww w.  ja v a  2  s . c o  m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.mainn);

    Intent intent = getIntent();
    reg = intent.getBooleanExtra("reg", false);

    i = (ImageView) findViewById(R.id.hj);

    try {

        big = new GifAnimationDrawable(getResources().openRawResource(R.raw.anim2));
        // big.setOneShot(true);
        android.util.Log.v("GifAnimationDrawable", "===>Four");
    } catch (IOException ioe) {

    }

    i.setImageDrawable(big);
    big.setVisible(true, true);

    sp = getSharedPreferences("your_prefs", Activity.MODE_PRIVATE);
    // historyStack = new LinkedList<Link>();
    webview = (WebView) findViewById(R.id.webkit);

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

    webSettings.setDomStorageEnabled(true);
    // webview.addJavascriptInterface(new WebViewDemoActivity(), "Android");
    // webview.getSettings().setJavaScriptEnabled(true);

    webview.getSettings().setBuiltInZoomControls(true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
        // webview.getSettings().setPluginState(PluginState.ON);
        // webview.getSettings().setJavaScriptEnabled(true);
    } else {
        // IMPORTANT!! this method is no longer available since Android 4.3
        // so the code doesn't compile anymore
        // webview.getSettings().setPluginsEnabled(true);
    }

    // Internet

    ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(
            Context.CONNECTIVITY_SERVICE);
    connected = false;
    if ((null != connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) && connectivityManager
            .getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED)
            || (null != connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI) && connectivityManager
                    .getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED)) {
        // we are connected to a network
        connected = true;
    }

    if (connected == false) {
        /*
         * Toast.makeText(Rss.this,
         * "Connect to internet and Restart Application",
         * Toast.LENGTH_SHORT).show();
         */
        webview.setVisibility(View.INVISIBLE);

        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(WebViewDemoActivity.this);

        // alertDialogBuilder.setTitle("Please connect to Internet");
        alertDialogBuilder.setMessage(
                "Through our app offers some offline features, in order to stay actively connected to the SmartWoman community in realtime, you need an internet connection, tap here to check your settings or wait until you have connection.");
        // set positive button: Yes message

        alertDialogBuilder.setNegativeButton("Ok", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                // cancel the alert box and put a Toast to the user

                startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0);
            }
        });
        AlertDialog alertDialog = alertDialogBuilder.create();
        // show alert
        alertDialog.show();

    }

    // downloads
    // webview.setDownloadListener(new CustomDownloadListener());

    webview.setWebViewClient(new CustomWebViewClient());

    webview.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onProgressChanged(WebView view, int progress) {

        }

        @Override
        public void onReceivedTitle(WebView view, String title) {
        }

        @Override
        public void onReceivedIcon(WebView view, Bitmap icon) {

        }

    });

    // http://stackoverflow.com/questions/2083909/android-webview-refusing-user-input
    webview.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
            case MotionEvent.ACTION_UP:
                if (!v.hasFocus()) {
                    v.requestFocus();
                }
                break;
            }
            return false;
        }

    });

    if (reg == true) {
        if (Locale.getDefault().getLanguage().equals("es")) {

            webview.loadUrl("http://www.qa-msmartwoman.com/member/register");
            // webview.loadUrl("http://live-juice-guru.gotpantheon.com/user/login");
        } else {
            webview.loadUrl("http://www.qa-msmartwoman.com/member/register");
        }

        webview.requestFocus();
    } else {
        uhdj = sp.getString("your_int_key", "0");

        //   Log.e("Url is here ..............................", uhdj);
        // Welcome page loaded from assets directory
        if (Locale.getDefault().getLanguage().equals("es")) {

            webview.loadUrl(uhdj);
            // webview.loadUrl("http://live-juice-guru.gotpantheon.com/user/login");
        } else {
            webview.loadUrl(uhdj);
        }

        webview.requestFocus();
    }

}

From source file:com.facebook.android.FbDialog.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    popupProgressItem = new PopupItem();
    popupProgressDialogFragment = PopupProgressFragment.newInstance(popupProgressItem);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    mContent = new FrameLayout(getContext());

    /* Create the 'x' image, but don't add to the mContent layout yet
     * at this point, we only need to know its drawable width and height
     * to place the webview//ww w.  j a va 2 s  .c  om
     */
    createCrossImage();

    /* Now we know 'x' drawable width and height,
     * layout the webivew and add it the mContent layout
     */
    int crossWidth = mCrossImage.getDrawable().getIntrinsicWidth();
    setUpWebView(crossWidth / 2);

    /* Finally add the 'x' image to the mContent layout and
     * add mContent to the Dialog view
     */
    mContent.addView(mCrossImage, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    addContentView(mContent, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}