Skip to content

Instantly share code, notes, and snippets.

View bulentsiyah's full-sized avatar

Bulent Siyah bulentsiyah

View GitHub Profile
How to programmatically take a screenshot in Android?
Reference: http://stackoverflow.com/a/5651242
Here is the code that allowed my screenshot to be stored on sd card and used later for whatever your needs are:
First, add proper permission to save file:
And this is the code (running in an Activity):
private void takeScreenshot() { Date now = new Date(); android.text.format.DateFormat.format("yyyy-MM-dd_hh:mm:ss", now);
Open pdf files located inside the App (raw folder) Android
try {
copyFile(getResources().openRawResource(R.raw.yardim),
new FileOutputStream(new File(dirpicture, "yardim_copy.pdf")));
File pdfFile = new File(dirpicture, "yardim_copy.pdf");
Uri path = Uri.fromFile(pdfFile);
Intent intent = new Intent(Intent.ACTION_VIEW);
//AndroidManifest.xml
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
//public class ControllerService extends Service {
Dialog dialog;
//public void onCreate()
try{
View checkBoxView = View.inflate(this, R.layout.dialog_gps_uyarisi, null);
@bulentsiyah
bulentsiyah / App.cs
Last active November 3, 2017 22:58
Xamarin Forms Example: Deeper Into Text
MainPage = new NavigationPage(new Main());
Main.cs
public class Main : ContentPage
{
public Main()
{
@bulentsiyah
bulentsiyah / App.cs
Created November 3, 2017 23:01
Xamarin Forms Example: Scrolling The Stack
App.cs
MainPage = new NavigationPage(new Main());
Main.cs
public class Main : ContentPage
{
public Main()
{
@bulentsiyah
bulentsiyah / TwoButtonsPage.cs
Created November 3, 2017 23:04
Xamarin Forms Example: Button Clicks (Two Buttons – Simplest Keypad)
TwoButtonsPage.cs
public class TwoButtonsPage : ContentPage
{
Button addButton, removeButton;
StackLayout loggerLayout = new StackLayout();
public TwoButtonsPage()
{
// Create the Button views and attach Clicked handlers.
final EditText edittext = (EditText) findViewById(R.id.edittext);
edittext.setOnKeyListener(new View.OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
Toast.makeText(YourActivity.this, edittext.getText(), Toast.LENGTH_SHORT).show();
return true;
}
return false;
}
(compile 'com.google.android.gms:play-services-places:11.4.2')
------------------------------------------------------------------------
AndroidManifest.xml
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key"/>
---------------------------------------------------------------------------
MapsActivity
PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment)
@bulentsiyah
bulentsiyah / test.xml
Last active May 17, 2018 07:58
Set rounded corner radius border to layout (Android) --- http://www.bulentsiyah.com/set-rounded-corner-radius-border-to-layout-android/
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- background color -->
<solid
android:color="@color/theme_color_white">
</solid>
//: Playground - noun: a place where people can play
import UIKit
// arrays
var favoriteMovie=["dizi1","dizi2","dizi3"]
favoriteMovie[0]
favoriteMovie[1]="dizi 99"
favoriteMovie.count
favoriteMovie.isEmpty
favoriteMovie.append("yeni1")