0

我已经Listview使用数据库中的soap开发了一个应用程序。现在在我WebServiceMySQL数据库中插入了一个订单意味着这个(插入新订单)通知消息显示在我的android设备上。现在我单击通知消息意味着运行应用程序的时间并Listview在我的数据库中插入每个新订单时自动成功显示MySQL。这里使用什么方法????请帮助我。

这是我的RetailerActivity.java代码:

public class RetailerActivity extends Activity {
ListView list;
private static final String SOAP_ACTION = "http://xcart.com/customerData1";
private static final String METHOD_NAME = "customerData1";
private static final String NAMESPACE = "http://xcart.com";
private static final String URL = "http://192.168.1.168:8089/XcartLogin/services/RetailerWs?wsdl";
private static final String KEY_STATUS = "status";



/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

    envelope.setOutputSoapObject(request);

    HttpTransportSE ht = new HttpTransportSE(URL);
    try {
        ht.call(SOAP_ACTION, envelope);
        SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
        SoapPrimitive s = response;
        String str = s.toString();
        String resultArr[] = str.split("&");
        list=(ListView)findViewById(R.id.list);


        list.setAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1,resultArr));
        list.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) { 

                String status =  parent.getItemAtPosition(position).toString();

                String[] status1  = status.split(" ");

                 String StrStatus = status1[1].toString();

                Intent in = new Intent(getApplicationContext(), SingleMenuItemActivity.class);
                in.putExtra(KEY_STATUS, StrStatus);

                startActivity(in);            



            }
        });     
    } 




    catch (Exception e) {
        e.printStackTrace();
    }
  }
 }

请在这里Listview成功显示。但是新订单已插入我的数据库中,这意味着插入新订单的时间Notification消息会显示在android设备上。现在我必须单击通知消息,这意味着它正在显示更新Listview。我该怎么办? ??????我必须在这里使用什么方法????

4

1 回答 1

1

如果您在 ListView 的新数据中获取数据,那么我认为您唯一需要做的就是

adapter.notifyDataSetChanged();//adapterArrayAdapter.

于 2012-09-25T09:31:41.420 回答