I am working on button click manipulations.
Is it changed all Button.OnClickListener in new SDK...
Button.onclickListener(this); giving error..
Here i s my code..
Using java Syntax Highlighting
- package com.androidi.webservices;
- import org.apache.commons.httpclient.HttpClient;
- import org.apache.commons.httpclient.methods.GetMethod;
- import android.app.Activity;
- import android.ipc.IpcSocket.Listener;
- import android.os.Bundle;
- import android.util.Log;
- import android.view.View;
- import android.view.ViewManager;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.TextView;
- import android.widget.SimpleCursorAdapter.ViewBinder;
- public class CallingWebServices extends Activity {
- /** Called when the activity is first created. */
- // UI elements
- private Button Invoke;
- private EditText Fromc;
- private EditText Toc;
- private EditText Resultc;
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- setContentView(R.layout.main);
- // Gather the troops
- Fromc = (EditText) findViewById(R.id.fromc);
- Toc = (EditText) findViewById(R.id.toc);
- Resultc = (EditText) findViewById(R.id.resultc);
- Invoke = (Button) findViewById(R.id.invoke);
- Invoke.setOnClickListener(this); // <--------
- HttpClient client = new HttpClient();
- GetMethod get = new GetMethod("http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency="+Fromc+"&ToCurrency="+Toc);
- try {
- int status = client.executeMethod(get);
- TextView resultado=(TextView)findViewById(R.id.resultc);
- String res="";
- if(status!=404)
- res=get.getResponseBodyAsString();
- else
- res=getString(R.string.ws_not_found);
- resultado.setText(res);
- }
- catch (Exception e) {
- Log.e("Error:",e.getMessage());
- }
- finally {
- get.releaseConnection();
- get=null;
- }
- }
- }
Parsed in 0.038 seconds, using GeSHi 1.0.8.4
And which interface is needed to imlement to set button listener/...
Thanks in advance...
by vamsi




