I have these 2 buttons inside an Activity. The backBtn
works fine, but nothing happens when I click on the reg_country
button. Any idea of what's going on?
[EDIT] Edited with some log, onClick
just does't executes when I touch the button.
08-10 09:33:08.608: D/dalvikvm(806): GC_EXTERNAL_ALLOC freed 365 objects / 24360 bytes in 58ms
08-10 09:33:11.608: E/RegisterActivity(806): Activity started
08-10 09:33:14.317: E/RegisterActivity(806): onClick (backBtn)
08-10 09:33:16.268: E/RegisterActivity(806): Activity started
Part of the Activity code
Log.e("RegisterActivity", "Activity started");
backBtn = (Button) findViewById(R.id.backBtn);
backBtn.setText("Cancelar");
backBtn.setVisibility(View.VISIBLE);
backBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.e("RegisterActivity", "onClick (backBtn)");
finish();
}
});
reg_country = (Button) findViewById(R.id.reg_country);
reg_country.setText("reg_country");
reg_country.setClickable(true);
reg_country.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.e("RegisterActivity", "onClick (reg_country)");
finish();
}
});
Maybe because reg_country
stays inside a TableLayout
? backBtn comes from the included actionbar_layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical" >
<include
android:id="@+id/include1"
layout="@layout/actionbar_layout" />
<!-- Registration Form -->
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_marginTop="20dip"
android:background="@drawable/balao_formulario_cadastrar"
android:clickable="true"
android:gravity="center"
android:isScrollContainer="true"
android:orientation="vertical"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:paddingTop="50dip"
android:stretchColumns="1" >
<EditText
android:id="@+id/reg_fullname"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:layout_marginBottom="20dip"
android:layout_marginTop="5dip"
android:background="@drawable/stroke"
android:hint="Nome Completo"
android:imeOptions="actionNext"
android:inputType="textPersonName"
android:singleLine="true" />
<EditText
android:id="@+id/reg_email"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:layout_marginBottom="20dip"
android:layout_marginTop="5dip"
android:background="@drawable/stroke"
android:hint="E-mail"
android:inputType="textEmailAddress"
android:singleLine="true" />
<EditText
android:id="@+id/reg_password"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:layout_marginBottom="20dip"
android:layout_marginTop="5dip"
android:background="@drawable/stroke"
android:hint="Senha"
android:password="true"
android:singleLine="true" />
<Button
android:id="@+id/reg_country"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:layout_marginBottom="25dip"
android:clickable="true"
android:gravity="left|center_vertical"
android:text="Selecione um País"
android:textSize="15dip" />
<!-- Terms of Use TextView -->
<TextView
android:id="@+id/reg_terms_link"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/termos"
android:textColor="#3D3D3D"
android:textSize="10dip" />
</TableLayout>
<Button
android:id="@+id/registerBtn"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_marginTop="20dip"
android:background="@drawable/button_cadastrar"
android:text="Cadastrar"
android:textColor="#3D3D3D"
android:textSize="15dip" />
<!-- Registration Form Ends -->
</LinearLayout>