Skip to content

Instantly share code, notes, and snippets.

View alitamoor65's full-sized avatar
💭
I may be slow to respond.

Ali Tamoor alitamoor65

💭
I may be slow to respond.
  • Soft Logix
  • Multan, Pakistan
View GitHub Profile
package com.tutorialscafe.readallsms;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
@alitamoor65
alitamoor65 / getScreenShot.java
Last active April 9, 2018 16:51
Get Screen Shot and Save to Local Sorage
saveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AdRequest adRequest = new AdRequest.Builder().build();
utils.interstitialAd.loadAd(adRequest);
View content = findViewById(R.id.combineImageID);
Bitmap bitmap = getScreenShoot(content);
String currentImage = "Pakistan-Independence-Frame-" + System.currentTimeMillis() + ".png";
@alitamoor65
alitamoor65 / FrameChooserActivity.xml
Last active April 9, 2018 17:08
Grid View From Local Storage
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:background="@drawable/main_bg"
tools:context="pk.camict.jovial.eidmubarakprofile.FrameChosserActivity"
android:gravity="center">
@alitamoor65
alitamoor65 / CopyFromAssetsToSDCard.java
Created April 9, 2018 17:00
Copy All Files from Assets to SD Card
private String storeImage(Bitmap bitmap,String fileName){
String dirPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/FilterImages";
File dir = new File(dirPath);
if(!dir.exists()){
dir.mkdir();
}
File file = new File(dirPath,fileName);
try{
FileOutputStream fileOutputStream = new FileOutputStream(file);
@alitamoor65
alitamoor65 / ShareAppLink.java
Created April 9, 2018 17:06
Share Android App click
@alitamoor65
alitamoor65 / Manifest.xml
Created April 10, 2018 03:12
Request and Check RunTime Permissions
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tutorialscafe.readallsms">
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@alitamoor65
alitamoor65 / PressAgainToExit.java
Created April 10, 2018 03:14
Press Again To Exit With Timer
private long lastPressedTime;
private static final int PERIOD = 2000;
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
switch (event.getAction()) {
case KeyEvent.ACTION_DOWN:
if (event.getDownTime() - lastPressedTime < PERIOD) {
finish();
@alitamoor65
alitamoor65 / Manifest.xml
Last active October 9, 2018 07:11
Follow the step the make it done 1. Create a java class and name `UnlockReceiver.java` whatever you want :) 2. Add the following `UnlockReceiver.java` code in your whatever java class 3. Register your receiver in your manifest file by adding following lines ```java <receiver android:name=".textonphoto.AdsControler.UnlockReceiver.java" android:en…
<receiver
android:name=".textonphoto.AdsControler.UnlockReceiver.java"
android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.SCREEN_OFF" />
<action android:name="android.intent.action.SCREEN_ON" />
<action android:name="android.intent.action.USER_PRESENT" />
<category android:name="android.intent.category.DEFAULT"></category>
</intent-filter>
<?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"
android:background="@drawable/login_bg"
tools:context=".activities.LoginActivity">
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
@alitamoor65
alitamoor65 / gist:5b46b4af3974523b3a2c99904e48c814
Created December 28, 2018 07:09 — forked from mstfldmr/gist:f6594b2337e3633673e5
Example of Volley GET and POST requests with parameters and headers
RequestQueue queue = Volley.newRequestQueue(context);
//for POST requests, only the following line should be changed to
StringRequest sr = new StringRequest(Request.Method.GET, "http://headers.jsontest.com/",
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.e("HttpClient", "success! response: " + response.toString());
}
},