Skip to content

Instantly share code, notes, and snippets.

View kantapp's full-sized avatar

kantapp.com kantapp

View GitHub Profile
public static void hideSoftKeyboard(Activity activity) {
InputMethodManager inputMethodManager =
(InputMethodManager) activity.getSystemService(
Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(
activity.getCurrentFocus().getWindowToken(), 0);
}
<style name="AppTheme.fullScreen" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowNoTitle">true</item>
</style>
public String bitmap2base64(Bitmap bitmap)
{
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
byte[] byteArray = byteArrayOutputStream .toByteArray();
return Base64.encodeToString(byteArray, Base64.DEFAULT);
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kantapp.cameraapp">
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@kantapp
kantapp / TypeToken.java
Created June 23, 2018 05:16
TypeToken.java
List<Anime> arrayList= new Gson().fromJson(animeListDB.storedAnime(), new TypeToken<List<Anime>>(){}.getType());
@kantapp
kantapp / Typetoken.java
Created June 15, 2018 06:46
get Array from json for gson
List<CountryCode> countryCodeList= new Gson().fromJson(countryJson, new TypeToken<List<CountryCode>>(){}.getType());
@kantapp
kantapp / checkOriantation.kt
Last active June 6, 2018 05:44
Check Oriantation Andoird Kotlin
val view =inflater.inflate(R.layout.fragment_recent_anime, container, false)
dailyAnimeList=view.findViewById(R.id.dailyAnimeList)
dailyAnimeList!!.setHasFixedSize(true)
if(activity!!.resources.configuration.orientation==Configuration.ORIENTATION_PORTRAIT)
dailyAnimeList!!.layoutManager=GridLayoutManager(activity,2)
else
dailyAnimeList!!.layoutManager=GridLayoutManager(activity,4)
@kantapp
kantapp / PhoneAuth.java
Created May 4, 2018 13:55
Phone Auth Using Firebase
package com.kantapp.myfireapp.Activity;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
@kantapp
kantapp / WelcomeActivity.kt
Created May 3, 2018 05:23
menubar, how to send data in fragment
package com.kantapp.wizito.v1.Activity
import android.support.design.widget.Snackbar
import android.support.v7.app.AppCompatActivity
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter
import android.support.v4.view.ViewPager
import android.os.Bundle
@kantapp
kantapp / tokenAuth.php
Created April 21, 2018 06:25
How to get Header in php using Slim Framework
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
require 'vendor/autoload.php';
$app = new \Slim\App;
$app->get('/',function($request,$response,$array)
{
// $headers = apache_request_headers();