Skip to content

Instantly share code, notes, and snippets.

View hitesh-dhamshaniya's full-sized avatar
🎯
Focusing

Hitesh Dhamshaniya hitesh-dhamshaniya

🎯
Focusing
View GitHub Profile
@hitesh-dhamshaniya
hitesh-dhamshaniya / gist:611360ad271169c28238
Created August 27, 2015 06:32
How to capture particular Layout Screenshot in android.
View view = relativeLayout; // Your layout which you want to capture
view.measure(View.MeasureSpec.makeMeasureSpec(1200, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(1920, View.MeasureSpec.UNSPECIFIED));
//view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
view.buildDrawingCache(true);
Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache());
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG,100,bytes);
and save bitmap in your desire location
@hitesh-dhamshaniya
hitesh-dhamshaniya / gist:bd6493da0b38657af0ca
Created February 28, 2015 13:25
Test Application Commad Line in Android
./adb shell monkey -p com.example.android.notepad -v 2000
@hitesh-dhamshaniya
hitesh-dhamshaniya / Live Wallpaper Direct
Created May 30, 2015 14:40
Android Live Wallpaper Direct show
if (android.os.Build.VERSION.SDK_INT > 15)
{
bundle.setAction("android.service.wallpaper.CHANGE_LIVE_WALLPAPER");
bundle.putExtra("android.service.wallpaper.extra.LIVE_WALLPAPER_COMPONENT", new ComponentName(com/loard/ganesha/MyService.getPackage().getName(), com/loard/ganesha/MyService.getCanonicalName()));
} else
{
bundle.setAction("android.service.wallpaper.LIVE_WALLPAPER_CHOOSER");
}
class PInfo {
private String appname = "";
private String pname = "";
private String versionName = "";
private int versionCode = 0;
private Drawable icon;
private void prettyPrint() {
Log.v("LOG===> ", appname + "\t" + pname + "\t" + versionName
+ "\t" + versionCode);
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:colorPrimary">@color/primary</item>
<item name="android:colorPrimaryDark">@color/primary_dark</item>
<item name="android:textColorPrimary">@color/primary_text</item>
<item name="android:textColorSecondary">@color/secondary_text</item>
<item name="android:colorAccent">@color/accent</item>
<item name="android:windowBackground">@color/window_background</item>
</style>
Uri imageUri = Uri.parse("/sdcard/Aa.png");
//Uri imageUri = Uri.parse("/storage/emulated/0/designapp/Aa.png");
Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
intent.setDataAndType(imageUri, "image/*");
intent.putExtra("png", "image/*");
startActivityForResult(Intent.createChooser(intent,"Set AS"), 1000);
User for Set Image as wallpaper, Contact Picture and other....
***************** Java ******************
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import android.content.Context;
import android.graphics.Rect;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import com.dhl.tiktail.BuildConfig;
import java.lang.reflect.Field;
using UnityEngine;
using System.Collections;
public class Santawalk : MonoBehaviour {
public float speed;
private Vector3 direction;
private Vector3 setVec;
// Use this for initialization
/**
* Performs rotation over bitmap
*
* @param bitmap
* Input bitmap for rotate
* @param orientation
* Value of image orientation
* @return Rotated bitmap
*/
public static Bitmap rotateBitmap(Bitmap bitmap, int orientation) {