Вы можете найти приложение для Android и Android Studio, имеющее дело с приложением Spinner, которое не имеет ничего общего с общедоступным веб-сервисом SQL Server и работает с C # .¿Hay alguna formade hacerlo?
Android Studio
частный класс CargarCombo расширяет AsyncTask {
private CatalogoSpinner[] catalogoCatalogoSpinner;
protected Boolean doInBackground(String... params) {
boolean resul = true;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo pro = new PropertyInfo();
pro.setName("consulta");
pro.setValue("SELECT DESCRIPCION, ID_PRODUCTO_FINANCIERO AS ID FROM CAT_PRODUCTO_FINANCIERO");
pro.setType(String.class);
request.addProperty(pro);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE transporte = new HttpTransportSE(URL);
try
{
transporte.call(SOAP_ACTION, envelope);
// SoapObject resSoap = (SoapObject) envelope.bodyIn;
SoapObject resSoap =(SoapObject)envelope.getResponse();
catalogoCatalogoSpinner = new CatalogoSpinner[resSoap.getPropertyCount()];
for (int i = 0; i < catalogoCatalogoSpinner.length; i++)
{
SoapObject ic = (SoapObject)resSoap.getProperty(i);
CatalogoSpinner catalogoSpinner = new CatalogoSpinner();
catalogoSpinner.descripcion = ic.getProperty(0).toString();
catalogoSpinner.id = Integer.parseInt(ic.getProperty(1).toString());
catalogoCatalogoSpinner[i] = catalogoSpinner;
}
}
catch (Exception e)
{
resul = false;
}
return resul;
}
protected void onPostExecute(Boolean result) {
if (result) {
//Rellenamos la lista con los nombres de la descripcion
final String[] datos = new String[catalogoCatalogoSpinner.length];
for (int i = 0; i < catalogoCatalogoSpinner.length; i++)
datos[i] = catalogoCatalogoSpinner[i].descripcion;
ArrayAdapter<String> adaptador = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_spinner_dropdown_item, datos);
spinnerProducto.setAdapter(adaptador);
//Este es para que al dar click cambie
/*spinnerProducto.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
String product = spinnerProducto.getItemAtPosition(position).toString();
if(product.equals("CGS")){
txtPlazo.setText("16");
}else if(product.equals("CIS"))
{
txttasa.setText("6.00");
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});*/
}
else
{
Toast.makeText(getActivity(), "Fallo al cargar los datos", Toast.LENGTH_SHORT).show();
}
}
}