1

こんにちはこれは私のxmlフィードです。

<feed>
  <Order>
   <orderid>1</orderid>
   <login>krishna</login>
   <total>399.99</total>
   <payment_method>Check (manual processing)</payment_method>                                  
   <firstname>krishnaveni</firstname>
   <lastname>v</lastname>
  </Order>
  <Order>
   <orderid>65</orderid>
   <login>krishna</login>
   <total>399.99</total>
   <payment_method>Phone Ordering</payment_method>
   <firstname>krishnaveni</firstname>
   <lastname>v</lastname>
 </Order>
</feed>

以下のCustomizedListview.javaは、上記のxmlフィードからリストビューを実行します...動作します...ここで、リスト内の任意の順序をクリックする必要があるということは、次のアクティビティに移動することを意味します。次のアクティビティの1つのステータス(スピナー)フィールド。 。ステータス値が更新されるのは上記のorderidに依存します...どのようにdisを開発できますか... insertionexampleではcustomizedlistviewから解析されたorderid値を表示する必要があります...ステータスが更新される必要があるのはこのorderidに依存します..howコードを管理できますか..助けてください...

これは私のAndroidコードです:CustomizedListview:

    public class CustomizedListView extends Activity {
// All static variables
static final String URL = "http://192.168.1.168/xcart432pro/orderdetails.xml";
static final String KEY_SONG = "Order"; // parent node
static final String KEY_ID = "orderid";
static final String KEY_TITLE = "orderid";
static final String KEY_DATE = "date";
static final String KEY_ARTIST = "payment_method";
static final String KEY_STATUS = "status";
static final String KEY_DURATION = "total";
static final String KEY_FNAME = "firstname";
static final String KEY_LNAME = "lastname";
static final String KEY_NAME = "login";

ListView list;
LazyAdapter adapter;

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


    ArrayList<HashMap<String, String>> songsList = new ArrayList<HashMap<String, String>>();

    XMLParser parser = new XMLParser();
    String xml = parser.getXmlFromUrl(URL); // getting XML from URL
    Document doc = parser.getDomElement(xml); // getting DOM element

    NodeList nl = doc.getElementsByTagName(KEY_SONG);
    // looping through all song nodes <song>
    for (int i = 0; i < nl.getLength(); i++) {
        // creating new HashMap
        HashMap<String, String> map = new HashMap<String, String>();
        Element e = (Element) nl.item(i);
        // adding each child node to HashMap key => value
        map.put(KEY_ID, parser.getValue(e, KEY_ID));
        map.put(KEY_TITLE, parser.getValue(e, KEY_TITLE));
        map.put(KEY_ARTIST, parser.getValue(e, KEY_ARTIST));
        map.put(KEY_STATUS, parser.getValue(e, KEY_STATUS));
        map.put(KEY_FNAME, parser.getValue(e, KEY_FNAME));
        map.put(KEY_LNAME, parser.getValue(e, KEY_LNAME));
        songsList.add(map);
    }


    list=(ListView)findViewById(R.id.list);

    // Getting adapter by passing xml data ArrayList
    adapter=new LazyAdapter(this, songsList);        
    list.setAdapter(adapter);


    // Click event for single list row
    list.setOnItemClickListener(new OnItemClickListener() {

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


            // Starting new intent
            Intent in = new Intent(getApplicationContext(), InsertionExample.class);

             startActivity(in);                 

        }
    });     
}   

}

これは私のInsertionExample.javaです。

public class UpdationExample extends Activity{
EditText userName, userPassword ;
private final String NAMESPACE = "http://xcart.com";
private final String URL = "http://192.168.1.168:8089/XcartLogin/services/Updation?wsdl";
private final String SOAP_ACTION = "http://xcart.com/insertData";
private final String METHOD_NAME = "insertData";
static final String KEY_NAME = "orderid";
Button btninsert;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
      Intent in = getIntent();

    // Get XML values from previous intent
    String orderid = in.getStringExtra(KEY_NAME);

    // Displaying all values on the screen
    TextView lblName = (TextView) findViewById(R.id.textView1);


    lblName.setText(orderid);
    btninsert = (Button)findViewById(R.id.btn_insert);
    btninsert.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
         insertValues();
        }
    });
}

public void insertValues(){
 SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
 EditText userName = (EditText) findViewById(R.id.editText1);
 String user_Name = userName.getText().toString();
 EditText userPassword = (EditText) findViewById(R.id.editText2);
 String user_Password = userPassword.getText().toString();

 //Pass value for userName variable of the web service
    PropertyInfo unameProp =new PropertyInfo();
    unameProp.setName("userName");//Define the variable name in the web service method
    unameProp.setValue(user_Name);//Define value for fname variable
    unameProp.setType(String.class);//Define the type of the variable
    request.addProperty(unameProp);//Pass properties to the variable

  //Pass value for userPassword variable of the web service
    PropertyInfo passwordProp =new PropertyInfo();
    passwordProp.setName("userPassword");
    passwordProp.setValue(user_Password);
    passwordProp.setType(String.class);
    request.addProperty(passwordProp);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.setOutputSoapObject(request);
    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

    try{
     androidHttpTransport.call(SOAP_ACTION, envelope);
        SoapPrimitive response = (SoapPrimitive)envelope.getResponse();

        TextView result = (TextView) findViewById(R.id.textView2);
        result.setText(response.toString());

 }
 catch(Exception e){

 }
}

}

ここで、ユーザー名とパスワードは更新され、上記のxmlフィードのorderidによって異なります。

4

0 に答える 0