Skip to content

Instantly share code, notes, and snippets.

View techiesatish's full-sized avatar

Satish K techiesatish

View GitHub Profile
public Bitmap takeScreenshot() {
View rootView = findViewById(android.R.id.content).getRootView();
rootView.setDrawingCacheEnabled(true);
return rootView.getDrawingCache();
}
private String saveImage(Bitmap finalBitmap) {
File myDir = new File(Environment.getExternalStorageDirectory().toString() + "/GoodOffers");
myDir.mkdirs();
String fname = "GoodOffers_"+ mData.mOffers +".jpeg";
@techiesatish
techiesatish / ContactsActivity.java
Last active April 22, 2018 16:49
Retrieve contacts in Android. Here we are fetching all the contacts with user number and mobile. You need to add READ_CONTACTS permission Manifest file. Reference: http://www.techiesatish.com/retrieving-contacts-in-listview-in-android/
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/lv_Contacts"
android:layout_width="wrap_content"