- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
致命异常:检测到 java.lang.IndexOutOfBoundsException 不一致。无效的项目位置 5(offset:5).state:24
这种崩溃发生的太多了!!!
我在 Fabric Crashlytics 中得到它。
Fatal Exception: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 5(offset:5).state:41 at android.support.v7.widget.RecyclerView$Recycler.clear(Unknown Source) at android.support.v7.widget.GapWorker.add(Unknown Source) at android.support.v7.widget.GapWorker.add(Unknown Source) at android.support.v7.widget.GapWorker.remove(Unknown Source) at android.support.v7.widget.GapWorker.add(Unknown Source) at android.support.v7.widget.GapWorker.run(Unknown Source) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5930) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
public class DateList extends Fragment {
DatesItemAdapter adapter;
List<DateItem2> keyList;
CardView cardView;
double v = 1;
float radius = 1;
ProgressBarCircular mCircular;
SwipeRefreshLayout swipeRefreshLayout;
RecyclerView mRecyclerView;
Animation animSlideUp;
Animation animSlideDown;
Uri.Builder builder;
JsonObjectRequest callToServerRequest;
public DateList() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onResume() {
super.onResume();
swipeRefreshLayout.post(new Runnable() {
@Override
public void run() {
callToServer(false);
}
}
);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_date_list, container, false);
((MainActivity) getActivity()).setTitle(getString(R.string.third_page));
((MainActivity) getActivity()).setToolbarVisibility(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
container.setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
}
mCircular = (ProgressBarCircular) view.findViewById(R.id.date_list_progressBar);
animSlideUp = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_up);
animSlideDown = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_down);
swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.date_list_swipe_refresh_layout);
mRecyclerView = (RecyclerView) view.findViewById(R.id.date_list_container);
keyList = new ArrayList<>();
adapter = new DatesItemAdapter(keyList, new DatesItemAdapter.DateItemClickListener() {
@Override
public void onClick(View v, int pos) {
if (pos < keyList.size()) {
try {
LinearLayoutManager linearLayoutManager = (LinearLayoutManager) mRecyclerView.getLayoutManager();
linearLayoutManager.scrollToPositionWithOffset(pos, 0);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}, getActivity(), view);
((MainActivity) getActivity()).setTitle("Hello " + getActivity().getResources().getString(R.string.date_list_be) + " " + "World");
builder = new Uri.Builder();
builder.scheme("https")
.authority("mydomain.ir")
.appendPath("mywebservices")
.appendPath("myWs");
cardView = new CardView(getActivity());
try {
cardView.setRadius(2);
} catch (Exception e) {
e.printStackTrace();
}
cardView.findViewById(R.id.date_list_item_card_view);
radius = cardView.getRadius();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
try {
v = ((cardView.getMaxCardElevation()) * 1.5) + ((1 - Math.cos(45)) * (radius));
} catch (Exception e) {
e.printStackTrace();
}
}
try {
mRecyclerView.addItemDecoration(new DividerItemDecoration(8, getActivity(), v));
} catch (Exception e) {
e.printStackTrace();
}
try {
final LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(layoutManager);
} catch (Exception e) {
e.printStackTrace();
}
mRecyclerView.setItemAnimator(new TchAnimator());
mRecyclerView.setAdapter(adapter);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
mRecyclerView.setVisibility(View.GONE);
callToServer(false);
}
});
final ImageView imageView = (ImageView) view.findViewById(R.id.date_list_header_image);
final String url = "https://pic.mydomain.ir/pics/" + getResources().getString(R.string.url) + "photo.jpg";
ImageLoader loader = AppController.getInstance().getImageLoader();
loader.get(url
, new ImageLoader.ImageListener() {
@Override
public void onResponse(ImageLoader.ImageContainer imageContainer, boolean b) {
try {
imageView.setImageBitmap(imageContainer.getBitmap());
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onErrorResponse(VolleyError volleyError) {
}
});
return view;
}
public void callToServer(final boolean rTime) {
String url = builder.toString();
if (rTime) {
url = url + "&rTime=1";
} else {
url = url + "&rTime=0";
}
callToServerRequest = new JsonObjectRequest(Request.Method.GET
, url
, null
, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
JSONArray array = new JSONArray(response.getString("Ticks"));
// Clears list to replace new list items
keyList.clear();
adapter.notifyDataSetChanged();
for (int i = 0; i < array.length(); i++) {
JSONObject obj = new JSONObject(array.get(i).toString());
DateItem2 item = new DateItem2();
item.setAvailable(obj.getString("available"));
item.setType(obj.getString("type"));
item.setUrl(obj.getString("url"));
item.setTime(obj.getString("time"));
item.setDescription(obj.getString("description"));
keyList.add(item);
}
if (rTime) {
mCircular.setVisibility(View.GONE);
}
adapter.notifyDataSetChanged();
mRecyclerView.setVisibility(View.VISIBLE);
swipeRefreshLayout.setRefreshing(false);
} catch (JSONException e) {
e.printStackTrace();
}
if (!rTime) {
callToServer(true);
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
if (rTime) {
mCircular.setVisibility(View.GONE);
}
try {
if (ConnectionDetector.IS_CONNECTED(getActivity())) {
if (volleyError.toString().contains("[]") && !rTime) {
callToServer(true);
}
}
} catch (Exception e) {
e.printStackTrace();
}
swipeRefreshLayout.setRefreshing(false);
}
});
AppController.getInstance().addToRequestQueue(callToServerRequest, "DateList" + "callToServerRequest");
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
try {
if (getView() != null) {
getView().setFocusableInTouchMode(true);
getView().requestFocus();
}
} catch (Exception e) {
e.printStackTrace();
}
getView().setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
try {
callToServerRequest.cancel();
} catch (Exception e) {
e.printStackTrace();
}
}
return false;
}
});
}
}
public class DatesItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private List<DateItem2> items;
private Context mContext;
private DateItemClickListener listener;
private Animation animRotate;
private LogAndReg logAndReg;
private View mainView;
public DatesItemAdapter(List<DateItem2> items, DateItemClickListener listener, Context mContext, View v) {
this.items = items;
this.listener = listener;
this.mContext = mContext;
animRotate = AnimationUtils.loadAnimation(mContext, R.anim.rotation);
this.mainView = v;
}
public interface DateItemClickListener {
void onClick(View v, int pos);
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
try {
View view = LayoutInflater.from(mContext).inflate(R.layout.date_list_list_item, parent, false);
switch (viewType) {
case 0:
return new GuarantyOpen(view);
case 1:
return new GuarantyClose(view);
case 2:
return new FreeOpenRefresh(view);
case 3:
return new FreeCloseRefresh(view);
case 4:
return new FreeOpen(view);
case 5:
return new FreeClose(view);
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) {
if (holder instanceof GuarantyOpen) {
final GuarantyOpen h0 = (GuarantyOpen) holder;
h0.time.setText(items.get(h0.getAdapterPosition()).getTime());
h0.type.setText(getModelType(h0.getAdapterPosition()));
if (items.get(h0.getAdapterPosition()).getAvailable().contentEquals("500")) {
h0.available.setText(R.string.is_available);
} else {
h0.available.setText(items.get(h0.getAdapterPosition()).getAvailable());
}
if (items.get(h0.getAdapterPosition()).getDescription().contentEquals("")) {
h0.description.setVisibility(View.GONE);
} else {
h0.description.setText(items.get(h0.getAdapterPosition()).getDescription());
}
h0.url.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
h0.url.setEnabled(true);
Intent intent = new Intent(mContext, Reserve.class);
intent.putExtra("type", items.get(h0.getAdapterPosition()).getType());
intent.putExtra("time", items.get(h0.getAdapterPosition()).getTime());
mContext.startActivity(intent);
}
});
h0.url.setBackgroundResource(R.drawable.button_bg_green_selector);
} else if (holder instanceof GuarantyClose) {
final GuarantyClose h1 = (GuarantyClose) holder;
try {
h1.time.setText(items.get(h1.getAdapterPosition()).getTime());
} catch (Exception e) {
e.printStackTrace();
}
if (items.get(h1.getAdapterPosition()).getAvailable().contentEquals("500")) {
h1.available.setText(R.string.is_available);
} else {
h1.available.setText(items.get(h1.getAdapterPosition()).getAvailable());
}
} else if (holder instanceof FreeOpenRefresh) {
final FreeOpenRefresh h2 = (FreeOpenRefresh) holder;
h2.time.setText(items.get(h2.getAdapterPosition()).getTime());
h2.type.setText(getModelType(h2.getAdapterPosition()));
if (items.get(h2.getAdapterPosition()).getAvailable().contentEquals("500")) {
h2.available.setText(R.string.is_available);
} else {
h2.available.setText(items.get(h2.getAdapterPosition()).getAvailable());
}
if (!((MainActivity) mContext).isLoggedIn()) {
h2.url.setText(R.string.date_adapter_login);
} else {
h2.url.setText(R.string.date_adapter_trans);
}
if (items.get(h2.getAdapterPosition()).getDescription().contentEquals("")) {
h2.description.setVisibility(View.GONE);
} else {
h2.description.setText(items.get(h2.getAdapterPosition()).getDescription());
}
h2.url.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
h2.url.setEnabled(false);
if (!((MainActivity) mContext).isLoggedIn()) {
h2.url.setEnabled(false);
logAndReg = LogAndReg.newInstance();
logAndReg.show(((MainActivity) mContext).getSupportFragmentManager(), "tag");
h2.childLayout.setVisibility(View.GONE);
} else {
h2.url.setEnabled(true);
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://" + items.get(h2.getAdapterPosition()).getUrl()));
mContext.startActivity(i);
}
}
});
} else if (holder instanceof FreeCloseRefresh) {
final FreeCloseRefresh h3 = (FreeCloseRefresh) holder;
h3.time.setText(items.get(h3.getAdapterPosition()).getTime());
if (items.get(h3.getAdapterPosition()).getAvailable().contentEquals("500")) {
h3.available.setText(R.string.is_available);
} else {
h3.available.setText(items.get(h3.getAdapterPosition()).getAvailable());
}
if (!((MainActivity) mContext).isLoggedIn()) {
h3.url.setText(R.string.date_adapter_login);
} else {
h3.url.setText(R.string.date_adapter_trans);
}
} else if (holder instanceof FreeOpen) {
final FreeOpen h4 = (FreeOpen) holder;
h4.time.setText(items.get(h4.getAdapterPosition()).getTime());
h4.available.setText(items.get(h4.getAdapterPosition()).getAvailable());
h4.type.setText(getModelType(h4.getAdapterPosition()));
if (items.get(h4.getAdapterPosition()).getAvailable().contentEquals("500")) {
h4.available.setText(R.string.is_available);
} else {
h4.available.setText(items.get(h4.getAdapterPosition()).getAvailable());
}
if (!((MainActivity) mContext).isLoggedIn()) {
h4.url.setText(R.string.date_adapter_login);
} else {
h4.url.setText(R.string.date_adapter_trans);
}
if (items.get(h4.getAdapterPosition()).getDescription().contentEquals("")) {
h4.description.setVisibility(View.GONE);
} else {
h4.description.setText(items.get(h4.getAdapterPosition()).getDescription());
}
h4.url.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
h4.url.setEnabled(false);
if (!((MainActivity) mContext).isLoggedIn()) {
h4.url.setEnabled(false);
logAndReg = LogAndReg.newInstance();
logAndReg.show(((MainActivity) mContext).getSupportFragmentManager(), "tag");
h4.childLayout.setVisibility(View.GONE);
} else {
h4.url.setEnabled(true);
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://" + items.get(h4.getAdapterPosition()).getUrl()));
mContext.startActivity(i);
}
}
});
} else if (holder instanceof FreeClose) {
final FreeClose h5 = (FreeClose) holder;
h5.time.setText(items.get(h5.getAdapterPosition()).getTime());
if (items.get(h5.getAdapterPosition()).getAvailable().contentEquals("500")) {
h5.available.setText(R.string.is_available);
} else {
h5.available.setText(items.get(h5.getAdapterPosition()).getAvailable());
}
if (!((MainActivity) mContext).isLoggedIn()) {
h5.url.setText(R.string.date_adapter_login);
} else {
h5.url.setText(R.string.date_adapter_trans);
}
}
}
@Override
public int getItemCount() {
return items.size();
}
@Override
public int getItemViewType(int position) {
return items.get(position).getexpandState().getValue();
}
private class GuarantyOpen extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView time, available, description, type;
Button url;
LinearLayout parentLayout;
GuarantyOpen(View v) {
super(v);
time = (TextView) v.findViewById(R.id.date_list_item_text_time);
available = (TextView) v.findViewById(R.id.date_list_item_text_available);
description = (TextView) v.findViewById(R.id.date_list_item_text_type);
type = (TextView) v.findViewById(R.id.date_list_item_ticket_type);
url = (Button) v.findViewById(R.id.date_list_item_btn_open_url);
url.setText(R.string.xml_reserve_reservation_btn);
parentLayout.setOnClickListener(this);
}
@Override
public void onClick(View view) {
try {
listener.onClick(view, getAdapterPosition());
items.get(getAdapterPosition()).setexpandState(DateItemStatus.GUARANTY_CLOSE);
onBindViewHolder(this, getAdapterPosition());
} catch (Exception e) {
e.printStackTrace();
}
}
}
private class GuarantyClose extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView time;
TextView available;
Button url;
LinearLayout parentLayout;
RelativeLayout childLayout;
GuarantyClose(View v) {
super(v);
time = (TextView) v.findViewById(R.id.date_list_item_text_time);
available = (TextView) v.findViewById(R.id.date_list_item_text_available);
url = (Button) v.findViewById(R.id.date_list_item_btn_open_url);
parentLayout = (LinearLayout) v.findViewById(R.id.date_list_item_parent_layout);
childLayout = (RelativeLayout) v.findViewById(R.id.date_list_item_child_layout);
childLayout.setVisibility(View.GONE);
parentLayout.setBackgroundColor(Color.parseColor("#f3faf4"));
childLayout.setBackgroundColor(Color.parseColor("#c8e6c9"));
parentLayout.setOnClickListener(this);
}
@Override
public void onClick(View view) {
try {
listener.onClick(view, getAdapterPosition());
items.get(getAdapterPosition()).setexpandState(DateItemStatus.GUARANTY_OPEN);
onBindViewHolder(this, getAdapterPosition());
} catch (Exception e) {
e.printStackTrace();
}
}
}
private class FreeOpenRefresh extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView time;
TextView available;
TextView description;
TextView type;
Button url;
LinearLayout parentLayout;
RelativeLayout childLayout;
FreeOpenRefresh(View v) {
super(v);
time = (TextView) v.findViewById(R.id.date_list_item_text_time);
available = (TextView) v.findViewById(R.id.date_list_item_text_available);
description = (TextView) v.findViewById(R.id.date_list_item_text_type);
type = (TextView) v.findViewById(R.id.date_list_item_ticket_type);
url = (Button) v.findViewById(R.id.date_list_item_btn_open_url);
parentLayout = (LinearLayout) v.findViewById(R.id.date_list_item_parent_layout);
childLayout = (RelativeLayout) v.findViewById(R.id.date_list_item_child_layout);
parentLayout.setOnClickListener(this);
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.date_list_item_btn_refresh) {
try {
items.get(getAdapterPosition()).setexpandState(DateItemStatus.FREE_REFRESH_OPEN);
} catch (Exception e) {
e.printStackTrace();
}
} else {
try {
listener.onClick(view, getAdapterPosition());
items.get(getAdapterPosition()).setexpandState(DateItemStatus.FREE_REFRESH_CLOSE);
onBindViewHolder(this, getAdapterPosition());
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
private class FreeCloseRefresh extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView time;
TextView available;
Button url;
LinearLayout parentLayout;
RelativeLayout childLayout;
FreeCloseRefresh(View v) {
super(v);
time = (TextView) v.findViewById(R.id.date_list_item_text_time);
available = (TextView) v.findViewById(R.id.date_list_item_text_available);
url = (Button) v.findViewById(R.id.date_list_item_btn_open_url);
parentLayout = (LinearLayout) v.findViewById(R.id.date_list_item_parent_layout);
childLayout = (RelativeLayout) v.findViewById(R.id.date_list_item_child_layout);
childLayout.setVisibility(View.GONE);
parentLayout.setOnClickListener(this);
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.date_list_item_btn_refresh) {
try {
items.get(getAdapterPosition()).setexpandState(DateItemStatus.FREE_REFRESH_CLOSE);
} catch (Exception e) {
e.printStackTrace();
}
} else {
try {
listener.onClick(view, getAdapterPosition());
items.get(getAdapterPosition()).setexpandState(DateItemStatus.FREE_REFRESH_OPEN);
onBindViewHolder(this, getAdapterPosition());
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
private class FreeOpen extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView time;
TextView available;
TextView description;
TextView type;
Button url;
LinearLayout parentLayout;
RelativeLayout childLayout;
FreeOpen(View v) {
super(v);
time = (TextView) v.findViewById(R.id.date_list_item_text_time);
available = (TextView) v.findViewById(R.id.date_list_item_text_available);
description = (TextView) v.findViewById(R.id.date_list_item_text_type);
type = (TextView) v.findViewById(R.id.date_list_item_ticket_type);
url = (Button) v.findViewById(R.id.date_list_item_btn_open_url);
parentLayout = (LinearLayout) v.findViewById(R.id.date_list_item_parent_layout);
childLayout = (RelativeLayout) v.findViewById(R.id.date_list_item_child_layout);
parentLayout.setOnClickListener(this);
}
@Override
public void onClick(View view) {
try {
listener.onClick(view, getAdapterPosition());
items.get(getAdapterPosition()).setexpandState(DateItemStatus.FREE_CLOSER);
onBindViewHolder(this, getAdapterPosition());
} catch (Exception e) {
e.printStackTrace();
}
}
}
private class FreeClose extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView time;
TextView available;
Button url;
LinearLayout parentLayout;
RelativeLayout childLayout;
FreeClose(View v) {
super(v);
time = (TextView) v.findViewById(R.id.date_list_item_text_time);
available = (TextView) v.findViewById(R.id.date_list_item_text_available);
url = (Button) v.findViewById(R.id.date_list_item_btn_open_url);
parentLayout = (LinearLayout) v.findViewById(R.id.date_list_item_parent_layout);
childLayout = (RelativeLayout) v.findViewById(R.id.date_list_item_child_layout);
childLayout.setVisibility(View.GONE);
parentLayout.setOnClickListener(this);
}
@Override
public void onClick(View view) {
try {
listener.onClick(view, getAdapterPosition());
items.get(getAdapterPosition()).setexpandState(DateItemStatus.FREE_OPEN);
onBindViewHolder(this, getAdapterPosition());
} catch (Exception e) {
e.printStackTrace();
}
}
}
private String getModelType(int position) {
String tType;
String type = items.get(position).getType();
switch (type) {
case "bclass":
...
break;
case "normal":
...
break;
case "phone":
...
break;
case "phone-bclass":
...
break;
}
return tType;
}
}
最佳答案
这可能是一个并发问题。我不知道 JsonObjectRequest 是如何工作的,但它的回调可能是在后台线程中调用的。因此,当您在更新数据时滚动时,回收器 View 会尝试创建其信息不再存在的 View 。
为了避免这种情况,一种可能的解决方案是将回调例程包装在 Runnable 中,以便由主线程中的 Handler 调用。像这样的东西:
public void callToServer(final boolean rTime) {
String url = builder.toString();
if (rTime) {
url = url + "&rTime=1";
} else {
url = url + "&rTime=0";
}
final Handler handler = new Handler(getMainLooper());
callToServerRequest = new JsonObjectRequest(Request.Method.GET
, url
, null
, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
handler.post(new Runnable() {
@Override
public void run() {
try {
JSONArray array = new JSONArray(response.getString("Ticks"));
// Clears list to replace new list items
keyList.clear();
adapter.notifyDataSetChanged();
for (int i = 0; i < array.length(); i++) {
JSONObject obj = new JSONObject(array.get(i).toString());
DateItem2 item = new DateItem2();
item.setAvailable(obj.getString("available"));
item.setType(obj.getString("type"));
item.setUrl(obj.getString("url"));
item.setTime(obj.getString("time"));
item.setDescription(obj.getString("description"));
keyList.add(item);
}
if (rTime) {
mCircular.setVisibility(View.GONE);
}
adapter.notifyDataSetChanged();
mRecyclerView.setVisibility(View.VISIBLE);
swipeRefreshLayout.setRefreshing(false);
} catch (JSONException e) {
e.printStackTrace();
}
if (!rTime) {
callToServer(true);
}
}
});
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
handler.post(new Runnable() {
@Override
public void run() {
if (rTime) {
mCircular.setVisibility(View.GONE);
}
try {
if (ConnectionDetector.IS_CONNECTED(getActivity())) {
if (volleyError.toString().contains("[]") && !rTime) {
callToServer(true);
}
}
} catch (Exception e) {
e.printStackTrace();
}
swipeRefreshLayout.setRefreshing(false);
}
});
}
});
AppController.getInstance().addToRequestQueue(callToServerRequest, "DateList" + "callToServerRequest");
}
关于android - RecyclerView : IndexOutOfBoundsException Inconsistency detected. 无效的项目位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43752449/
获取错误 ORA-00932: inconsistent datatypes: expected CHAR got NUMBER 00932. 00000 - "inconsistent dataty
我的main.sass中有这个: #thing { -moz-box-sizing: border-box; -webkit-box-sizing: border
在 Python 中,为什么 [:] 切片操作的行为不一致? 它对于列表和字符串的行为有所不同。 对于列表,它给出一个副本列表对象,对于字符串,它给出相同的字符串对象。 我觉得这令人困惑,违反直觉。有
在检查和测试正则表达式的各个方面时,我偶然发现了一种奇怪且“不一致”的行为。我试图在正则表达式中使用一些代码,但同样的行为也适用于使用 void 代码块。 尤其是最让我感动的是,当我互换 :g 和 :
已连接两个支持蓝牙的设备。一个通过outputStream向另一个发送周期性时间戳(writeTime),另一个通过inputStream检索writeTimes并附加自己的时间戳(readTime)
我有以下距离矩阵: delta = [[ 0. 0.71370845 0.80903791 0.82955157 0.56964983 0. 0.
我正在使用 recyclerView 并将数据加载为 arrayList。如果 arrayList 少于 7 个项目,则不会发生崩溃。 否则,我会遇到这个 fatal error : java.lan
为什么结果是: double a = 0.0/0.0; double b = 0/0.0; = NaN 但是结果例如: double e = 0.1/0.0; double e = 12.0/0.0;
这是我的 Java 1.6 类: public class Foo { private ArrayList names; public void scan() { if (names
我正在制作一个使用 encog 预测足球比赛结果的程序。我创建了一个神经网络,使用弹性传播训练方法使用 90 场比赛的数据对其进行训练。我将比赛结果标记为 1 表示主场获胜,0 表示平局,-1 表示客
我正在向我的 App 类中正在进行的 WPF 应用程序添加一些可绑定(bind)的 CLR 属性,但由于这个不一致的可访问性错误,我无法编译。 Inconsistent Accessibility:
我正在尝试使用带有以下参数的 solve.QP 函数(来自 quadprog 包)运行优化 R = matrix( c( 2.231113e-05,-4.816095e-05,-5.115287e-0
我的 solr 架构中有以下两个字段: 当我在启用 facet 的情况下发出请求(faceting on brand_id) http://example.com/solr/select?wt=j
我在 UIView 上有一个 UIButton。我想以编程方式确定显示 View 时在按钮内显示哪个图像。我已经重写了 UIView 中的 drawRect 方法并使用 setImage 来显示所需的
在常规中: println 'test' as Boolean //true println 'test'.toBoolean() //false println new Boolean('test'
例如,在 message.properties 中空白字段的默认 i18n 消息是: default.blank.message=Property [{0}] of class [{1}] canno
我正在尝试使用 array_multisort() 在其子数组的基础上对数组进行排序功能...... 在尝试的同时; print_r($mar); echo ''; $arr2 = array_mul
我正在使用 MALLET 来训练 ParallelTopicModel。训练后,我得到一个 TopicInferencer,取一个句子,通过推理器运行 15 次,然后检查结果。我发现对于某些主题,每次
1) 为什么在 JavaScript 中存在这种不一致 - 我期望第四行也返回 11: (function(n, m) { n = n + m; return n })(3, 8)
上下文: 我有一个小部件,它基本上由一个包装了一堆 TextView 的 RelativeLayout 组成。这是我希望小部件的外观,然后是 XML 布局代码: 问题:我
我是一名优秀的程序员,十分优秀!