緯度と対数を渡そうとすると、このArrayIndexOutOfBoundsExceptionが発生します
private String getId(String facebookUser,String lat, String expiryMinute, String messageId, String message, String referenceKey, String placeId) {
lang = Utils.formatDouble(Constants.searchLocation.getLongitude());
lat = Utils.formatDouble(Constants.searchLocation.getLatitude());
String traceId = null;
HttpClient client = new HttpClient();
PostMethod post = null;
try {
NameValuePair[] params = null;
NameValuePair param = new NameValuePair();
if(Constants.isMessageForPosting){
params = new NameValuePair[6];
param.setName("gadget");
param.setValue("gettraceid");
params[0] = param;
if(messageId == null || messageId.trim().isEmpty()){
messageId = "1";
}
}else{
params = new NameValuePair[8];
param.setName("gadget");
param.setValue("getrequestid");
params[0] = param;
if(messageId == null || messageId.trim().isEmpty()){
messageId = "2";
}
}
if(expiryMinute == null || expiryMinute.trim().isEmpty()){
expiryMinute = "0";
}
param = new NameValuePair();
param.setName("fbuserid");
param.setValue(facebookUser);
params[1] = param;
param = new NameValuePair();
param.setName("userid");
param.setValue(Constants.USERID);
params[2] = param;
param.setName("expiryminute");
param.setValue(expiryMinute);
params[3] = param;
param.setName("msgid");
param.setValue(messageId);
params[4] = param;
param = new NameValuePair();
param.setName("msg");
param.setValue(message);
params[5] = param;
param = new NameValuePair();
param.setName("lat");
param.setValue(lat);
params[9] = param;
param = new NameValuePair();
param.setName("lang");
param.setValue(lang);
params[10] = param;
*/
if(!Constants.isMessageForPosting){
param = new NameValuePair();
param.setName("referencekey");
param.setValue(referenceKey);
params[6] = param;
param = new NameValuePair();
param.setName("placeid");
param.setValue(placeId);
params[7] = param;
}
post.setQueryString(params);
int statusCode = client.executeMethod(post);
traceId = post.getResponseBodyAsString();
} catch (Exception e) {
Log.e(TAG, "For Facebook Trace Id:", e);
} finally {
post.releaseConnection();
post = null;
}
return Id;
}
以下は私のスタックトレースです
02-26 15:39:52.131: E/MainFragment(23117): For Facebook Trace Id:
02-26 15:39:52.131: E/MainFragment(23117): java.lang.ArrayIndexOutOfBoundsException: length=6; index=9
02-26 15:39:52.131: E/MainFragment(23117): at org.appright.mycity.activity.MainFragment.getTraceId(MainFragment.java:291)
02-26 15:39:52.131: E/MainFragment(23117): at org.appright.mycity.activity.MainFragment.access$7(MainFragment.java:225)
02-26 15:39:52.131: E/MainFragment(23117): at org.appright.mycity.activity.MainFragment$PostFBMessage.doInBackground(MainFragment.java:553)
02-26 15:39:52.131: E/MainFragment(23117): at org.appright.mycity.activity.MainFragment$PostFBMessage.doInBackground(MainFragment.java:1)
どんな助けでも大歓迎です。