- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我是这个库的新手,我在使用它时遇到了一些问题。我将它与 AppController 类一起使用。AppController.java:
package ir.naserpour.ketabsara;
import android.app.Application;
import android.text.TextUtils;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
/**
* Created by reza-pc on 9/30/16.
*/
public class AppController extends Application {
public static final String TAG = AppController.class
.getSimpleName();
private RequestQueue mRequestQueue;
private ImageLoader mImageLoader;
private static AppController mInstance;
@Override
public void onCreate() {
super.onCreate();
mInstance = this;
}
public static synchronized AppController getInstance() {
return mInstance;
}
public RequestQueue getRequestQueue() {
if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue(getApplicationContext());
}
return mRequestQueue;
}
public ImageLoader getImageLoader() {
getRequestQueue();
if (mImageLoader == null) {
mImageLoader = new ImageLoader(this.mRequestQueue,
new LruBitmapCache());
}
return this.mImageLoader;
}
public <T> void addToRequestQueue(Request<T> req, String tag) {
// set the default tag if tag is empty
req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
getRequestQueue().add(req);
}
public <T> void addToRequestQueue(Request<T> req) {
req.setTag(TAG);
getRequestQueue().add(req);
}
public void cancelPendingRequests(Object tag) {
if (mRequestQueue != null) {
mRequestQueue.cancelAll(tag);
}
}
}
我的 MainActivity.java 文件是这样的:
package ir.naserpour.ketabsara;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.CardView;
import android.util.Log;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.*;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.JsonArrayRequest;
import com.android.volley.toolbox.NetworkImageView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Locale;
import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
public class MainActivity extends AppCompatActivity {
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Configuration configuration = getResources().getConfiguration();
configuration.setLayoutDirection(new Locale("fa"));
getResources().updateConfiguration(configuration, getResources().getDisplayMetrics());
setContentView(R.layout.activity_main);
//typeface
final Typeface Font = Typeface.createFromAsset(getAssets(),"fonts/sans.ttf");
//category1
String cat1url= "http://data.h70.ir/category1.php";
HorizontalScrollView cat1scroll = (HorizontalScrollView)findViewById(R.id.category1);
ViewGroup.LayoutParams Sparams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
cat1scroll.setLayoutParams(Sparams);
final LinearLayout hlayout = new LinearLayout(getApplicationContext());
ViewGroup.LayoutParams Lparams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 300);
hlayout.setOrientation(LinearLayout.HORIZONTAL);
hlayout.setLayoutParams(Lparams);
cat1scroll.addView(hlayout);
final ProgressDialog pdialog = new ProgressDialog(MainActivity.this);
pdialog.setMessage("در حال دریافت اطلاعات...");
pdialog.setCancelable(false);
pdialog.show();
JsonArrayRequest req = new JsonArrayRequest(cat1url,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
for (int i=0;i<= response.length();i++){
try {
JSONObject cat1object= response.getJSONObject(i);
String name = cat1object.getString("name");
String image = cat1object.getString("image");
create_layout(name, image, hlayout);
} catch (JSONException e) {
e.printStackTrace();
Toast.makeText(getApplicationContext(),"cat1object",Toast.LENGTH_SHORT).show();
}
}
pdialog.hide();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(),"error",Toast.LENGTH_SHORT).show();
pdialog.hide();
}
});
AppController.getInstance().addToRequestQueue(req);
}
public void create_layout(String name, String image, LinearLayout hlayout){
CardView card = new CardView(MainActivity.this);
ViewGroup.LayoutParams card_params = new ViewGroup.LayoutParams(200,300);
card.setLayoutParams(card_params);
NetworkImageView image_view = new NetworkImageView(MainActivity.this);
ImageLoader loader = AppController.getInstance().getImageLoader();
image_view.setImageUrl(image, loader);
ViewGroup.LayoutParams image_params = new ViewGroup.LayoutParams(200,240);
image_view.setLayoutParams(image_params);
card.addView(image_view);
TextView name_view = new TextView(MainActivity.this);
ViewGroup.LayoutParams textparams = new ViewGroup.LayoutParams(200,60);
name_view.setLayoutParams(textparams);
name_view.setGravity(Gravity.CENTER);
name_view.setText(name);
card.addView(name_view);
hlayout.addView(card);
}
}
但在 logcat 中,我看到 MainActivity 的以下行中存在 NullPointerException 并导致应用程序崩溃:(第 89 行)
AppController.getInstance().addToRequestQueue(req);
logcat 错误详细信息如下:
09-30 22:03:07.384 1458-1819/? E/PhoneInterfaceManager: sendRequest 16 timeout!
09-30 22:03:08.014 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:11.024 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:12.384 1458-1819/? E/PhoneInterfaceManager: sendRequest 16 timeout!
09-30 22:03:14.044 1716-1716/? E/wpa_supplicant: RSSI=-24;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:17.054 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:17.384 1458-1819/? E/PhoneInterfaceManager: sendRequest 16 timeout!
09-30 22:03:20.074 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:21.654 1177-1255/? E/SmartHeartBeat: HeartBeatNetwork:sendData failed
09-30 22:03:21.664 8426-8567/? E/ActivityThread: Failed to find provider info for com.huawei.android.hicloud.loginProvider
09-30 22:03:21.804 1177-1255/? E/SmartHeartBeat: HeartBeatNetwork:sendData failed
09-30 22:03:21.844 8426-8567/? E/ActivityThread: Failed to find provider info for com.huawei.android.hicloud.loginProvider
09-30 22:03:22.374 1458-1819/? E/PhoneInterfaceManager: sendRequest 16 timeout!
09-30 22:03:23.084 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:23.234 2024-2024/? E/HwSystemManager: AppCleanUpService:msg is 1
09-30 22:03:23.684 1497-1497/? E/HwLauncher: Launcher dialog dismiss failed : java.lang.IllegalArgumentException: no dialog with id 1 was ever shown via Activity#showDialog
09-30 22:03:23.844 3044-3044/? E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:23.844 3044-3044/? E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:23.844 3044-3044/? E/dalvikvm: Could not find class 'android.media.session.MediaController', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:23.844 3044-3044/? E/dalvikvm: Could not find class 'android.widget.Toolbar', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:23.864 3044-3044/? E/dalvikvm: Could not find class 'android.app.ActivityManager$TaskDescription', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:23.874 3044-3044/? E/dalvikvm: Could not find class 'android.app.SharedElementCallback', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:23.874 3044-3044/? E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:23.884 3044-3044/? E/dalvikvm: Could not find class 'android.app.SharedElementCallback', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:23.904 3044-3044/? E/dalvikvm: Could not find class 'android.app.assist.AssistContent', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:23.904 3044-3044/? E/dalvikvm: Could not find class 'android.view.SearchEvent', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:23.914 3044-3044/? E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:24.184 3044-3044/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: ir.naserpour.ketabsara, PID: 3044
java.lang.RuntimeException: Unable to start activity ComponentInfo{ir.naserpour.ketabsara/ir.naserpour.ketabsara.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2275)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.access$1100(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1238)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5352)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:863)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at ir.naserpour.ketabsara.MainActivity.onCreate(MainActivity.java:89)
at android.app.Activity.performCreate(Activity.java:5280)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2239)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.access$1100(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1238)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5352)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:863)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
at dalvik.system.NativeStart.main(Native Method)
09-30 22:03:24.564 1602-1602/? E/NetworkScheduler.SR: Invalid parameter app
09-30 22:03:24.564 1602-1602/? E/NetworkScheduler.SR: Invalid package name : Perhaps you didn't include a PendingIntent in the extras?
09-30 22:03:24.634 2528-3702/? E/Drive.UninstallOperation: Package still installed ir.naserpour.ketabsara
09-30 22:03:24.844 2024-2024/? E/HwSystemManager: AppCleanUpService:msg is 0
09-30 22:03:24.964 2528-3188/? E/IntentOperationSvc: Failed to instantiate Chimera operation impl, dropping operation
09-30 22:03:25.074 5100-5100/? E/Finsky: [1] com.google.android.finsky.wear.bo.a(838): onConnectionFailed: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null, message=null}
09-30 22:03:25.704 1602-1602/? E/NetworkScheduler.SR: Invalid parameter app
09-30 22:03:25.704 1602-1602/? E/NetworkScheduler.SR: Invalid package name : Perhaps you didn't include a PendingIntent in the extras?
09-30 22:03:26.094 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:27.384 1458-1819/? E/PhoneInterfaceManager: sendRequest 16 timeout!
09-30 22:03:29.094 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:30.494 249-994/? E/CommandListener: readDefRoute call readDefRoute
[ 09-30 22:03:30.494 249: 994 E/ ]
isWifiDefaultRouteExisted /system/bin/ip route
09-30 22:03:30.534 1177-1260/? E/InputDispatcher: channel '423bb8d8 ir.naserpour.ketabsara/ir.naserpour.ketabsara.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
09-30 22:03:31.514 249-994/? E/CommandListener: readDefRoute Rsp ok
09-30 22:03:31.514 1177-1177/? E/NetdConnector: NDC Command {218 route readDefRoute} took too long (1013ms)
09-30 22:03:32.114 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:32.384 1458-1819/? E/PhoneInterfaceManager: sendRequest 16 timeout!
09-30 22:03:35.124 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:37.014 1497-1497/? E/HwLauncher: Launcher dialog dismiss failed : java.lang.IllegalArgumentException: no dialog with id 1 was ever shown via Activity#showDialog
09-30 22:03:37.044 3633-3633/? E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:37.044 3633-3633/? E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:37.044 3633-3633/? E/dalvikvm: Could not find class 'android.media.session.MediaController', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:37.044 3633-3633/? E/dalvikvm: Could not find class 'android.widget.Toolbar', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:37.054 3633-3633/? E/dalvikvm: Could not find class 'android.app.ActivityManager$TaskDescription', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:37.054 3633-3633/? E/dalvikvm: Could not find class 'android.app.SharedElementCallback', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:37.054 3633-3633/? E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:37.064 3633-3633/? E/dalvikvm: Could not find class 'android.app.SharedElementCallback', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:37.074 3633-3633/? E/dalvikvm: Could not find class 'android.app.assist.AssistContent', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:37.074 3633-3633/? E/dalvikvm: Could not find class 'android.view.SearchEvent', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:37.084 3633-3633/? E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method ir.naserpour.ketabsara.MainActivity.access$super
09-30 22:03:37.354 3633-3633/ir.naserpour.ketabsara E/AndroidRuntime: FATAL EXCEPTION: main
Process: ir.naserpour.ketabsara, PID: 3633
java.lang.RuntimeException: Unable to start activity ComponentInfo{ir.naserpour.ketabsara/ir.naserpour.ketabsara.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2275)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.access$1100(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1238)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5352)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:863)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at ir.naserpour.ketabsara.MainActivity.onCreate(MainActivity.java:89)
at android.app.Activity.performCreate(Activity.java:5280)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2239)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.access$1100(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1238)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5352)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:863)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
at dalvik.system.NativeStart.main(Native Method)
09-30 22:03:37.374 1458-1819/? E/PhoneInterfaceManager: sendRequest 16 timeout!
09-30 22:03:38.144 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:41.154 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:42.374 1458-1819/? E/PhoneInterfaceManager: sendRequest 16 timeout!
09-30 22:03:43.184 1326-1326/? E/StatusBar.BatteryController: BatteryController receive ACTION_BATTERY_CHANGED; Battery level = 100; Battery scale = 100
09-30 22:03:43.204 2024-2243/? E/HwSystemManager: BgPowerManagerService: conusmPower = 0 result = 0 flag1 =false flag2 = false
09-30 22:03:44.174 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:46.924 1177-1192/? E/WindowManager: Starting window AppWindowToken{4277aa00 token=Token{42292a40 ActivityRecord{41fbdea0 u0 ir.naserpour.ketabsara/.MainActivity t32}}} timed out
09-30 22:03:47.184 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:47.384 1458-1819/? E/PhoneInterfaceManager: sendRequest 16 timeout!
09-30 22:03:50.204 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:52.384 1458-1819/? E/PhoneInterfaceManager: sendRequest 16 timeout!
09-30 22:03:53.214 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:56.234 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:03:57.384 1458-1819/? E/PhoneInterfaceManager: sendRequest 16 timeout!
09-30 22:03:59.254 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:04:01.514 249-994/? E/CommandListener: readDefRoute call readDefRoute
[ 09-30 22:04:01.514 249: 994 E/ ]
isWifiDefaultRouteExisted /system/bin/ip route
09-30 22:04:02.264 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:04:02.384 1458-1819/? E/PhoneInterfaceManager: sendRequest 16 timeout!
[ 09-30 22:04:02.514 249: 994 D/ ]
RouteDetect line= default via 192.168.1.1 dev wlan0
[ 09-30 22:04:02.514 249: 994 D/ ]
ret is 0
09-30 22:04:02.514 249-994/? E/CommandListener: readDefRoute Rsp ok
09-30 22:04:02.514 1177-1177/? E/NetdConnector: NDC Command {219 route readDefRoute} took too long (1006ms)
09-30 22:04:05.284 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
09-30 22:04:07.384 1458-1819/? E/PhoneInterfaceManager: sendRequest 16 timeout!
09-30 22:04:08.294 1716-1716/? E/wpa_supplicant: RSSI=-25;LINKSPEED=150;NOISE=9999;FREQUENCY=2462;
最佳答案
您将收到 NullPointerException
,因为当您调用 getInstance()
时,mInstance 为 null
。
您是否在 list 中注册了应用程序文件?
关于java - 使用volley库的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39797326/
我目前正在测试 Volley 库。但是当请求失败 (404) 时,它不会再次执行,或者至少没有错误。但是缺少数据。如果请求失败,这是重试请求的正确方法吗? 提前致谢 req.setRetryPolic
我是新来从事Volley和缓存工作的:P。尽管我已经看过许多与Volley进行图像缓存有关的文章和帖子,但是我仍然不清楚采用Volley进行图像缓存的最佳/首选方式。像磁盘缓存还是内存? Volley
我想使用 Volley 从我的 Android 应用发送请求。 我已经把它包含在 build.gradle 中了 dependencies { ... compile 'com.andr
我的目标是从另一个类调用 Volley,这是一种非常简洁、模块化的方式,即: VolleyListener newListener = new VolleyListener()
我的代码是: class MyService extends Service{ public void onCreate(){ new ImageLoader(mReque
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 4年前关闭。 Improve thi
我需要帮助来解决 Volley 库错误。我已使用 nodejs api 向服务器发送一些凭据以进行用户注册。在成功的情况下,当我的所有凭据对于创建新用户帐户都是唯一的时,它会向我显示所有响应等的所有内
我正在尝试完善我的应用程序中的错误处理,但我找不到 Volley 触发某些错误的集中位置以及原因。例如,我想知道如果我的请求的状态代码是 500 或更大,它肯定会触发 ServerError,但我似乎
当我在调试器中运行该方法时,数据按预期显示,但是每当我尝试使用它执行任何操作时,parentObject 的值都会返回为 null。 我只是想从服务器获取响应并将其存储为 JSONObject 以便在
我正在使用 Android Volley 缓存请求,这在我使用 GET 时工作正常,但由于某些原因我改用 POST。现在我想用不同的 POST 数据缓存相同的 URL。 请求 1 -> URL1,PO
我的情况是使用 Android-volley至 POST我的 json 对象,我可以成功发布所有内容,我的数据在服务器中可见,但服务器响应为 String不像 json ,这就是出现错误的原因。 co
我正在使用 volley 从 REST api 解析电影详细信息,并将解析的数据保存在名为 detailsMovies 的对象数组列表中。但是我无法在 onResponse 方法之外访问 ArrayL
我想知道如何解决这个问题。已完成代码的研究和替换,但问题仍然存在。 这是我使用 volley 的代码。 private void Regist(){ loading.setVisibility
如何创建一个单独的类,在其中定义所有关于 volley在另一个 Activity 中,我们直接传递 URL、CONTEXT 和 Get Response... 最佳答案 首先在Activity中创建回
我正在使用 volley 库并以 XML 格式获取响应。我想知道我们如何使用/volley 库解析响应。谢谢。 最佳答案 StringRequest req = new StringReque
当我在android studio中搜索 Volley 时,同时获取com.mcxiaoke.volley:library:1.0.19和com.mcxiaoke.volley:library-aar
我是 volley 和 android 的新手,我已经用 gradle 安装了 volley 并做了与官方教程相同的操作。但是没有响应,这意味着 Errorlistener 和 Responselis
当我在 Volley 中发出请求时,我收到 com.android.volley.ServerError 和响应代码 400。 我正在做这样的事情(通用示例代码): final String para
我引用了http://www.androidhive.info/2016/02/android-push-notifications-using-gcm-php-mysql-realtime-chat
当我将以下行添加到依赖项的 build.gradle 行时,Android Studio 显示此错误消息:compile 'com.android.volley:volley:1.0.0' apply
我是一名优秀的程序员,十分优秀!