This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
import time | |
TRIG = 24 | |
ECHO = 23 | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(TRIG,GPIO.OUT) | |
GPIO.setup(ECHO,GPIO.IN) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun showDialogWithList(arrayList: ArrayList<String>){ | |
val builderSingle = AlertDialog.Builder(this@MainActivity) | |
builderSingle.setIcon(R.mipmap.ic_launcher_foreground) | |
builderSingle.setTitle("Select One Name:-") | |
builderSingle.setNegativeButton("cancel") { dialog, which -> dialog.dismiss() } | |
val adapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, arrayList) | |
builderSingle.setAdapter(adapter) { dialog, which -> | |
val strName = adapter.getItem(which) | |
val builderInner = AlertDialog.Builder(this@MainActivity) | |
builderInner.setMessage(strName) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Average.h> | |
#define WINDOW_SIZE 30 | |
#define IR_REC_PIN A0 | |
int ref_val = 0; | |
Average<int> an_buff(30); | |
int calibrate() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun whatsApp() { | |
val smsNumber = "923224522526" | |
val isWhatsappInstalled = whatsappInstalledOrNot("com.whatsapp") | |
if (isWhatsappInstalled) { | |
val sendIntent = Intent("android.intent.action.MAIN") | |
sendIntent.component = ComponentName("com.whatsapp", "com.whatsapp.Conversation") | |
sendIntent.putExtra("jid", PhoneNumberUtils.stripSeparators(smsNumber) + "@s.whatsapp.net")//phone number without "+" prefix | |
sendIntent.putExtra(Intent.EXTRA_TEXT, "dummy text from app"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bluetooth.home.auto; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import java.lang.reflect.Method; | |
import java.util.UUID; | |
import android.os.Build; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pl.kpob.utils.extensions | |
import android.app.Activity | |
import android.content.Context | |
import android.graphics.Color | |
import android.support.v4.content.ContextCompat | |
import android.view.WindowManager | |
import flow.Flow | |
import org.jetbrains.anko.AlertDialogBuilder | |
import pl.sisms.gminformix.utils.extensions.supportsLollipop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.a2050.rehman.abdul.dialogtest | |
import android.support.v7.app.AppCompatActivity | |
import android.os.Bundle | |
import android.support.v7.app.AlertDialog | |
import android.widget.Toast | |
import kotlinx.android.synthetic.main.activity_main.* | |
import android.content.DialogInterface | |
import android.R.array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LayoutInflater factory = LayoutInflater.from(this); | |
final View deleteDialogView = factory.inflate(R.layout.mylayout, null); | |
final AlertDialog deleteDialog = new AlertDialog.Builder(this).create(); | |
deleteDialog.setView(deleteDialogView); | |
deleteDialogView.findViewById(R.id.yes).setOnClickListener(new OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
//your business logic | |
deleteDialog.dismiss(); | |
} |