Posts

Showing posts with the label Application Elements

How to Add Animation to Android App in JAVA

First, define your animation in XML. For example, let's create a fade-in animation named fade_in.xml in the res/anim directory: res/anim/fade_in.xml: FILE CODE < alpha xmlns: android ="http://schemas.android.com/apk/res/android" android :duration ="500" android :fromAlpha ="1.0" android :toAlpha ="0.0" android :repeatMode ="reverse" android :repeatCount ="infinite" /> Create Image VIew < ImageView android :id ="@+id/blinking_image" android :layout_width ="wrap_content" android :layout_height ="wrap_content" android :src ="@drawable/animation" android :animation ="@anim/blink" /> In your activity or fragment, load the animation using AnimationUtils.loadAnimation() and apply it to the desired view: // Animation Code Block Animation fadeInAnimation = AnimationUtils . loadAnimation ( this , R . anim . blink ); // Find the vie...

Using Socket.IO on android Always Returns XHR Poll Error

The problem I faced is strange and typical. Using Socket.IO on android Always Returns XHR Poll Error . Not much help available on the net regd. XHR Poll Error but StackOverflow has a quickfix. Finally the issue was resolved in two steps: 1.  CORS (Cross-Origin Resource Sharing). CORS Configuration: Ensure that your server-side configuration allows cross-origin requests if your client and server are on different domains. 2. In AndroidManifest.xml tweak  android:usesCleartextTraffic Indicates whether the app intends to use cleartext network traffic , such as cleartext HTTP. The default value for apps that target API level 27 or lower is "true". Apps that target API level 28 or higher default to "false". When the attribute is set to "false", platform components, for example, HTTP and FTP stacks, DownloadManager, and MediaPlayer, refuse the app's requests to use cleartext traffic. Since we are running on IT and yet to implement Positive SSL, we have to set...