I´ve got an activity which has to create new TextViews and EditTexts when a button is pressed. The problem is that when I change the focus from one EditText to the new one it is impossible to return to the first one. I mean: I have only one EditText and I create another one, I focus on the new EditText but now I can´t focus on the older one.
I attach you the .xml and the .java Thank you very much for your help -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
package vistas;
import java.util.Vector;
import com.example.ifirma.R;
import android.app.Activity;
import android.os.Bundle;
import android.text.InputType;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class VistaActaCorreo extends Activity{
RelativeLayout padreTexto, padreEdito;
Vector <TextView> textos = new Vector<TextView>();
Vector <EditText> editos = new Vector<EditText>();
int contador = 2;
int margenIzquierdoTexto = 10, margenIzquierdoEdito = 8;
int margenArribaTexto = 108, margenArribaEdito = 50;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
setContentView(R.layout.activity_vistacorreo);
padreTexto = (RelativeLayout) findViewById(R.id.relativeLayout1);
padreEdito = (RelativeLayout) findViewById(R.id.relativeLayout2);
}
public void anadir(View view){
TextView nuevoTexto = new TextView(this);
EditText nuevoEdito = new EditText(this);
nuevoTexto.setText("Direcci?n correo n?"+contador);
nuevoTexto.setTextSize(15);
nuevoTexto.setPadding(margenIzquierdoTexto, margenArribaTexto, 0, 0);
nuevoEdito.setEms(10);
nuevoEdito.setInputType(InputType.TYPE_CLASS_TEXT);
nuevoEdito.setImeOptions(EditorInfo.IME_ACTION_DONE);
nuevoEdito.setFocusable(true);
nuevoEdito.setFocusableInTouchMode(true);
nuevoEdito.setClickable(true);
nuevoEdito.setPadding(margenIzquierdoEdito, margenArribaEdito, 0, 0);
padreTexto.addView(nuevoTexto);
padreEdito.addView(nuevoEdito);
textos.add(nuevoTexto);
editos.add(nuevoEdito);
contador++;
margenArribaTexto += 40;
margenArribaEdito += 40;
}
}
activity_vistacorreo.xml
Description: XML document

