Skip to content

Instantly share code, notes, and snippets.

@ashmeh6
ashmeh6 / Compressor.java
Last active January 25, 2023 11:46
File Compression-decompression using java
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.DataFormatException;
import java.util.zip.Deflater;
import java.util.zip.Inflater;
/**
*
* @author Ashish Lal
@ashmeh6
ashmeh6 / AutoHotKeyCommands.txt
Created January 26, 2018 09:50
Containing commands needed to create Autohotkey script, helpfull in typing ASCII code from laptop if no numpad is there.
0::numpad0
1::numpad1
2::numpad2
3::numpad3
4::numpad4
http://html-demo.proteusthemes.com/webmarket/
//by ashish
//https://in.linkedin.com/in/ashishmehra610
public class ParseJsonFileAsync extends AsyncTask<Void, Void, String> {
Activity activity;
public ParseJsonFileAsync(Activity activity){
this.activity = activity;
}
/**
* Created by Ashish on 08-Feb-17.
*/
public class RecyclerAdapterAnimation extends RecyclerView.Adapter<RecyclerAdapterAnimation.Holder> {
@Override
public Holder onCreateViewHolder(ViewGroup parent, int viewType) {
return new Holder(view);
@ashmeh6
ashmeh6 / ImageCompression.java
Last active March 3, 2019 07:32
Compress image and write to external disk storage.
import android.content.Context;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.media.ExifInterface;
import android.net.Uri;
private class FetchAddressFromLocation extends AsyncTask<Void, Void, String> {
private Context context;
private Double latitude;
private Double longitude;
public FetchAddressFromLocation(Context context, Double latitude, Double longitude) {
this.context = context;
this.latitude = latitude;
this.longitude = longitude;
public class CallLogReadAndroid{
public CallLogReadAndroid(){
Uri allCalls = Uri.parse("content://call_log/calls");
StringBuffer sb = new StringBuffer();
sb.append("Call Details :");
Cursor c = managedQuery(allCalls, null, null, null, CallLog.Calls.DATE + " DESC LIMIT 100");
int date = c.getColumnIndex(CallLog.Calls.DATE);
int number = c.getColumnIndex(CallLog.Calls.NUMBER);
int name = c.getColumnIndex(CallLog.Calls.CACHED_NAME);
// String num= c.getString(c.getColumnIndex(CallLog.Calls.NUMBER));// for number
webView.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
// do your stuff here
webView.measure(View.MeasureSpec.makeMeasureSpec(
View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED),
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
webView.layout(0, 0, webView.getMeasuredWidth(),
webView.getMeasuredHeight());
webView.setDrawingCacheEnabled(true);
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software