Category Archives : Tutorials

Home  >>  Tutorials

IOS swift 3/4 google map clustering show actual number of marker in cluster

3
Jun,2018

0

We can manage it by changing one method of GMUDefaultClusterIconGenerator class. In GMUDefaultClusterIconGenerator.m replace below method, – (UIImage *)iconForSize:(NSUInteger)size { NSUInteger bucketIndex = [self bucketIndexForSize:size]; NSString *text; // If size is smaller to first bucket size, use the size as is otherwise round it…

FATAL EXCEPTION: main Process: com.sohozmarket, PID: 1046 java.lang.RuntimeException: Canvas: trying to draw too large(132710400bytes) bitmap.

30
May,2018

0

Move your image in the (hi-res) drawable to drawable-xxhdpi.

Error:Cause: services.gradle.org Consult IDE log for more details (Help | Show Log)

29
May,2018

0

Problem : Gradle failed to build . Solution : You need to do build your gradle file . For that first check your internet connection is available . Then re sync gradle  file . Done 🙂

Android how to remove new line and spaces and all html tags from String

29
May,2018

0

Step 1:  compile ‘org.jsoup:jsoup:1.11.3’ add jsonup gradle and sync. Step 2 : create a method public static String html2text(String html) { return Jsoup.parse(html).text(); } Step 3 : implement this String descriptionRawText = “raw text”; String descriptionFinalText = descriptionRawText.replace(“\n”, “”).replaceAll(“\\<[^>]*>”,””).replace(“\r”, “”);…

Android Google map clustering – how to show actual marker in cluster

27
May,2018

0

1 . Create Custom Cluster renderer package com.findbitcoinatm.android.utils; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.graphics.drawable.ShapeDrawable; import android.graphics.drawable.shapes.OvalShape; import android.util.SparseArray; import android.view.ViewGroup; import com.findbitcoinatm.android.models.cluster.ATMClusterItems; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.model.BitmapDescriptor; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.MarkerOptions; import com.google.maps.android.clustering.Cluster; import com.google.maps.android.clustering.ClusterManager; import com.google.maps.android.clustering.view.DefaultClusterRenderer;…

Error:Execution failed for task ‘:app:preDebugAndroidTestBuild’. > Conflict with dependency ‘com.android.support:support-annotations’ in project ‘:app’. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.

19
May,2018

0

Solution : compile ‘com.android.support:support-annotations:27.1.1’ to gradle(app) and sync . Solved 🙂 Example : apply plugin: ‘com.android.application’ android { compileSdkVersion 26 defaultConfig { applicationId “com.arifhasnat.islamicbooks” minSdkVersion 16 targetSdkVersion 26 versionCode 1 versionName “1.0” testInstrumentationRunner “android.support.test.runner.AndroidJUnitRunner” } buildTypes { release { minifyEnabled…

IOS ScrollView Tutorial – Easy way

17
May,2018

0

 Download Full Project 

Android how to add collapsing toolbar with layout body touch collapse and expand

15
May,2018

0

1 . <?xml version=”1.0″ encoding=”utf-8″?> <android.support.design.widget.CoordinatorLayout 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=”com.adn.activities.root.HomeActivity”> <android.support.design.widget.AppBarLayout android:id=”@+id/appbar_layout” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:theme=”@style/AppTheme.AppBarOverlay” > <android.support.design.widget.CollapsingToolbarLayout android:id=”@+id/collapsing_toolbar” android:layout_width=”match_parent” android:layout_height=”match_parent” app:layout_scrollFlags=”scroll|exitUntilCollapsed” app:contentScrim=”?attr/colorPrimary” app:expandedTitleMarginStart=”48dp” app:expandedTitleMarginEnd=”64dp” android:fitsSystemWindows=”true” > <LinearLayout android:orientation=”vertical” android:layout_width=”match_parent” android:layout_height=”wrap_content”> <android.support.v7.widget.Toolbar android:id=”@+id/toolbar” android:layout_width=”match_parent” android:layout_height=”?actionBarSize” android:background=”?attr/colorPrimary” app:popupTheme=”@style/AppTheme.PopupOverlay” > <!–<ImageView–>…

Android show collapsing toolbar layout title only when collapsed

10
May,2018

0

final CollapsingToolbarLayout collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsingToolbarLayout); AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.appBarLayout); appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { boolean isShow = true; int scrollRange = -1; @Override public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { if (scrollRange == -1) { scrollRange = appBarLayout.getTotalScrollRange(); } if…

itunesconnect supported screenshoot sizes

8
May,2018

0

The following resolutions are acceptable to iTunes connect: iPhone 3+4 (3.5 Inch) 640 x 960 iPhone 5 (4 Inch) 640 x 1136 iPhone 6 (4.7 Inch) 750 x 1334 iPhone 6 Plus (5.5 Inch) 1242 x 2208 You need the…

Android navigation/ toolbar back

7
May,2018

0

Step one : put these in oncreate method getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true);     @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_details); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); } Step two : Give action to go specific page or actions…

Convert String to NSURL is return nil in swift 3/4 – Solution

4
May,2018

0

let url : NSString = “url string here” let urlStr : NSString = url.addingPercentEscapes(using: String.Encoding.utf8.rawValue)! as NSString let actualURL : NSURL = NSURL(string: urlStr as String)! print(actualURL)

SSLcommerz payment gateway integration (Sandbox)

25
Apr,2018

0

Step 1 : Go to this link https://developer.sslcommerz.com/registration/ and register . Step 2 : Login account with https://sandbox.sslcommerz.com/manage/ Step 3 : Go to console and click developer tab . you can now download android sdk file . You will find .aar file…

Retrofit take List data as POST request body in android rest api call

18
Apr,2018

0

Step 1 :  create a request model that will take request body data package com.adn.api.order; import com.adn.Model.DBModel.AddToCartProductModel; import com.google.gson.annotations.SerializedName; import java.util.ArrayList; public class Order { @SerializedName(“customer_id”) String customer_id; @SerializedName(“firstname”) String firstname; @SerializedName(“lastname”) String lastname; @SerializedName(“email”) String email; @SerializedName(“products”) ArrayList<AddToCartProductModel> products;…

How to remote git repository from xCode project completely and create new repository

15
Apr,2018

0

Git keeps all of its files in the .git directory. Just remove that one and init again. If you can’t find it, it’s because it is hidden. In Windows 7, you need to go to your folder, click on Organize on the top left,…

Rest api development with lumen – part 1 : Environment setup

13
Apr,2018

0

Step 1 : Open command line tool or terminal for mac/ linux  and run this command for lumen installer . If you have not composer installed then download and install it from here ; https://getcomposer.org/ composer global require “laravel/lumen-installer” Step 2 :   Create a lumen project with following command …

Lumen Commands

22
Mar,2018

0

Database Migration : php artisan migrate

Error:Execution failed for task ‘:app:transformClassesWithDexForDebug’. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

20
Mar,2018

0

Sometimes application may be big in execution or heavy that time multidex should be enabled . Here is the full process to enable multidex in android   Enable Multidesk

Android relative layout position

5
Mar,2018

0

Bottom :  android:layout_alignParentBottom=”true” Center :    android:layout_centerInParent=”true”

Android create border radius for Button , Views , EditText and others

4
Mar,2018

0

Step – 1: Create xml layout in drawable folder <?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android” > <item android:state_pressed=”true” > <shape android:shape=”rectangle” > <corners android:radius=”3dip” /> <stroke android:width=”1dip” android:color=”#5e7974″ /> <gradient android:angle=”-90″ android:startColor=”#345953″ android:endColor=”#689a92″ /> </shape> </item> <item android:state_focused=”true”> <shape android:shape=”rectangle” >…

Android Fragment basic code structure

4
Mar,2018

0

public class BasicFragment extends Fragment { @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.basic_fragment_layout, container, false); return view; } }

Android custom date picker

1
Mar,2018

0

Step -1 : Create a custom fragment import android.annotation.SuppressLint; import android.app.DatePickerDialog; import android.app.Dialog; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.view.View; import android.widget.DatePicker; import android.widget.EditText; import java.text.SimpleDateFormat; import java.util.Calendar; @SuppressLint(“ValidFragment”) public class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener { public static final String…

IOS Swift 3/4 show alert for specific time duration

1
Mar,2018

0

   let alert = UIAlertController(title: “”, message: “alert disappears after 30 seconds”, preferredStyle: .alert)             self.present(alert, animated: true, completion: nil)             // change to desired number of seconds (in this case3…

Android Beautiful Spinner view without Custom adapter

27
Feb,2018

0

To make this just bind spinner with cardview . and make it like the code bellow . now it will looks beautiful .   <android.support.v7.widget.CardView android:layout_width=”match_parent” android:layout_height=”@dimen/count_40dp” android:layout_marginLeft=”@dimen/count_5dp” android:layout_marginRight=”@dimen/count_5dp” android:layout_marginTop=”@dimen/count_10dp”> <Spinner android:id=”@+id/gender” android:layout_width=”match_parent” android:layout_height=”match_parent” /> </android.support.v7.widget.CardView>

Android Custom spinner .

27
Feb,2018

0

Step -1 : Create new Adapter . public class CustomSpinnerAdapter extends BaseAdapter implements SpinnerAdapter { private final Context context; private ArrayList<String> asr; public CustomSpinnerAdapter(Context context1, ArrayList<String> asr) { this.context = context1; this.asr=asr; } public int getCount() { return asr.size(); }…

Android remove underline of EditText

26
Feb,2018

0

android:background=”@android:color/transparent”

Firebase: A config file was found, but it indicates a project ID “priokotha-92c0e” that you dont appear to have access to. Request access or delete the file in order to proceed with the connection process.

19
Feb,2018

0

This error will occur if you are signed in to Android Studio and the Firebase Console with different accounts. In Android Studio, click on the small profile icon in the upper right corner to see your sign-in account. Do the…

ERROR:’keytool’ is not recognized as an internal or external command, operable program or batch file

18
Feb,2018

0

Step 1 : Download JDK : http://www.oracle.com/technetwork/java/javase/downloads/index.html and install it . Step 2 : Set the path on environment path . To do this My Computer – > Properties -> System variable -> Edit Path , click new and past…

Android firebase Phone verification authentication – OTP

18
Feb,2018

0

Step 1 : Go to firebase console . Go SIGN-IN METHOD and enable phone authentication option .   Step 2 : Open your build.gradle (app) and paste this firebase ui gradle and sync . Check firebase version code . It…

Error:Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’. > java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

18
Feb,2018

0

It may causes for several reasons – I have found 2 reason and solution .  Problem 1 : If you use firebase service and it’s gradle version are older version . Or google play service , gms service are not…

IOS short code – exit

18
Feb,2018

0

exit(0);

unable to boot device due to insufficient system resources. xcode

17
Feb,2018

0

Problem : unable to boot device due to insufficient system resources. xcode Please see Simulator Help for information on adjusting system settings to allow more simulated devices to boot at once. maxUserProcs: 709, runningUserProcs: 614, enforcedProcBuffer: 144 Solution : Open…

Firebase for android – Insert value as a list data

17
Feb,2018

0

Part : one – Go to firebase console and click database . If you want to insert database without authentication then go to database->rules tab and { “rules”: { “.read”: “auth == null”, “.write”: “auth == null” } } Part…

Binary Search Algorithm – Deep thinking with Java

14
Feb,2018

0

import java.util.Scanner;   class BinarySearch { public static void main(String args[]) { int c, first, last, middle, n, search, array[];   Scanner in = new Scanner(System.in); System.out.println(“Enter number of elements”); n = in.nextInt(); array = new int[n];   System.out.println(“Enter “…

Android beautiful dialog and alert libraries

14
Feb,2018

0

1 . Lovely dialog is a nice dialog third party android library . There has some good functionality that makes it awesome .   2 . Sweet alert   is also a nice dialog and alert library . It’s also have animation that…

IOS – Main Thread Checker: UI API called on a background thread: -[UIApplication delegate] PID: 902, TID: 13120, Thread name: (none), Queue name: NSOperationQueue 0x604000037a20 (QOS: UNSPECIFIED), QoS: 0 Backtrace:

14
Feb,2018

0

Solution : use DispatchQueue.main.async { // Correct }     Updating UI from a Completion Handler Long-running tasks such as networking are often executed in the background, and provide a completion handler to signal completion. Attempting to read or update…

Firebase for android : Read list of data from database and show on recyclerview

13
Feb,2018

0

Part -1 : Take that we have some data field on child node named “user” . We will first retrieve all data and then we will show it on recyclerview. , public class UserListActivity extends AppCompatActivity { private DatabaseReference mDatabase;…

Firebase for android : Part One – Project setup

13
Feb,2018

0

First of all you can get total setup manual from here . https://firebase.google.com/docs/android/setup I am describing here step by step : Part 1 : First create an android project . If already have then no need . We need project…

How to solve android debug .apk is corrupted , can not be installed .

12
Feb,2018

0

1 . Clean project . Go  Build -> Clean 2 . Go to Build-> Build Apk(s). After creating apk you will see a dialog as below.     That’s it . From stackoverflow      

PhoneGap or Cordova iOS build and import to Xcode

9
Feb,2018

0

Open Terminal and go to project folder like cd: Desktop/newProject run the command on terminal cordova platform add ios  and run the command cordova build  It will create  a platform folder in the project directory and inside project directory you…

!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `master-1`. You can try adding it manually in `~/.cocoapods/repos` or via `pod repo add`.

8
Feb,2018

0

Open Terminal and run this command that will add the source on master branch on cocoapod repos .   $ cd ~/.cocoapods/repos $ git clone https://github.com/CocoaPods/Specs.git master     if again issuing already has master branch and it’s not empty and completely…

How to uninstall cocoapod completely and install new

8
Feb,2018

0

1. Uninstall CocoaPods (choose to uninstall all versions): 1 sudo gem uninstall cocoapods 2. Remove old master repo: 1 sudo rm -fr ~/.cocoapods/repos/master 3. Install CocoaPods with sudo: 1 sudo gem install cocoapods 4. Setup CocoaPods and Master repo: 1…

Android Encryption and Decryption String with AES/DES .

17
Jan,2018

0

Base Class :  import android.util.Base64; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.security.GeneralSecurityException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; /** * Created by ADN Digital on 1/17/2018. */ public class…

Android Studio get SHA 1 key in release mode .

29
Dec,2017

0

keytool -list -v -keystore F:\Android\Priokothanew\Priokotha\priokotha.jks -alias arifhasnat

Android Studio – Get SHA1 Key

26
Dec,2017

0

Android notify users when app version is updated on play store .

29
Nov,2017

0

1 . First get current play store version. int currentVersion,updateVersion; VersionChecker versionChecker = new VersionChecker(); try { String latestVersion = versionChecker.execute().get(); updateVersion = Integer.parseInt(latestVersion.substring(latestVersion.length()-1)); Toast.makeText(HomeActivity.this, latestVersion.toString(), Toast.LENGTH_SHORT).show(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); }…

Swift 3 / 4 get current location with location manager .

3
Nov,2017

0

Step – 1 :  First define LocationManager . And Current location of CLLocaion .   var manager = CLLocationManager() var currentLocation: CLLocation! Step 2 : In ViewDidController get Current location with location manager . That’s it .   manager.requestWhenInUseAuthorization()   …

Swift 3 /4 take photo from camera or gallery and show it .

1
Nov,2017

0

Step One : First create a project and take imageView and a button to capture image . Connect it to ViewController . Step Two : Copy this code and run . hope it will be done . 😀    class ImageCapture: UIViewController…