我在活动中有ActivityCheckout.java一个适配器AdapterServiceCourier。适配器类用于显示单选按钮价格。如何textview使用 ActivityCheckout 中的视图进行更新。喜欢
public TextView getTextViewPriceOngkir()
{
TextView txtView = (TextView)findViewById(R.id.price_ongkir);
return txtView;
}
当我在适配器中使用时AdapterServiceCourier:
ActivityCheckout ac = new ActivityCheckout();
TextView tv = ac.getTextViewPriceOngkir();
tv.setText("8");
它的错误如:
E/UncaughtException: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class <unknown>
AdapterServiceCourier.java :
@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
SharedPreferences sharedPreferences = context.getSharedPreferences(AppConfig.APP_PUPUKKUJANG_MART, Context.MODE_PRIVATE);
final String whois = sharedPreferences.getString(AppConfig.USER_WHOIS,null);
row_index = -1;
holder.itemView.setTag(service.get(position));
final ServiceCourier p = service.get(position);
holder.service.setText(p.getService());
holder.desc.setText(p.getDescription());
holder.cost.setText(p.getCost());
holder.etd.setText(p.getEtd());
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
View.OnClickListener rbClick = new View.OnClickListener() {
@Override
public void onClick(View v) {
RadioButton checked_rb = (RadioButton) v;
if(lastCheckedRB != null){
lastCheckedRB.setChecked(false);
}
}
显示:图片点击单选按钮,价格必须设置为ongkir价格
茅侃侃
MMTTMM
江户川乱折腾
相关分类