我正在使用 Helper.sync_settting_2(img_sync, context) 设置相对布局的 imageView 的背景。
try {
final RelativeLayout layout_img_sync = (RelativeLayout) findViewById(R.id.relative_lay_6);
final ImageView img_sync = (ImageView) findViewById(R.id.img_sync);
layout_img_sync.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Helper.sync_settting_2(img_sync, context);
}
});
} catch (Exception e) {
};
这里是函数 Helper.sync_settting_2(ImageView sync, Context ct)。
public static void sync_settting_2(ImageView sync, Context ct) {
Toast.makeText(ct, "Sync Started", Toast.LENGTH_LONG).show();
getJobData getJobs = new getJobData(null);
sync.setBackground(ct.getResources().getDrawable(
com.org.courier.R.drawable.sync_image_orange));
getJobs.setOnApiLIstner(new onApiCompleted() {
@Override
public void onApiResults(ArrayList<job_entity> events_list) {
getMessageData getMessage = new getMessageData(null);
getMessage.setOnApiLIstner(new getMessageData.onApiCompleted() {
@Override
public void onApiResults(
ArrayList<message_entity> events_list) {
getContactData getContact = new getContactData(null);
getContact
.setOnApiLIstner(new getContactData.onApiCompleted() {
@Override
public void onApiResults(
ArrayList<contact_entity> events_list) {
}
});
getContact.execute();
}
});
getMessage.execute();
}
});
getJobs.execute();
sync.setBackground(ct.getResources().getDrawable(
com.org.courier.R.drawable.sync_image_03));
Toast.makeText(ct, "Sync Finished", Toast.LENGTH_SHORT)
.show();
}
它显示错误
“java.lang.NoSuchMethodError:android.widget,ImageView.setBackground”