0

登录页面后我的订购应用程序将转到 Scanner、List 和 Order。在我点击订单后进入目录,它可以在 eclipse 虚拟设备上运行,但不能在移动设备上运行。其他页面没问题

这是 CatalogActivity.java

package com.example.barcode;

import java.util.List;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.ListView;

public class CatalogActivity extends Activity {

 private List<Product> mProductList;
 Button button;


 @Override
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.catalog);

  // Obtain a reference to the product catalog
  mProductList = ShoppingCartHelper.getCatalog(getResources());

  // Create the list
  ListView listViewCatalog = (ListView) findViewById(R.id.ListViewCatalog);
  listViewCatalog.setAdapter(new ProductAdapter(mProductList, getLayoutInflater(), false));

 listViewCatalog.setOnItemClickListener(new OnItemClickListener() {

  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position,
    long id) {
   Intent productDetailsIntent = new         Intent(getBaseContext(),ProductDetailsActivity.class);
   productDetailsIntent.putExtra(ShoppingCartHelper.PRODUCT_INDEX, position);
  startActivity(productDetailsIntent);
}
});

Button viewShoppingCart = (Button) findViewById(R.id.ButtonViewCart);
viewShoppingCart.setOnClickListener(new OnClickListener() {

 @Override
 public void onClick(View v) {
  Intent viewShoppingCartIntent = new Intent(getBaseContext(), ShoppingCartActivity.class);
  startActivity(viewShoppingCartIntent);
 }
});

}

}

这是电话的目录

04-09 01:45:45.174 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE 跨度不能有零长度

04-09 01:45:45.174 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:45:48.484 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:45:48.484 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:45:56.939 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:45:56.939 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:45:57.424 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:45:57.424 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:45:57.429 E/System  (30213): Uncaught exception thrown by finalizer

04-09 01:45:57.429 E/System  (30213): java.io.IOException: close failed: EIO (I/O error)

04-09 01:45:57.429 E/System  (30213):   at libcore.io.IoUtils.close(IoUtils.java:41)

04-09 01:45:57.429 E/System  (30213):   at java.io.FileOutputStream.close(FileOutputStream.java:139)

04-09 01:45:57.429 E/System  (30213):   at java.io.FileOutputStream.finalize(FileOutputStream.java:153)

04-09 01:45:57.429 E/System  (30213):   at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:186)

04-09 01:45:57.429 E/System  (30213):   at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:169)

04-09 01:45:57.429 E/System  (30213):   at java.lang.Thread.run(Thread.java:856)

04-09 01:45:57.429 E/System  (30213): Caused by: libcore.io.ErrnoException: close failed: EIO (I/O error)

04-09 01:45:57.429 E/System  (30213):   at libcore.io.Posix.close(Native Method)

04-09 01:45:57.429 E/System  (30213):   at libcore.io.BlockGuardOs.close(BlockGuardOs.java:75)

04-09 01:45:57.429 E/System  (30213):   at libcore.io.IoUtils.close(IoUtils.java:38)

04-09 01:45:57.429 E/System  (30213):   ... 5 more

04-09 01:45:57.434 E/System  (30213): Uncaught exception thrown by finalizer

04-09 01:45:57.434 E/System  (30213): java.io.IOException: close failed: EIO (I/O error)

04-09 01:45:57.434 E/System  (30213):   at libcore.io.IoUtils.close(IoUtils.java:41)

04-09 01:45:57.434 E/System  (30213):   at java.io.FileInputStream.close(FileInputStream.java:121)
04-09 01:45:57.434 E/System  (30213):   at java.io.FileInputStream.finalize(FileInputStream.java:142)

04-09 01:45:57.434 E/System  (30213):   at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:186)

04-09 01:45:57.434 E/System  (30213):   at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:169)

04-09 01:45:57.434 E/System  (30213):   at java.lang.Thread.run(Thread.java:856)

04-09 01:45:57.434 E/System  (30213): Caused by: libcore.io.ErrnoException: close failed: EIO (I/O error)

04-09 01:45:57.434 E/System  (30213):   at libcore.io.Posix.close(Native Method)

04-09 01:45:57.434 E/System  (30213):   at libcore.io.BlockGuardOs.close(BlockGuardOs.java:75)

04-09 01:45:57.434 E/System  (30213):   at libcore.io.IoUtils.close(IoUtils.java:38)

04-09 01:45:57.434 E/System  (30213):   ... 5 more

04-09 01:45:58.214 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:45:58.214 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:46:00.394 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:46:00.394 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:46:30.454 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:46:30.454 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:46:30.879 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:46:30.879 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:47:01.334 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:47:01.334 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:47:02.439 E/Dynamiclayout(30213): java.lang.IndexOutOfBoundsException: charAt: 0 >= length 0

04-09 01:47:02.664 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:47:02.664 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:47:22.089 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:47:22.089 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:47:23.169 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

04-09 01:47:23.169 E/SpannableStringBuilder(30213): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
4

1 回答 1

0

您必须找到长度为零的字符串。那是发生错误时生成的完整日志吗?读取文件时会发生 IO 异常,但是在发布的代码中没有文件操作。您的这部分代码似乎也没有错误。

于 2013-04-10T21:30:40.240 回答