I have code to show store like this . and i still learning about android ,
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// getting values from selected ListItem
String pid = ((TextView) view.findViewById(R.id.id_store)).getText()
.toString();
// Starting new intent
Intent in = new Intent(getApplicationContext(),
editstoreActivity.class);
// sending pid to next activity
in.putExtra("phone", mPhoneNumber);
in.putExtra(TAG_PID, pid);
// starting new activity and expecting some response back
startActivityForResult(in, 100);
}
});
but it show error like this
10-05 12:17:56.149: INFO/ActivityManager(59): Starting activity: Intent { cmp=shoop3.android.edu/.editstoreActivity (has extras) }
10-05 12:17:58.289: DEBUG/dalvikvm(957): GC_FOR_MALLOC freed 1530 objects / 274448 bytes in 208ms
10-05 12:17:59.649: ERROR/JSON Parser(957): Error parsing data org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
10-05 12:17:59.669: DEBUG/Single Store Details(957): {"store":[{"id_user":"63","id_platform":"1","store_url":"url.com","store_desc":"wordpress","id_store":"42","store_logo":null,"store_name":"toko wordpress edit","store_curr":null},{"id_user":"63","id_platform":"2","store_url":"pres.com","store_desc":"prestashop","id_store":"43","store_logo":null,"store_name":"toko prestashop","store_curr":null}]}
10-05 12:18:00.899: INFO/ActivityManager(59): Displayed activity shoop3.android.edu/.editstoreActivity: 4664 ms (total 4664 ms)
10-05 12:18:58.339: DEBUG/SntpClient(59): request time failed: java.net.SocketException: Address family not supported by protocol
10-05 12:23:58.343: DEBUG/SntpClient(59): request time failed: java.net.SocketException: Address family not supported by protocol
I really confuse , any solution?? please
You are trying to parse response in json, where response is in xml, I assume. Better, you use some XML parser, like
You are possibly trying to convert a JSON to String . Try using Gson . It has methods to convert the JSON to string
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.