RadioGroups com setOnClickListener não são disparados. Vem sempre NULL. Por quê ?
03/06/2019
0
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate( savedInstanceState );
setContentView( R.layout.activity_add_relatorio );
Toolbar toolbar = findViewById( R.id.toolbar );
setSupportActionBar( toolbar );
inicializarFirebase();
inicializarComponentes();
Intent intent = getIntent();
celulas_ = intent.getStringExtra( "Celula" );
novaRef5 = FirebaseDatabase.getInstance().getReference();
pegandoConteudoCelula();
private void inicializarComponentes() {
.... codigo omitido ......
radioGroupEstudo = findViewById( R.id.rgEstudo );
rbEstudoSim = findViewById(R.id.rbEstudoSim);
rbEstudoNao = findViewById(R.id.rbEstudoNao);
radioGroupQuebraGelo = findViewById(R.id.rgQuebragelo);
rbQuebrageloSim = findViewById( R.id.rbQuebrageloSim );
rbQuebrageloNao = findViewById( R.id.rbQuebrageloNao );
radioGroupLanche = findViewById(R.id.rgLanche);
rbLancheSim = findViewById( R.id.rbLancheSim);
rbLancheNao = findViewById( R.id.rbLancheNao );
radioGroupAceitacao = findViewById(R.id.rgAceitacao);
rbAceitacaoSim = findViewById( R.id.rbAceitacaoSim );
rbAceitacaoNao = findViewById( R.id.rbAceitacaoNao );
radioGroupReconcilhacao = findViewById(R.id.rgReconciliacao);
rbReconciliacaoSim = findViewById( R.id.rbReconciliacaoSim );
rbReconciliacaoNao = findViewById( R.id.rbReconciliacaoNao );
radioGroupTestemunho = findViewById(R.id.rgTestemunho);
rbTestemunhoSim = findViewById( R.id.rbTestemunhoSim );
rbTestemunhoNao = findViewById( R.id.rbTestemunhoNao );
/* Listeners dos radiobuttons */
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate( savedInstanceState );
setContentView( R.layout.activity_add_relatorio );
Toolbar toolbar = findViewById( R.id.toolbar );
setSupportActionBar( toolbar );
inicializarFirebase();
inicializarComponentes();
Intent intent = getIntent();
celulas_ = intent.getStringExtra( "Celula" );
novaRef5 = FirebaseDatabase.getInstance().getReference();
pegandoConteudoCelula();
private void inicializarComponentes() {
.. codigo onitido ...
radioGroupEstudo = findViewById( R.id.rgEstudo );
... codigo onitido de outros ids ...
Listeners dos radiobuttons
radioGroupEstudo.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
if (radioGroupEstudo.getCheckedRadioButtonId() == rbEstudoSim.getId()) {
estudo = rbEstudoSim.getText().toString();
} else if (radioGroupEstudo.getCheckedRadioButtonId() == rbEstudoNao.getId()) {
estudo = rbEstudoNao.getText().toString();
}
}
});
... codigo dos outros radioGroups omitidos .....
XML
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="68dp"
android:paddingBottom="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<android.support.design.widget.TextInputLayout
android:id="@+id/text_input_celula"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/celula1"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
... codigo omitido questão de espaço ......
Debbuger no momento que pode ser visto o resultado dos listeners.
testemunho = null
quebragelo = null
aceitacao = null
lanche = null
reconciliacao = null
estudo = null
status = "1"
DataTime = "02/06/2019 14:48:45"
uid = "-LgOJ9UeL6QdYtRwrWVT"
total = "6"
criancas = "2"
convidados = "2"
membrosIEQ = "1"
baseCelula = "1"
hora = "20:00"
dia = "Quinta-feira"
colaborador = "Ana"
secretario = "Jorge"
anfitriao = "André"
viceLider = "Vitor"
lider = "Carlos"
supervisor = "Sandro"
rede = "Aleluia"
celula = "Deus é Fiel"
protected void onCreate(Bundle savedInstanceState) {
super.onCreate( savedInstanceState );
setContentView( R.layout.activity_add_relatorio );
Toolbar toolbar = findViewById( R.id.toolbar );
setSupportActionBar( toolbar );
inicializarFirebase();
inicializarComponentes();
Intent intent = getIntent();
celulas_ = intent.getStringExtra( "Celula" );
novaRef5 = FirebaseDatabase.getInstance().getReference();
pegandoConteudoCelula();
private void inicializarComponentes() {
.... codigo omitido ......
radioGroupEstudo = findViewById( R.id.rgEstudo );
rbEstudoSim = findViewById(R.id.rbEstudoSim);
rbEstudoNao = findViewById(R.id.rbEstudoNao);
radioGroupQuebraGelo = findViewById(R.id.rgQuebragelo);
rbQuebrageloSim = findViewById( R.id.rbQuebrageloSim );
rbQuebrageloNao = findViewById( R.id.rbQuebrageloNao );
radioGroupLanche = findViewById(R.id.rgLanche);
rbLancheSim = findViewById( R.id.rbLancheSim);
rbLancheNao = findViewById( R.id.rbLancheNao );
radioGroupAceitacao = findViewById(R.id.rgAceitacao);
rbAceitacaoSim = findViewById( R.id.rbAceitacaoSim );
rbAceitacaoNao = findViewById( R.id.rbAceitacaoNao );
radioGroupReconcilhacao = findViewById(R.id.rgReconciliacao);
rbReconciliacaoSim = findViewById( R.id.rbReconciliacaoSim );
rbReconciliacaoNao = findViewById( R.id.rbReconciliacaoNao );
radioGroupTestemunho = findViewById(R.id.rgTestemunho);
rbTestemunhoSim = findViewById( R.id.rbTestemunhoSim );
rbTestemunhoNao = findViewById( R.id.rbTestemunhoNao );
/* Listeners dos radiobuttons */
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate( savedInstanceState );
setContentView( R.layout.activity_add_relatorio );
Toolbar toolbar = findViewById( R.id.toolbar );
setSupportActionBar( toolbar );
inicializarFirebase();
inicializarComponentes();
Intent intent = getIntent();
celulas_ = intent.getStringExtra( "Celula" );
novaRef5 = FirebaseDatabase.getInstance().getReference();
pegandoConteudoCelula();
private void inicializarComponentes() {
.. codigo onitido ...
radioGroupEstudo = findViewById( R.id.rgEstudo );
... codigo onitido de outros ids ...
Listeners dos radiobuttons
radioGroupEstudo.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
if (radioGroupEstudo.getCheckedRadioButtonId() == rbEstudoSim.getId()) {
estudo = rbEstudoSim.getText().toString();
} else if (radioGroupEstudo.getCheckedRadioButtonId() == rbEstudoNao.getId()) {
estudo = rbEstudoNao.getText().toString();
}
}
});
... codigo dos outros radioGroups omitidos .....
XML
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="68dp"
android:paddingBottom="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<android.support.design.widget.TextInputLayout
android:id="@+id/text_input_celula"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/celula1"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
... codigo omitido questão de espaço ......
Debbuger no momento que pode ser visto o resultado dos listeners.
testemunho = null
quebragelo = null
aceitacao = null
lanche = null
reconciliacao = null
estudo = null
status = "1"
DataTime = "02/06/2019 14:48:45"
uid = "-LgOJ9UeL6QdYtRwrWVT"
total = "6"
criancas = "2"
convidados = "2"
membrosIEQ = "1"
baseCelula = "1"
hora = "20:00"
dia = "Quinta-feira"
colaborador = "Ana"
secretario = "Jorge"
anfitriao = "André"
viceLider = "Vitor"
lider = "Carlos"
supervisor = "Sandro"
rede = "Aleluia"
celula = "Deus é Fiel"
Fabiano
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)