Skip to content

Instantly share code, notes, and snippets.

View yudikarma's full-sized avatar
🏠
Working from home

yudi karma yudikarma

🏠
Working from home
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<com.example.yudikarma.androidcamera.Helper.AutoFitTextureView
android:id="@+id/textureview"
android:layout_width="wrap_content"
@yudikarma
yudikarma / MyDBHandler
Created January 2, 2019 09:14
Sqlite Helper for add record with image blop
package com.example.yudikarma.androidcamera.Sqlite;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@yudikarma
yudikarma / detect device reverse portrait
Last active January 11, 2019 09:41
method detect reverse portrait
private SensorManager mSensorManager;
private Sensor mOrientation;
boolean Upsidedown = false;
float value_0 = -10000;
float value_1 = -10000;
float deviceRotation = 0.0f;
boolean ispotrait = false;
===========================in adapter ======================
viewHolder.linecar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selected_position = i;
notifyDataSetChanged();
Log.e("position",""+selected_position);
Intent intent = new Intent("custom-message");
// intent.putExtra("quantity",Integer.parseInt(quantity.getText().toString()));
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'androidx.navigation.safeargs.kotlin'
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.21'
repositories {
google()
jcenter()
}
dependencies {
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/dashboardfragment"
android:icon="@drawable/ic_home_white_32dp"
android:title="Dashboard"></item>
<item android:id="@+id/reportfragment"
android:icon="@drawable/ic_person_outline_white_32dp"
android:title="Report"></item>
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="@color/grey_5" android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout android:background="@color/grey_5"
android:id="@+id/appbar_main"
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/nav_graph"
app:startDestination="@id/dashboardfragment">
<fragment android:id="@+id/dashboardfragment"
android:name="com.company107.myapplication.UI.Fragment.DasboardFragment" android:label="DashboardFragment"
tools:layout="@layout/dasboard_fragment"/>
<fragment android:id="@+id/reportfragment" android:name="com.company107.myapplication.UI.Fragment.ReportFragment"
package com.company107.myapplication.UI
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.PersistableBundle
import androidx.navigation.NavController
import androidx.navigation.Navigation
import androidx.navigation.ui.NavigationUI
import com.company107.myapplication.R