简体   繁体   English

我在Android中使用customAdapter时,我的Click Listner无法正常工作

[英]My Click Listner is not working in while m using a customAdapter in android

In this code if else condition not working 在此代码中,否则条件不起作用

holder.transaction_history1 = (TextView)    
row.findViewById(R.id.textView_matrimonyaccount_single_row_transaction_history1);        


 holder.transaction_history = (TextView) 
 row.findViewById(R.id.textView_matrimonyaccount_single_row_transaction_history);    


 holder.transaction_history1.setOnClickListener(new OnClickListener() {    

                    @Override    
                    public void onClick(View v) {    
                    if(info.transaction_history.equalsIgnoreCase("Confirm"))    

                        {    
                            holder.transaction_history1.setVisibility(View.VISIBLE);    
                            Intent intent2 = new Intent (context,MainActiviy.class);    
                            context.startActivity(intent2);    
                        }
                        else    
                        {     
                            Toast.makeText(context,"",Toast.LENGTH_LONG);    
                        }    

                    }    
                    }); 

Try this instead of writing this 试试这个而不是写这个

info.transaction_history.equalsIgnoreCase("Confirm")

Your If condition may not be returning true so write 您的If条件可能未返回true,请写

info.transaction_history.getText().toString().equalsIgnoreCase("Confirm")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM