Browsed by
Month: March 2018

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

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

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 create border radius for Button , Views , EditText and others

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

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” > <corners android:radius=”3dip” /> <stroke android:width=”1dip” android:color=”#5e7974″ /> <solid android:color=”#58857e”/> </shape> </item> <item > <shape android:shape=”rectangle” > <corners android:radius=”3dip” /> <stroke android:width=”1dip” android:color=”#5e7974″ /> <gradient android:angle=”-90″ android:startColor=”#8dbab3″ android:endColor=”#58857e” /> </shape> </item> </selector> Step 2 : Implement on anywhere like button and…

Read More Read More

Android Fragment basic code structure

Android Fragment basic code structure

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; } }

IOS best network image download library – SDWebImage , Swift 3/4

IOS best network image download library – SDWebImage , Swift 3/4

Sometimes network image doest not download and for that app may crash . To avoid this you can use SDWebImage library as like Picasso android library which will show a default placeholder image until file downloaded . To implement SDWebImage – Step 1 : paste the pod file in podfile of your project (If you don’t create pod file . create it with ‘pod init’ command in your project directory) pod ‘SDWebImage’, ‘~> 4.0’ Run command pod install Step 2…

Read More Read More

Android back pressed to exit the app dialog and exit app

Android back pressed to exit the app dialog and exit app

@Override public void onBackPressed() { super.onBackPressed(); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder.setMessage(“Are you sure you want to exit the app?”); alertDialogBuilder.setPositiveButton(“yes”, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(intent); finishAffinity(); finish(); System.exit(0); } }); alertDialogBuilder.setNegativeButton(“No”, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { finish(); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); }

Android custom date picker

Android custom date picker

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 DATE_FORMAT = “dd-MM-yyyy”; EditText mView; private DatePickerDialog datepic; public DatePickerFragment(View v) { mView = (EditText) v; } Calendar c; public DatePickerFragment() { } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the current date as the default date in the…

Read More Read More

IOS Swift 3/4 show alert for specific time duration

IOS Swift 3/4 show alert for specific time duration

   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 0 seconds)             let when = DispatchTime.now() + 30             DispatchQueue.main.asyncAfter(deadline: when){                 // your code with delay          …

Read More Read More