Skip to content

Instantly share code, notes, and snippets.

View srmdev29's full-sized avatar

Sree srmdev29

  • Dallas
View GitHub Profile
@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 / 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 / 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 / material-range-slider
Created September 16, 2015 15:39
material-range-slider
http://toastdroid.com/2015/06/19/material-range-slider/
@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 / byte-sizetuts.md
Created September 26, 2015 12:28 — forked from honkskillet/byte-sizetuts.md
A series of golang tutorials with youtube videos.
@srmdev29
srmdev29 / RestClient.java
Created October 21, 2015 15:27 — forked from Axxiss/RestClient.java
Restful client
public class RestClient {
private static final String TAG = "RestClient";
private static final String USER_AGENT = "VisioStorm Android";
/** Methods supported by RestClient */
public enum RequestMethod {
GET, POST
}
@srmdev29
srmdev29 / ArrayListSharedPreferences.txt
Last active January 26, 2016 18:48
Storing ArrayList on SharedPreferences . can store custom arraylist of objects.
private void setArrayListdata() {
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor = sharedPrefs.edit();
Gson gson = new Gson();
ArrayList<Wagesdata> wagesdata = new ArrayList<Wagesdata>();
Wagesdata wagesdata1 = new Wagesdata();
wagesdata1.monthly2_wages = monthly_wages.getText().toString();
wagesdata1.monthly2_ebill = monthly_ebill.getText().toString();
wagesdata1.monthly2_gas = monthly_gas.getText().toString();
@srmdev29
srmdev29 / TimerTask
Last active February 6, 2016 00:02
it will run every 10mints and initial delay is 10minutes. I have used AsyncHttpClient for webservice calls(server) // compile 'com.loopj.android:android-async-http:1.4.5'
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startTimer();
}
private final static int DO_UPDATE_PROMOTE = 0;
int COUNTER_REFRESH_OTHERCARD = 0;
@srmdev29
srmdev29 / Readme.md
Created February 9, 2016 13:27 — forked from gabrielemariotti/Readme.md
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example: