Wirelessly Debugging of your Android App on Smartphone

First Set Path for adb command through system environment variable : F:\adt-bundle-windows-x86_64-20140702\sdk\platform-toolsNow type following commands on command prompt : Connect device via USB and make sure debugging is working. adb tcpip 5555 adb connect <DEVICE_IP_ADDRESS>:5555 Disconnect USB and proceed with wireless debugging. adb -s <DEVICE_IP_ADDRESS>:5555 usb to switch back when done. <DEVICE_IP_ADDRESS> : type following command […]

Make phone call using intent in android

1. Add below permission in manifest file : <uses-permission android:name=”android.permission.CALL_PHONE” /> 2. Use below code for phone call. String mobileno = “9999999999”; String uri = “tel:” + mobileno.trim() ; Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse(uri)); startActivity(intent);

How to implement share via option in android

Intent i=new Intent(android.content.Intent.ACTION_SEND); i.setType(“text/plain”); i.putExtra(android.content.Intent.EXTRA_SUBJECT,”Subject test”); i.putExtra(android.content.Intent.EXTRA_TEXT, “extra text that you want to put”); startActivity(Intent.createChooser(i,”Share via”));

How to check internet is connected or not in android

import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class NetworkCheck { public static boolean hasInternetConnection(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo wifiNetwork = cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (wifiNetwork != null && wifiNetwork.isConnected()) { return true; } NetworkInfo mobileNetwork = cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); if (mobileNetwork != null && mobileNetwork.isConnected()) { return true; } NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); if (activeNetwork […]

Webview in android

WebView is a view that display web pages inside your application. You can also specify HTML string and can show it inside your application using WebView. WebView makes turns your application to a web application. <WebView xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/webview” android:layout_width=”fill_parent” android:layout_height=”fill_parent” /> WebView webview = (WebView) findViewById(R.id.webview); webview.loadUrl(“http://www.google.com”); If you click on any link inside the […]

How to load pdf file in your android application

WebView webview = (WebView) findViewById(R.id.webview); webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setBuiltInZoomControls(true); webview.loadUrl(“https://docs.google.com/gview?embedded=true&url=<PDF_COMPLETE_URL>”); webview.setWebViewClient(new WebViewClient() {            @Override            public void onPageFinished(WebView view, String url) {                                          } });