Skip to content

Instantly share code, notes, and snippets.

View chandruark's full-sized avatar
🎯
Focusing

Chandru chandruark

🎯
Focusing
View GitHub Profile
@chandruark
chandruark / ActivityClass.java
Last active June 4, 2019 12:03
Google Place API Adapter - New Version Based on A new version of the Places SDK for Android -on ( 3-JUN-2019)
/**
* Place this Snippet in Activity File
* Secure `YOUR_GOOGLE_PLACE_API_KEY` Key in Build Config, if you need
*/
/**
* `etGoogleplaceApi` stands for AutocompleteEditText Widget
* Add Your Billings Details in Google Console, OR else it throws `QUERY_LIMIT_EXCEEDED` exception
@chandruark
chandruark / AutoFitTextureView.java
Last active June 13, 2019 06:07
Camera API 2 Class for Imp -> 1. Change your Package Name Accordingly 2.This Class uses Context Wrapper to Store Images in Directory<Your Wish>,
package <your pacakage name>;
import android.content.Context;
import android.util.AttributeSet;
import android.view.TextureView;
/**
* A {@link TextureView} that can be adjusted to a specified aspect ratio.
*/
public class AutoFitTextureView extends TextureView {
@chandruark
chandruark / Camera2Impl.java
Created May 3, 2019 05:43
Camera API 2 Class for Imp
package <your pacakage name>;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.DialogInterface;
public class SampleActivity extends AppCompatActivity {
/**
* Sample Snippet for Registering Receiver
*/
MyBroadcastReceiver myBroadCastReceiver;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@chandruark
chandruark / Autostart.java
Last active May 22, 2024 06:32
used to get Autostart option for Alarm Manager in Android
private void addAutoStartupswitch() {
try {
Intent intent = new Intent();
String manufacturer = android.os.Build.MANUFACTURER .toLowerCase();
String model= Build.MODEL;
Log.d("DeviceModel",model.toString());
switch (manufacturer){
case "xiaomi":
@chandruark
chandruark / SociaLoginActivity.java
Created February 28, 2018 10:53
Social Login Activity in Single Page- Twitter, Facebook, Google which takes img, name,access tokens etc.
package com.example.chandru.remainder.SocialLogins;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
@chandruark
chandruark / SpannableTextview.java
Created February 26, 2018 09:09
Change color for particular char in the TextView String.
/*default initializations for android activity file*/
/* here we gone a simple implementaion for Dollar Sign based on the type specified
R.string.Dollar ="$$$$"
*/
SpannableStringBuilder builder = new SpannableStringBuilder();
Textview textView_colchar=(TextView)findViewById(R.id.textView_colchar);
int type=1; //change based on the type needed ...
switch (type){