Android App Development
iOS 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
Owner and 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
We've bought a Shopware Extension which is a hybrid App, which we can now offer in the Google Play Store and the IOS App Store. I'am still impressed how fast and how sharp the support team leads us through every process of the App-Store clarification. Very fast and useful response.
Markus Walter
Founder, Das Apartment Living
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.