Skip to content

Instantly share code, notes, and snippets.

View sanjogshrestha's full-sized avatar

Sanjog Shrestha sanjogshrestha

View GitHub Profile
@sanjogshrestha
sanjogshrestha / Create SHA1 fingerprint in ubuntu from terminal
Created August 21, 2014 04:58
Create SHA1 fingerprint in ubuntu from terminal
In the terminal :
1> cd /usr/lib/jvm/java-7-openjdk-amd64/bin
2> keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
@sanjogshrestha
sanjogshrestha / Change the position of groupIndicator image in Expandable List.
Created May 27, 2015 12:26
Change the position of groupIndicator image in Expandable List.
<!-- In the XML>
<ExpandableListView
android:id="@+id/nav_left_drawer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/title"
android:choiceMode="singleChoice"
android:divider="@color/title"
android:dividerHeight="0dp"
{
"success": true,
"inboxSecions": [
{
"id": "56db7e6a9b0e4dc096bc5be6ab60efda",
"type": "CUSTOM_SECTION",
"title": "Testing ",
"spAccountId": "b485f675e7954eaa86fd2202648be999",
"createdAt": "1644574368527",
"updatedAt": "1676616565805",
@sanjogshrestha
sanjogshrestha / To get android key hash code
Created August 20, 2014 09:07
To get android key hash code and To get Certificate fingerprint(MD5)
To get android key hash code follow these steps
Download the openssl for windows
now unzip to c drive
open cmd prompt
type cd C:\Program Files\Java\jdk1.6.0_26\bin
then type only
keytool -export -alias myAlias -keystore C:\Users\your user name\.android\myKeyStore | C:\openssl-0.9.8k_WIN32 \bin\opens sl sha1 -binary | C:\openssl-0.9.8k_WIN32\bin\openssl enc -a -e
@sanjogshrestha
sanjogshrestha / Position the zoom bar button in Google Maps in android
Created June 3, 2015 12:24
Position the zoom bar button in Google Maps in android
/* Map fragment added to relocate the zoom controls in map
Value Id for zoom control is (0x1)
*/
MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
View zoomControls = mapFragment.getView().findViewById(0x1);
if (zoomControls != null && zoomControls.getLayoutParams() instanceof RelativeLayout.LayoutParams) {
// ZoomControl is inside of RelativeLayout
RelativeLayout.LayoutParams params_zoom = (RelativeLayout.LayoutParams) zoomControls.getLayoutParams();
@sanjogshrestha
sanjogshrestha / README.md
Created March 21, 2019 10:33 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

All hex value from 100% to 0% alpha:

@sanjogshrestha
sanjogshrestha / gist:75d1a9b43747ee5931501a12fedc85a4
Created September 14, 2018 08:20
Broken pipe error message
Broken pipe java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
at sun.nio.ch.IOUtil.write(IOUtil.java:65)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:524)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:627)
at com.android.ddmlib.SplitApkInstaller.uploadApk(SplitApkInstaller.java:151)
at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:77)
@sanjogshrestha
sanjogshrestha / service
Created July 22, 2016 08:31
location service example
public class LocationService extends Service
{
public static final String BROADCAST_ACTION = "Hello World";
private static final int TWO_MINUTES = 1000 * 60 * 2;
public LocationManager locationManager;
public MyLocationListener listener;
public Location previousBestLocation = null;
Intent intent;
int counter = 0;
/* class InitDiskCacheTask extends AsyncTask<File, Void, Void> {
@Override
protected Void doInBackground(File... params) {
synchronized (mDiskCacheLock) {
File cacheDir = params[0];
try {
mDiskLruCache = DiskLruCache.open(cacheDir, 1, 1, DISK_CACHE_SIZE);
} catch (IOException e) {
e.printStackTrace();
}
@sanjogshrestha
sanjogshrestha / Android.gitignore
Created March 4, 2018 11:16
GitIgnore Android
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class