Skip to main content

Posts

Showing posts from June, 2020

Solution of More than one file was found with OS independent path AndroidManifest.xml

After adding some jar or third party libraries sometime we face this type of problem during gradle build or at runtime .it might be because of in the mergeDebugJavaResource gradle task and on error message about multiple Android Manifests . We can assume that the problem is that there are several manifests(for example one for debug and one for production) and there are no proper manifest merging rules. sometimes it will resolve by Invalid Caches and Restart the Android Studio or by cleaning and rebuild project. But if this technique does not work than there are some solutions for this: Solution 1: downgrading your gradle plugin version from high version to low version like converting   classpath 'com.android.tools.build:gradle:3.5.1 ' to  classpath 'com.android.tools.build:gradle:3.4.0' if this solution not work here is another solution. Solution 2: in your app level gradle add these line of code  android { .... packagingOptions { exclude 'AndroidManifest.xml'

How to add Vibrate or Shake effect to any View

Sometimes we have to apply Shake or Vibrate effect to a view like text view or any other view for indicating user that something went wrong or wrong input.To achieve this we have some steps to follow:- For Vibrate   Step 1: Create the object for the Vibrator class private Vibrator vibrateObject; Step 2 : Block of code for vibrate the device for 300 millisecond vibrateObject = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); // Vibrate for 300 milliseconds vibrateObject.vibrate(300); Step 3: Add permission in Manifest.xml <uses-permission android : name = "android.permission.VIBRATE" /> Shake The View Or Text Step 1: Create shake_effect.xml in anim folder  <?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_inter2"

How to Hide or Show Toolbar While Scrolling

Sometimes we have requirement for hiding the toolbar when some list is scroll .In this post we will learn how to hide when scroll down the list and show when scroll upside in Android Application.For this we have to follow some steps :- Step 1: Create a ToolBar separately for use it in an entire application with name toolbar.xml <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:titleTextColor="#FFFFFF" app:layout_scrollFlags="scroll|enterAlways" /> set this flag to toolBar app:layout_scrollFlags="scroll|enterAlways" app:layout_scrollFlags a