Skip to content

Instantly share code, notes, and snippets.

View srmdev29's full-sized avatar

Sree srmdev29

  • Dallas
View GitHub Profile
@srmdev29
srmdev29 / Android adb
Last active September 19, 2015 18:07
Android Cheatsheet - useful tips, adb commands, all about android developement.
* Display SHA1 for keystore -Typically used in Google Maps
# keytool -list -v -keystore ~/.android/debug.keystore -alias your_alias
*Genereate hash from keystore -Typically used in Facebook
# keytool -exportcert -alias your_alias -keystore debug.keystore | openssl sha1 -binary | openssl base64
adb
@srmdev29
srmdev29 / material-range-slider
Created September 16, 2015 15:39
material-range-slider
http://toastdroid.com/2015/06/19/material-range-slider/
@srmdev29
srmdev29 / Useful regular expressions
Last active September 15, 2015 17:37
Posting all useful regular expressions.
1. System.out.println("13775.183km".replaceAll("[^0-9?!\\.]",""));
//input.replaceAll("[^0-9?!\\.]","") This will ignore the decimal points.
//eg: if you have an input as 13775.183km the output will be13775.183.
@srmdev29
srmdev29 / Pause-Resume Countdowntimer
Last active September 11, 2015 16:12
Pause , resume the countdown timer where it left. coupled with activity lifecycle. Just call onresume.onapuse ..it will take care.
public abstract class CountDownTimerWithPause {
/**
* Millis since boot when alarm should stop.
*/
private long mStopTimeInFuture;
/**
* Real time remaining until timer completes
*/
@srmdev29
srmdev29 / setListViewHeightBasedOnItems.txt
Last active September 9, 2015 13:22
setListViewHeightBasedOnItems
public static boolean setListViewHeightBasedOnItems(ListView listView) {
ListAdapter listAdapter = listView.getAdapter();
if (listAdapter != null) {
int numberOfItems = listAdapter.getCount();
// Get total height of all items.
int totalItemsHeight = 0;
for (int itemPos = 0; itemPos < numberOfItems, itemPos++) {
@srmdev29
srmdev29 / BBChatViewHost.java
Last active September 3, 2015 18:08 — forked from creativepsyco/BBChatViewHost.java
How to scroll Android Listview to the bottom always
public void scrollBottom() {
// scroll bottom requires posting a runnable to the listView
// in the case of items loading by themselves dynamically
// there may be sync issues and scrolling won't be proper
m_bNeedScrollToBottom = false;
if (m_listView.getLastVisiblePosition()-m_listView.getFirstVisiblePosition() <= m_listView.getCount())
m_listView.setStackFromBottom(false);
else
m_listView.setStackFromBottom(true);
BBUILoop.getInstance().delayPost(new Runnable() {
package com.psrivastava.deviceframegenerator.widget;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;
import android.widget.Toast;
tomahawk-android/src/org/tomahawk/tomahawk_android/mediaplayers/VLCMediaPlayer.java
<activity android:name=".SearchableActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<!-- note: this is needed to show a keyboard with proposals -->
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowBackground">@color/background</item>
<item name="android:actionBarStyle">@style/ActionBar</item>
<item name="android:actionBarWidgetTheme">@style/ActionBarWidget</item>
</style>
<!-- Actionbar Theme -->