以下のような配列があり、写真のリンクを手動で書き留めています。SQLでリンクを変更すると、画像が自動更新されるように配列をforループに変換する方法に問題があります。
public View getView(int position, View convertView, ViewGroup parent) {
ImageView i = new ImageView(mContext);
i.setImageResource(mImageIds[position]);
return i;
}
private Integer[] mImageIds = {
R.drawable.ctr,
R.drawable.fb,
R.drawable.games,
R.drawable.ic_launcher,
R.drawable.ctr,
R.drawable.ctr,
R.drawable.ctr,
R.drawable.ctr,
R.drawable.ea,
R.drawable.fb,
R.drawable.ctr
};
更新私はほとんどそれを解決すると思います:私はこれらを getView() の下に置きます
public View getView(int position, View convertView, ViewGroup parent) {
ImageView i = new ImageView(mContext);
final String SOAP_ACTION = "http://tempuri.org/findAppsByID";
final String METHOD_NAME = "findAppsByID";
final String NAMESPACE = "http://tempuri.org/";
final String URL = "http://domainURL.com/appsFeaturedWS.asmx";
SoapObject Request = new SoapObject (NAMESPACE, METHOD_NAME);
Request.addProperty("ID", position+1);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(Request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapObject resultString = (SoapObject) soapEnvelope.getResponse();
final String[] strLogo = new String[resultString.getPropertyCount()];
for(int j =0; j<resultString.getPropertyCount(); j++)
{
SoapObject array = (SoapObject) resultString .getProperty(j);
strLogo[j] = array.getProperty(5).toString(); //get logo
i.setImageResource(Integer.parseInt(strLogo[j]));
}
}
catch(Exception e){
}
return i;
}
しかし、私の画面は空白でしか表示されません...何か問題がありますか?