My Question is, How to store data in one table to another. I have received ImageId 1,2,3,4,5 from Mysql table . But when I send This ImageId to another Mysql table then Store the ImageId Like 5,5,5,5,5 instead of 1,2,3,4,5 in another Mysql table. Actually what is the problem in my code. Please suggest me. Thanking you.
If I have Print strImageId[],
System.out.println(" strImageIdArray="+ strImageIdArray[i]);
then Output is,
System.out.println(" strImageIdArray=”+ 1);
System.out.println(" strImageIdArray=”+ 2);
System.out.println(" strImageIdArray=”+ 3);
System.out.println(" strImageIdArray=”+ 4);
System.out.println(" strImageIdArray=”+ 5);
But another Mysql Table Store the value 5,5,5,5,5.
`enter code here`
public String strImageIdArray[];
public class GetDetails extends AsyncTask<Void, Void, Void>
{
JSONArray json = null;
JSONParser jParser = null;
@Override
protected void onPreExecute()
{
super.onPreExecute();
}
@Override
protected Void doInBackground(Void... arg0) {
jParser = new JSONParser();
json = jParser.getJSONFromUrl(url);
ServiceHandler sh = new ServiceHandler();
jsonStr = sh.makeServiceCall(url, ServiceHandler.GET);
strImageIdArray = new String[json.length()];
if (jsonStr != null)
{
if (jsonStr.equals("not found"))
{
} else
{
try
{
// looping through All Contacts
for (int i = 0; i < json.length(); i++)
{
JSONObjectjsonObject=json.getJSONObject(i);
strImageId=jsonObject.getString(TAG_IMAGE_ID);
strImageIdArray[i] = jsonObject.getString(TAG_IMAGE_ID);
System.out.println("strImageIdArray="+ strImageIdArray[i]);
urlUserImageInfo = "http://192.168.1.11/touchify/tf/
get_all_user_imageinfo? SS_TF_User_Image_Info_Imei_No="+
strImeiNo+"&SS_TF_User_Image_Info_Mobile_No="+strMobileNo
+ "&SS_TF_User_Image_Info_Image_Id="+ strImageIdArray[i]
+ "&SS_TF_User_Image_Info_Image_Status="+ strSavedImageStatus;
new UserImageInfo().execute();
HashMap<String, String> contact = new HashMap<String, String>();
contact.put(TAG_IMAGE_ID, strImageId);
arrDataList.add(contact);
}
} else
{
Log.e("ServiceHandler", "Couldn't get any data from the url");
}
return null;
}
@Override
protected void onPostExecute(Void result)
{
super.onPostExecute(result);
viewPagerAddGallery.setAdapter(new ImagePagerAdapter(strImageLocatorArray));
}
}
UserImageInfo Asynchronous Class
public class UserImageInfo extends AsyncTask<Void, Void, Void>
{
@Override
protected void onPreExecute()
{
super.onPreExecute();
}
@Override
protected Void doInBackground(Void... arg0)
{
ServiceHandler sh = new ServiceHandler();
// Making a request to url and getting response
String jsonStr = sh.makeServiceCall(urlUserImageInfo,
ServiceHandler.GET);
return null;
}
@Override
protected void onPostExecute(Void result)
{
super.onPostExecute(result);
}
}
enter code here
enter code here`
0 comments:
Post a Comment