Hide the title bar

 

//Hide the title bar requestWindowFeature(Window.FEATURE_NO_TITLE);

Display notification in info bar

 

NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Notification noty = new Notification(R.drawable.icon, "Button 1 clicked", System.currentTimeMillis()); noty.setLatestEventInfo(context, "Notice", msg, contentIntent); notificationManager.notify(1, noty);

Get IP address

 

public String getLocalIpAddress() {     try {         for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {             NetworkInterface intf = en.nextElement();             for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {                 InetAddress inetAddress = enumIpAddr.nextElement();                 if (!inetAddress.isLoopbackAddress()) {                     return inetAddress.getHostAddress().toString();                 }             }         }     } catch (SocketException ex) {         Log.e(LOG_TAG, [...]

Insert a contact

 

private Uri insertContact(Context context, String name, String phone) {               ContentValues values = new ContentValues();        values.put(People.NAME, name);        Uri uri = getContentResolver().insert(People.CONTENT_URI, values);        Uri numberUri = Uri.withAppendedPath(uri, People.Phones.CONTENT_DIRECTORY);        values.clear();               values.put(Contacts.Phones.TYPE, People.Phones.TYPE_MOBILE);        values.put(People.NUMBER, phone);        getContentResolver().insert(numberUri, values);               return uri;    }

[...]

MAke activity full screen

 

requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)

Get current orientation of the activity

 

Activity.getResources().getConfiguration().orientation