Skip to content

Instantly share code, notes, and snippets.

import java.util.*;
public class Sample{
public static void main(String[] args){
System.out.println("Hello world ");
}
}
//Give Your PackageName Ex:com.companyname.projectname;
package com.pgeek.sample;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
public class ConnectionDetector {
private Context _context;
public class MainActivity extends AppCompatActivity{
SectionsPagerAdapter mSectionsPagerAdapter;
static SessioManager session;
ViewPager mViewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.pager);
public class AppsListActivity extends Activity {
private PackageManager manager;
private ArrayList<AppDetail> apps;
private ListView list;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_apps_list);
@BALUSANGEM
BALUSANGEM / LollipopBitmapMemoryCacheParamsSupplier.java
Created September 5, 2017 06:53 — forked from sensen/LollipopBitmapMemoryCacheParamsSupplier.java
Fresco's custom BitmapMemoryCacheParamsSupplier for Lollipop devices
public class LollipopBitmapMemoryCacheParamsSupplier implements Supplier<MemoryCacheParams> {
private ActivityManager activityManager;
public LollipopBitmapMemoryCacheParamsSupplier(ActivityManager activityManager) {
this.activityManager = activityManager;
}
@Override
public MemoryCacheParams get() {
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
public class ApiClient {
public static final String BASE_URL = "http://indianvedicschool.com/";
private static Retrofit retrofit = null;
public static Retrofit getClient() {
if (retrofit==null) {
@BALUSANGEM
BALUSANGEM / BLE
Last active February 6, 2018 09:16
open class BaseGhattCallback : BluetoothGattCallback() {
var mIsDeviceConnected = false
internal var mCommandCharacteristic: BluetoothGattCharacteristic? = null
open val TAG = BaseGhattCallback::class.java.simpleName
private val SUBSCRIBE_CHARACTERISTIC: Int = 0
private val READ_CHARACTERISTIC: Int = 1
private val WRITE_CHARACTERISTIC: Int = 2
fun queueReadDataFromCharacteristic(gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic) {
class LoginActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_login)
goto_main_screen_button.setOnClickListener {
gotoMainScreen()
}
}
private fun gotoMainScreen() {
public void createOnGlThread() {
// 1 texture to hold the video frame.
int textures[] = new int[1];
GLES20.glGenTextures(1, textures, 0);
mTextureId = textures[0];
int mTextureTarget = GLES11Ext.GL_TEXTURE_EXTERNAL_OES;
GLES20.glBindTexture(mTextureTarget, mTextureId);
GLES20.glTexParameteri(mTextureTarget, GLES20.GL_TEXTURE_MIN_FILTER,
public void update(float[] modelMatrix) {
float[] scaleMatrix = new float[16];
Matrix.setIdentityM(scaleMatrix, 0);
float SCALE_FACTOR = 1f;
scaleMatrix[0] = SCALE_FACTOR;
scaleMatrix[5] = SCALE_FACTOR;
scaleMatrix[10] = SCALE_FACTOR;
Matrix.multiplyMM(this.mModelMatrix, 0, modelMatrix, 0, scaleMatrix, 0);
}