0

i have developed one Listview app using soap WebService from MySQL database.Now one order is inserted on my database means that time this (new order is inserted) notify message is display on my android device.now i click the notification message means that time the app is run and display Listview successfully automatically when each and every new order is insert on my MySQL database.what methods am use here????please help me.

This is my RetailerActivity.java code:

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();
    }
  }
 }

please here the Listview is successfully displayed.but the new order is inserted on my database means that time the new order is inserted Notification message is displayed on android device.now i have to click the notified meassage means it is display update Listview.how can i do???????? what methods i have to use here????

Jitesh Dalsaniya
  • 1,917
  • 3
  • 20
  • 36
user1676640
  • 635
  • 7
  • 17
  • 37
  • refresh ur listView using...ur listView.getAdapter().notifyDataSetChanged()...and confirm that ur resultArr is changed – sheetal Sep 25 '12 at 09:16
  • i wish to need push notification message on android device top.how can i do????any method is the...(for eg)c2dm or gcm – user1676640 Sep 25 '12 at 09:33

1 Answers1

1

If you are getting the data in the new data in the ListView, then only thing that i think you will have to do is

adapter.notifyDataSetChanged(); // adapter is the instance of ArrayAdapter.

Kumar Vivek Mitra
  • 33,294
  • 6
  • 48
  • 75
  • i wish to need push notification message on android device top.how can i do????any method is the...(for eg)like c2dm or gcm – user1676640 Sep 25 '12 at 10:04
  • @user1676640 Very frankly speaking i have used the `parse.com` api to handle my push notifications, its easy and awesome.. the notification automatically comes to the top, clicking the notification will take you directly to the app, and if you want i can take you to some specific activity too, that you mention – Kumar Vivek Mitra Sep 25 '12 at 10:08
  • yes exactly i need above concept only.where i can learn parse.com.please help me – user1676640 Sep 25 '12 at 10:50