Posts

Webview inside dialog or popup Android

In this post, I will show how to open Webview inside the dialog or pop-up.  simply use this code below this will help you. AlertDialog . Builder alert = new AlertDialog . Builder ( this ); alert . setTitle ( "Title here" ); WebView wv = new WebView ( this ); wv . loadUrl ( "http:\\www.google.com" ); wv . setWebViewClient ( new WebViewClient () { @Override public boolean shouldOverrideUrlLoading ( WebView view , String url ) { view . loadUrl ( url ); return true ; } }); alert . setView ( wv ); alert . setNegativeButton ( "Close" , new DialogInterface . OnClickListener () { @Override public void onClick ( DialogInterface dialog , int id ) { dialog . dismiss (); } }); alert . show (); Thank you!!

Uploading file to server using Okhttp Android

In this post, i will show you how to upload a file to the server using the okhttp library.   OkHTTP  is an open source project designed to be an efficient HTTP client. It supports the SPDY protocol. SPDY is the basis for HTTP 2.0 and allows multiple HTTP requests to be multiplexed over one socket connection. Step 1. Create a new project in the android studio and add following permission in android manifest.xml for the Internet, Storage, Camera, Network State. < uses-permission android :name= "android.permission.ACCESS_NETWORK_STATE" /> < uses-permission android :name= "android.permission.INTERNET" /> < uses-permission android :name= "android.permission.READ_EXTERNAL_STORAGE" /> < uses-permission android :name= "android.permission.WRITE_EXTERNAL_STORAGE" /> < uses-permission android :name= "android.permission.CAMERA" /> Step 2. Add Okhttp dependency to  build.gradle  and click on sync. compile