Hiding, displaying and focusing editText's in Android
<p>I've two linked questions.</p>

<p>I'm applying a slide translation on an editText and it's button. I've created two buttons, one visible and one invisible, for obvious reasons. In order to hide the one that was visible and show the one that was invisiable I'm using this code:</p>

<pre><code>public void onAnimationEnd(Animation animation) {
    textBox.setVisibility(View.GONE);
    button.setVisibility(View.GONE);
    button2.setVisibility(View.VISIBLE);
    textBox2.setVisibility(View.VISIBLE);
    textBox2.requestFocus();
    button2.setEnabled(true);
    button.setEnabled(false);
}
</code></pre>

<p>Where <code>textBox</code> is the original editText and <code>button</code> is its accompanying button. <code>textBox2</code> is the one I want to show. </p>

<p>Yet the original editText and its button remain visible and the other set don't appear. Any ideas whats wrong with above?</p>

<p>Second, I can find screen size in my .java file, but how could I pass this into my .xml animation file? Or is there a better way of adjusting the amount of transition depending on the screen size?</p>

<p>Here's how I invoke the animation:</p>

<pre><code>Animation translateAnimation = AnimationUtils.loadAnimation(first.this, R.anim.translate);
textBox.startAnimation(translateAnimation);
</code></pre>

<p>Translate.xml:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;translate xmlns:android="http://schemas.android.com/apk/res/android" android:fillAfter="true" android:fromYDelta="0" android:toYDelta="-160" android:duration="50" /&gt;
</code></pre>
