好的,我需要一些帮助。我在从我的服务器获取Vector的活动中动态更新listview时遇到了困难。 我的活动有效。但是当我使用它时会崩溃。它是一个listView,它在onItemClick中调用更改某些项变量并上传到服务器的活动。所以当它回来时我每次都需要一个新列表。更多用户可以更改该列表。所以我真的需要列表与服务器上的列表一样,每次都是。
这是我的活动(对于一个班级,我是一名巴西人,对葡萄牙语中的行和变量感到遗憾):
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import org.apache.http.NameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.net.ConnectivityManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.exemple.beans.PedidoBean;
import com.exemple.templates.TemplateLista;
public class ListaPedidos extends Activity implements OnItemClickListener {
private ListView lv;
private TemplateLista template;
String table = "cervejas";
ProgressBar pg;
MediaPlayer cb1, cb2;
// Creating JSON Parser object
JSONParser jParser = new JSONParser();
public static Vector<PedidoBean> pedidos;
public static Vector<PedidoBean> pe;
// url to get all products list
private static String url_all_products = "url off the server";
// JSON Node names
private static final String TAG_SUCCESS = "success";
private static final String TAG_PRODUCTS = "pedidos";
private static final String TAG_PID = "pid";
private static final String TAG_MESA = "mesa";
private static final String TAG_NOME = "nome";
private static final String TAG_PRECO = "preco";
private static final String TAG_STATUS = "status";
private static final String TAG_SABOR = "sabor";
private static final String TAG_TAMANHO = "tamanho";
private static final String TAG_ESPECIFICACAO = "especificacao";
private static final String TAG_LACADOPOR = "lancadoPor";
private static final String TAG_PEDIDOEM = "pedidoEm";
public static boolean isOn;
int numPedidos;
// products JSONArray
JSONArray products = null;
boolean returnPressed;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.listapedidos);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
pg = (ProgressBar) findViewById(R.id.progressBar1);
returnPressed = false;
lv = (ListView) findViewById(R.id.list);
lv.setOnItemClickListener(this);
isOn = true;
if (pedidos == null) {
pedidos = new Vector<PedidoBean>();
}
if (pe == null) {
pe = new Vector<PedidoBean>();
}
if (!t.isAlive()) {
t.start();
}
}
@Override
public void onBackPressed() {
if (returnPressed) {
finish();
} else {
Toast.makeText(getApplicationContext(),
"Precione Mais Uma Vez Se Deseja Sair", Toast.LENGTH_LONG)
.show();
returnPressed = true;
}
}
Thread t = new Thread() {
@Override
public void run() {
try {
while (!isInterrupted()) {
Thread.sleep(15000);
runOnUiThread(new Runnable() {
@Override
public void run() {
atualizarlista();
}
});
}
} catch (InterruptedException e) {
}
}
};
@Override
protected void onPause() {
isOn = false;
super.onPause();
};
@Override
protected void onResume() {
isOn = true;
atualizarlista();
returnPressed = false;
super.onResume();
}
protected void atualizarlista() {
try {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm.getActiveNetworkInfo() != null
&& cm.getActiveNetworkInfo().isAvailable()
&& cm.getActiveNetworkInfo().isConnected()) {
// Hashmap for ListView
new LoadAllProducts().execute();
} else {
Toast.makeText(getApplicationContext(),
"Sem Conexão Com o Servidor", Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
Toast.makeText(getApplicationContext(),
"Sem Conexão com o Servidor", Toast.LENGTH_LONG).show();
}
}
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
String id = String.valueOf(template.getItemId(position));
Intent intent = new Intent(getApplicationContext(), StatusChange.class);
PedidoBean pb = procurarPorId(id, template.getPedidos());
String status = pb.getStatus();
intent.putExtra("status", status);
intent.putExtra("id", id);
startActivity(intent);
}
private PedidoBean procurarPorId(String id, Vector<PedidoBean> pedidos) {
int idItem = Integer.valueOf(id);
PedidoBean resp = null;
Iterator<PedidoBean> it = pedidos.iterator();
while (it.hasNext()) {
PedidoBean temp = new PedidoBean();
temp = it.next();
if (idItem == temp.getIdpedido()) {
resp = temp;
}
}
return resp;
}
class LoadAllProducts extends AsyncTask<String, String, String> {
int success;
/**
* Before starting background thread Show Progress Dialog
* */
@Override
protected void onPreExecute() {
pg.setVisibility(View.VISIBLE);
if (pedidos != null) {
pedidos = new Vector<PedidoBean>();
}
if (template != null) {
template.notifyDataSetChanged();
}
if (pe != null) {
pe = new Vector<PedidoBean>();
}
super.onPreExecute();
}
/**
* getting All products from url
* */
protected String doInBackground(String... args) {
// Building Parameters
List<NameValuePair> params = new ArrayList<NameValuePair>();
try {
// getting JSON string from URL
JSONObject json = jParser.makeHttpRequest(url_all_products,
"GET", params);
// Check your log cat for JSON reponse
Log.d("All Products: ", json.toString());
// Checking for SUCCESS TAG
success = json.getInt(TAG_SUCCESS);
if (success == 1) {
// products found
// Getting Array of Products
products = json.getJSONArray(TAG_PRODUCTS);
// looping through All Products
for (int i = 0; i < products.length(); i++) {
JSONObject c = products.getJSONObject(i);
try {
// Storing each json item in variable
String idpedido = c.getString(TAG_PID);
String mesa = c.getString(TAG_MESA);
String nome = c.getString(TAG_NOME);
String preco = c.getString(TAG_PRECO);
String status = c.getString(TAG_STATUS);
String sabor = c.getString(TAG_SABOR);
String tamanho = c.getString(TAG_TAMANHO);
String especificacao = c
.getString(TAG_ESPECIFICACAO);
String lancadoPor = c.getString(TAG_LACADOPOR);
String pedidoEm = c.getString(TAG_PEDIDOEM);
PedidoBean pb = new PedidoBean();
// adding each child node to HashMap key => value
pb.setIdpedido(Integer.valueOf(idpedido));
pb.setMesa(mesa);
pb.setNome(nome);
pb.setPreco(Double.valueOf(preco));
pb.setStatus(status);
pb.setSabor(sabor);
pb.setTamanho(tamanho);
pb.setEspecificacao(especificacao);
pb.setLancadoPor(lancadoPor);
pb.setPedidoEm(pedidoEm);
// adding HashList to ArrayList
pedidos.add(pb);
} catch (Exception e) {
System.out.print("array");
}
}
} else {
// no products found
// Launch Add New product Activity
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* After completing background task Dismiss the progress dialog
* **/
protected void onPostExecute(String file_url) {
// dismiss the dialog after getting all products
pg.setVisibility(View.INVISIBLE);
// updating UI from Background Thread
runOnUiThread(new Runnable() {
public void run() {
if (success == 1) {
try {
Collections.sort(pedidos);
if (numPedidos == 0) {
numPedidos = pedidos.size();
}
if (numPedidos < pedidos.size()) {
Toast.makeText(getApplicationContext(),
"Novo Pedido", Toast.LENGTH_SHORT)
.show();
cb1 = MediaPlayer.create(ListaPedidos.this,
R.raw.som_novo_pedido);
cb1.start();
numPedidos = pedidos.size();
} else {
numPedidos = pedidos.size();
}
} catch (Exception e) {
e.printStackTrace();
}
for (PedidoBean p : pedidos) {
pe.add(p.clone());
}
if (template == null) {
template = new TemplateLista(
getApplicationContext(), pe,
ListaMesas.mesas);
}
template.notifyDataSetChanged();
if (lv.getAdapter() == null) {
lv.setAdapter(template);
}
/**
* Updating parsed JSON data into ListView
* */
}
}
});
}
}
}
但每次使用10次时我都会收到此错误:
03-20 20:30:39.398: E/InputEventReceiver(23520): Exception dispatching input event.
03-20 20:30:39.398: E/MessageQueue-JNI(23520): Exception in MessageQueue callback: handleReceiveCallback
03-20 20:30:39.515: E/MessageQueue-JNI(23520): java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. [in ListView(2131361820, class android.widget.ListView) with Adapter(class com.exemple.templates.TemplateLista)]
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.widget.ListView.layoutChildren(ListView.java:1538)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.widget.AbsListView.onTouchEvent(AbsListView.java:3963)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.View.dispatchTouchEvent(View.java:7392)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2229)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1964)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2177)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1482)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.app.Activity.dispatchTouchEvent(Activity.java:2483)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2125)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2177)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1482)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.app.Activity.dispatchTouchEvent(Activity.java:2483)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2125)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.View.dispatchPointerEvent(View.java:7577)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3376)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3308)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4421)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4399)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4505)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:178)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.os.MessageQueue.nativePollOnce(Native Method)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.os.MessageQueue.next(MessageQueue.java:125)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.os.Looper.loop(Looper.java:124)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at android.app.ActivityThread.main(ActivityThread.java:4949)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at java.lang.reflect.Method.invokeNative(Native Method)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at java.lang.reflect.Method.invoke(Method.java:511)
03-20 20:30:39.515: E/MessageQueue-JNI(23520): at com.android.internal.os.ZygoteInit$MethodAndArgsCa
03-20 20:30:39.515: D/AndroidRuntime(23520): Shutting down VM
03-20 20:30:39.515: W/dalvikvm(23520): threadid=1: thread exiting with uncaught exception (group=0x40dda2a0)
03-20 20:30:39.523: E/AndroidRuntime(23520): FATAL EXCEPTION: main
03-20 20:30:39.523: E/AndroidRuntime(23520): java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. [in ListView(2131361820, class android.widget.ListView) with Adapter(class com.exemple.templates.TemplateLista)]
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.widget.ListView.layoutChildren(ListView.java:1538)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.widget.AbsListView.onTouchEvent(AbsListView.java:3963)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.View.dispatchTouchEvent(View.java:7392)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2229)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1964)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.523: E/AndroidRuntime(23520): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2177)
03-20 20:30:39.523: E/AndroidRuntime(23520): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1482)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.app.Activity.dispatchTouchEvent(Activity.java:2483)
03-20 20:30:39.523: E/AndroidRuntime(23520): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2125)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2235)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1978)
03-20 20:30:39.523: E/AndroidRuntime(23520): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2177)
03-20 20:30:39.523: E/AndroidRuntime(23520): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1482)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.app.Activity.dispatchTouchEvent(Activity.java:2483)
03-20 20:30:39.523: E/AndroidRuntime(23520): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2125)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.View.dispatchPointerEvent(View.java:7577)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3376)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3308)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4421)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4399)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4505)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:178)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.os.MessageQueue.nativePollOnce(Native Method)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.os.MessageQueue.next(MessageQueue.java:125)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.os.Looper.loop(Looper.java:124)
03-20 20:30:39.523: E/AndroidRuntime(23520): at android.app.ActivityThread.main(ActivityThread.java:4949)
03-20 20:30:39.523: E/AndroidRuntime(23520): at java.lang.reflect.Method.invokeNative(Native Method)
03-20 20:30:39.523: E/AndroidRuntime(23520): at java.lang.reflect.Method.invoke(Method.java:511)
03-20 20:30:39.523: E/AndroidRuntime(23520): at com.android.internal.os.Zygote
我已经做了很多事情,所以代码并不像他应该的那么干净,但问题仍然存在。 有人有什么建议吗? Ps:我是编程新手,所以尽量不要嘲笑我的代码......