Skip to main content

Featured

Android studio “SDK tools directory is missing”

Following 2 possible solutions will resolve this problem :  Solution1 : To fix the problem, it was required that I list the path to my corporate PAC file by using  Configure -> "Appearance and Behavior" -> System Settings -> HTTP Proxy . I selected "Automatic proxy configuration url:" Delete your  ~/.Android*  folders (losing all of your settings :/). Run Android Studio. It will show you a welcome wizard where it tries to download the SDK again (and fails due to my rubbish internet). Click the X on the wizard window. That will enable you to get to the normal welcome dialog. Go to Settings->Project Defaults->Project Structure and change the Android SDK location to the correct one. Solution 2 : To fix the problem, it was required that I list the path to my corporate PAC file by using  Configure -> "Appearance and Behavior" -> System Settings -> HTTP Proxy . I selected "Automatic proxy configuration url:&quo

Code for Text Shake Animation , left-to-right Animation , right-to-left Animation in Android

package com.example.marqueetext;

import android.app.Activity;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.TranslateAnimation;
import android.widget.TextView;


public class MainActivity extends Activity {

Animation shake;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       
        TextView tv1 = (TextView) this.findViewById(R.id.TextView01);
        Animation animationToLeft = new TranslateAnimation(800, -600, 0, 0);
        animationToLeft.setDuration(11000);
        animationToLeft.setRepeatMode(Animation.RESTART);
        animationToLeft.setRepeatCount(Animation.INFINITE);
             
        TextView tv2 = (TextView) this.findViewById(R.id.TextView02);
        tv2.setFocusable(true);  // Set focus to the textview

      //Load Shake Animation xml file here
        shake = AnimationUtils.loadAnimation(this, R.anim.shakeanim);
      //Animation works here...
        tv2.startAnimation(shake);
       
        TextView tv3 = (TextView) this.findViewById(R.id.TextView03);
        Animation animationToRight = new TranslateAnimation(-800,600, 0, 0);
        animationToRight.setDuration(12000);
        animationToRight.setRepeatMode(Animation.RESTART);
        animationToRight.setRepeatCount(Animation.INFINITE);

        tv1.setAnimation(animationToLeft);
        tv3.setAnimation(animationToRight);
    }    
}


res/anim/shakeanim.xml :
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="20000"
    android:fromXDelta="0"
    android:interpolator="@anim/cycles"
    android:toXDelta="20" />


res/anim/cycles.xml :
<?xml version="1.0" encoding="utf-8"?>
<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
    android:cycles="60" />


res/layout/activity_main.xml :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:orientation="vertical">
    <TextView
        android:id="@+id/TextView01"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"        
        android:text="Please Contact : " />    
    <TextView
        android:id="@+id/TextView02"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"        
        android:text="Pavan Tilak"
        android:gravity="center_horizontal" />    
    <TextView
        android:id="@+id/TextView03"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"        
        android:text="Website : pavantilak.blogspot.com" />
</LinearLayout>









Comments