Skip to content

Instantly share code, notes, and snippets.

View devrath's full-sized avatar
💭
I'm grateful when for one drop in glass. Since I knw exactly what to do with it

Devrath devrath

💭
I'm grateful when for one drop in glass. Since I knw exactly what to do with it
View GitHub Profile
/*
* Copyright (C) 2014 Jared Rummler <[email protected]>
*
* 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
@devrath
devrath / DeviceInformation
Created April 20, 2015 11:28
This class is used to get the device information like latitude, longitude, NetworkType, BatteryLevel, DeviceName, VersionCode, VersionName, SdkIntValue
package com.sample.myutilities.activities;
/**
* @author Devrath
*/
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@devrath
devrath / SetFontAtApplicationLevel
Created June 12, 2015 10:14
How to set the font in application level for entire application
Yes with reflection. This works ([based on this answer](http://stackoverflow.com/a/16275257/360211)):
import java.lang.reflect.Field;
import android.content.Context;
import android.graphics.Typeface;
public final class FontsOverride {
public static void setDefaultFont(Context context,
String staticTypefaceFieldName, String fontAssetName) {
@devrath
devrath / PassClassObjectBetweenActivities
Created June 24, 2015 06:02
pass class object between activities
// IN THE LISTVIEW CLICK of Activity-1 USE
lstViewId.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view, int position, long arg3) {
TextView titleName=(TextView) view.findViewById(R.id.txtTitleId);
//Start a new activity by putting a parcellable data into the intent
Intent intent=new Intent(getActivity().getApplicationContext(), Activity2.class);
@devrath
devrath / CheckboxCheckUncheckListViewButtonClick
Created June 30, 2015 12:39
OnClick of button in listview row check/uncheck the checkbox corrospondingly
public class AdptMyorderDetail extends BaseAdapter {
ArrayList<SerialNumbers> mSerialNumbers;
private Context mContext = null;
public AdptMyorderDetail(Context context, ArrayList<SerialNumbers> serialNo) {
super();
mContext = context;
@devrath
devrath / IndianCurrencyRupees
Created July 2, 2015 11:18
Convert number into Indian currency rupees
NumberFormat nf = NumberFormat.getCurrencyInstance(new Locale("en", "in"));
vHolder.txtOrderValueId.setText(nf.format(mMyOrders.get(position).getOrdervalue()) + "");
@devrath
devrath / Makeup
Last active August 29, 2015 14:24 — forked from Trikke/Makeup
package trikke.gists;
import android.graphics.Typeface;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.BackgroundColorSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.RelativeSizeSpan;
import android.text.style.StrikethroughSpan;
import android.text.style.StyleSpan;
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- RED -->
<color name="red_50">#FFEBEE</color>
<color name="red_100">#FFCDD2</color>
<color name="red_200">#EF9A9A</color>
<color name="red_300">#E57373</color>
<color name="red_400">#EF5350</color>
<color name="red_500">#F44336</color>
public class ScreenUtility {
private Activity activity;
private float dpWidth;
private float dpHeight;
public ScreenUtility(Activity activity) {
this.activity = activity;
Display display = activity.getWindowManager().getDefaultDisplay();
package com.android.test.activity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import com.android.test.R;
import com.android.test.fragment.MainFragment;
import roboguice.RoboGuice;
import roboguice.inject.InjectView;