Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
In this blog, I will show you how can we aware the users for the wrong input or something went wrong. There are simple two way to alert your users or customer for the wrong input.
Step 1: Create the object for the Vibrator class,
private Vibrator vibrateObject; 1 private Vibrator vibrateObject;
Step 2: Below is the block of code for which vibrate the device for the 200 millisecond,
vibrateObject = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); // Vibrate for 200 milliseconds vibrateObject.vibrate(200); 123 vibrateObject = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); // Vibrate for 200 milliseconds vibrateObject.vibrate(200);
Step 3: Add permission in Manifest.xml
<uses-permission android:name="android.permission.VIBRATE" /> 1 <uses-permission android:name="android.permission.VIBRATE" />
Step 1: Create your shake error file,
<?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="300" android:fromXDelta="0" android:interpolator="@anim/cycle_2" android:toXDelta="20" /> 123456 <?xml version="1.0" encoding="utf-8"?><translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="300" android:fromXDelta="0" android:interpolator="@anim/cycle_2" android:toXDelta="20" />
Step 2: Create the Interpolator,
<?xml version="1.0" encoding="utf-8"?> <cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android" android:cycles="2" /> 123 <?xml version="1.0" encoding="utf-8"?> <cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android" android:cycles="2" />
Step 3: Apply on Views or text which you want to Shake or wobble,
findViewById(R.id.textView).startAnimation(AnimationUtils.loadAnimation(MainActivity.this, R.anim.shake_error)); findViewById(R.id.simpleView).startAnimation(AnimationUtils.loadAnimation(MainActivity.this, R.anim.shake_error)); 12 findViewById(R.id.textView).startAnimation(AnimationUtils.loadAnimation(MainActivity.this, R.anim.shake_error));findViewById(R.id.simpleView).startAnimation(AnimationUtils.loadAnimation(MainActivity.this, R.anim.shake_error));
If you have any doubt on this blog, please ask in comments. And stay updated and stay super.
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
It was a successful collaboration. The Mobikul team provided the client everything they needed in a timely and high-quality manner. They were very professional, reliable, and accessible during the entire process. The client also saw no room for any improvements in the vendor's performance.
Vincenzo Carrano
Administrator, Segshop
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.