Skip to content

Instantly share code, notes, and snippets.

View gotoark's full-sized avatar
🎯
Focusing

RAJESH KUMAR ARUMUGAM gotoark

🎯
Focusing
View GitHub Profile
@gotoark
gotoark / Style_EditText.xml
Created April 26, 2017 06:24
Edit text with Visible Hint
<android.support.design.widget.TextInputLayout
android:id="@+id/text_input"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/edittext_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Your Hint"
@gotoark
gotoark / DynamicText.java
Created April 11, 2017 07:17
Fill the Text in Field Two while typing the Field 1
edittext1.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
edittext2.setText(s);
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
edittext2.setText(s);
}
@gotoark
gotoark / DatePicker.java
Last active April 19, 2017 05:00
Simple Date Picker in Android
@RequiresApi(api = Build.VERSION_CODES.N)
public void getDate(){
final Calendar calendar=Calendar.getInstance();
DatePickerDialog.OnDateSetListener dateSetListener=new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
calendar.set(Calendar.YEAR,year);
calendar.set(Calendar.MONTH,month);
@gotoark
gotoark / DuplicateEntryInArrayList
Created March 17, 2017 07:16
Find the No of Duplicate Entries in an Array List Using HashMap.
/*
Pass ArrayList as Arugument
*/
public static void findDuplicate(ArrayList<String> arrayList){
//Define Hash Map to Store String Value and its repeatCount
Map<String,Integer> duplicate_counter=new HashMap<String, Integer>();
/*For each String Value in the ArrayList Check Wather it is Available Already in Hash Map
if yes increment the value of a key in hash Map
else just add value as 1
@gotoark
gotoark / gist:44a106492699ac3e42af5312576edf54
Created March 13, 2017 03:24 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@gotoark
gotoark / AndroidRunTimePermissions.java
Created March 2, 2017 11:40
RunTime Permissions in Android M
package application.arkthepro.com.samplebluetoothapp;
import android.Manifest;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
@gotoark
gotoark / Pop-Up Menu With Icon
Created February 27, 2017 05:49
Show Pop-Up Menu With Icon in Android
public void showPopupMenuWithIcon(View view) {
PopupMenu popup = new PopupMenu(SavingDatainSQLDB.this, view);
try {
Field[] fields = popup.getClass().getDeclaredFields();
for (Field field : fields) {
if ("mPopup".equals(field.getName())) {
field.setAccessible(true);
Object menuPopupHelper = field.get(popup);
Class<?> classPopupHelper = Class.forName(menuPopupHelper.getClass().getName());
Method setForceIcons = classPopupHelper.getMethod("setForceShowIcon",boolean.class);
@gotoark
gotoark / Collections
Last active February 17, 2017 12:02
Exploring the Collections Methods
import java.awt.List;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
public class Collections {
var randomNumber = Math.floor(Math.random() * 100) + 1;
//Generate a random number between 1 and 100
#include<iostream.h>
#include<conio.h>
void main(){
char n[7]="PROGRAM";
int i=0,f=1,tb,ta,sb=0,sa=5,j=0,k=6;
clrscr();
while(i<sizeof(n)){
tb=sb;
//Print white Spaces
while(tb>0){