Skip to content

Instantly share code, notes, and snippets.

View orhanavan's full-sized avatar
👊
Attack!

Orhan AVAN orhanavan

👊
Attack!
View GitHub Profile
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:shadowColor="#FF41DA"
android:shadowDx="50"
android:shadowDy="20"
android:shadowRadius="10"
android:text="Hello World!"
android:textSize="40sp" />
@orhanavan
orhanavan / gist:a791a07e4296b7907f44765b14edf0d6
Created July 18, 2018 17:54
TextView Highlighter by programatically
textView.setShadowLayer(10,50,20, Color.parseColor("#FF41DA"));
@orhanavan
orhanavan / button.java
Created July 18, 2018 19:05
android button click event
button = findViewById(R.id.button);
// creating listener for each button
View.OnClickListener btnClick = new View.OnClickListener() {
@Override
public void onClick(View view) {
// do anything
}
};
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// do anything
}
});
@orhanavan
orhanavan / checkbox.xml
Created July 18, 2018 20:43
android checkbox
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Kuralları okudum ve onaylıyorum." />
@orhanavan
orhanavan / checkbox.java
Created July 18, 2018 20:45
android checkbox
final CheckBox checkBox = findViewById(R.id.checkBox);
checkBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (checkBox.isChecked())
checkBox.setChecked(true);
else
checkBox.setChecked(false);
}
});
@orhanavan
orhanavan / checkbox2.java
Created July 18, 2018 20:50
Android checkbox
final CheckBox checkBox = findViewById(R.id.checkBox);
checkBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (((CheckBox) view).isChecked()) {
checkBox.setChecked(false);
} else {
checkBox.setChecked(true);
}
}
@orhanavan
orhanavan / sharedPreferences.kt
Created August 20, 2018 15:08
shared preferences
package com.kotlin.sharedpreferences
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@orhanavan
orhanavan / activity_main.xml
Created August 20, 2018 18:18
first activity
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView"
@orhanavan
orhanavan / activity_main2.xml
Last active August 20, 2018 18:19
second activity
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Main2Activity">
<TextView
android:id="@+id/textView"