我正在设置一个新的服务器和安卓,并想从安卓发送base64(图像)到服务器。我使用JSON作为android和服务器之间的数据格式,所以我必须将我的base64放入JSON中,但是服务器无法解码我的base64,因为有一个"\n,+“等符号。我也尝试使用记事本替换"\n“,但服务器仍然不能解码它.. 注意:如果我使用Postman,服务器将正常工作 JSONArray data = new JSONArray();
for (int i = 0; i < listImage.size(); i++) {
//listImage.get(i).setBase64
我试着在安卓平台上用Glide做一个画廊。但我发现了些东西。我有一个JSONArray为我的画廊,其中包含图像链接。但是我不能在这些链接中使用glide。有什么建议吗?我如何列出或显示它们?但是首先,我怎样才能把这些图像显示成一个列表呢?
JSONArray jsonArray = new JSONArray(jsonString);
List<GalleryDetails> details = new ArrayList<>();
String[] Photos= new String[jsonArray.length(
我正在构建一个安卓应用程序,将从一个Wordpress网站使用其RESTful应用程序接口获取帖子。我获取了它生成的整个,一个对象数组,并且我试图访问这个数组中的特定对象
// json parameter is the response from the link above
JSONArray jsonArray = new JSONArray(json);
JSONObject jsonPost = jsonArray.getJSONObject(0);
但结果将始终是整个响应,而不是索引的特定对象。我迷路了。
在我的安卓应用程序中,我在下面的第3行收到了一个JSON.typeMisMatch错误。我不明白为什么,因为我可以在其他程序中访问这个数组。
1 JSONObject jsonObj = new JSONObject(result);
2 Log.d("jsonObj=", String.valueOf(jsonObj));
3 JSONArray jsonArray = jsonObj.getJSONArray("obit"); // This is the error line
目前,我正尝试在安卓的ListView中显示JSON数据(托管在JSON服务器上)。应用程序正确地接收到数据,但无法对其进行进一步处理以将其显示在所述ListView中。
错误如下:JSON parsing error: Value ... of type org.json.JSONArray cannot be converted to JSONObject
我试图解析的JSON数据如下所示:[{"idBuch":1,"autor":"Erich Maria Remarque","name":"Im Westen nic
我试图在我的安卓应用程序中找到facebook的朋友,我的代码在较低的安卓版本中运行良好,但它显示的是NetworkOnMainThreadException的4.0和更高版本。
这是我的代码:
public static void getFaceBookFriendsIDs() {
new Thread(new Runnable() {
@Override
public void run() {
try {
JSONObject result = new
我是安卓的新手,我用AsyncHttpClient来调用POST API。但是API甚至没有被调用。
下面是我的代码:
AsyncHttpClient client = new AsyncHttpClient();
client.addHeader("Key","random-key");
JSONObject body = new JSONObject();
body.put("clientId","random-client-id");
body
我使用这个代码,我发现在一些页面,但我只能上传图像从我的安卓应用程序到服务器,并正在工作,但当我上传视频(.mp4)它保存为“文件”喜欢未知。
public void upload() throws Exception {
//Url of the server
String url = "";
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
MultipartEntity mpEntity = new MultipartEnt
我有以下格式的JSONObject:
[{"ascii_name":"Rio de Janeiro"},{"ascii_name":"Riyadh"},{"ascii_name":"Rome"},{"ascii_name":"Rawalpindi"},{"ascii_name":"Rabat"},{"ascii_name":"Recife"},{"ascii_name":"Ra