Skip to content

Instantly share code, notes, and snippets.

View shamxalb's full-sized avatar
🎯
Focusing

Shamkhal Bayramov shamxalb

🎯
Focusing
View GitHub Profile
@shamxalb
shamxalb / AlertDialog.java
Created August 13, 2020 07:22
Simple Alert Dialog with Message
void showMessage(String text)
{
new AlertDialog.Builder(this)
.setTitle(text)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
})
.show();
@shamxalb
shamxalb / background.xml
Created May 18, 2020 10:43
Repeatable background (png pattern) for Android
<?xml version="1.0" encoding="utf-8"?>
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/square"
android:tileMode="mirror"
android:dither="true"
android:antialias="true" />
@shamxalb
shamxalb / AsyncUpload.java
Last active May 13, 2020 10:34
Upload image to server with post parameters and token via Volley Library
class AsyncUpload {
void request(final String token, final String url, final int method, final Map<String, String> params, final Bitmap bitmap)
{
VolleyMultipartRequest volleyMultipartRequest = new VolleyMultipartRequest(method, url,
new Response.Listener<NetworkResponse>() {
@Override
public void onResponse(NetworkResponse response) {
try {
@shamxalb
shamxalb / AndroidManifest.xml
Last active May 7, 2020 10:45
Android Splash Screen
<activity
android:name=".SplashActivity"
android:theme="@style/SplashTheme"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
@shamxalb
shamxalb / EmailActivity.java
Created May 7, 2020 10:39
Android open email intent
public class EmailActivity extends Activity {
String EMAIL_ADDRESS = "info@example.com";
String EMAIL_SUBJECT = "Information";
String EMAIL_SUBMIT = "Send";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
@shamxalb
shamxalb / Android Handler Runnable Example
Last active May 7, 2020 10:49
Android Handler Runnable Example
public class HandlerActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
handler.post(runnable);
}