Hi
I use the class "BotonPersonalizado" for create buttons in
activity dynamically, see the code of constructor
My mistake is when you press one of these buttons, everything else is fine
and works perfectly
@SuppressLint("NewApi")
public BotonPersonalizado(RelativeLayout layoutactual, int id, int
posicionX,
int posicionY, String texto, final Context context) {
Button boton = new Button(contexto);
boton.setId(id);
boton.setText(texto);
boton.setTextSize(10);
boton.setMinimumHeight(5);
boton.setHeight(5);
boton.setWidth(100);
boton.setX(posicionX);
boton.setY(posicionY);
boton.setTextColor(Color.BLACK);
layoutactual.addView(boton);
//Here is the mistake, i use this class in one activity and i want use the
context to go the class "Tercero.class" , this onclick listener no works
boton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
int pasarid = v.getId();
Intent i = new Intent(contexto,Tercero.class);
i.putExtra("id", pasarid);
contexto.startActivity(i);
}
});
}
Logcat error -->
<https://lh4.googleusercontent.com/-61PyhO69BkU/UWvlLV67RoI/AAAAAAAAARQ/1e--yxwrp-0/s1600/Captura.PNG>
I await your answers, thank you very much! ^ ^
--
--
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
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.