Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android Studio,从多个JSON URL';他在截击_Java_Android_Json_Android Volley - Fatal编程技术网

Java Android Studio,从多个JSON URL';他在截击

Java Android Studio,从多个JSON URL';他在截击,java,android,json,android-volley,Java,Android,Json,Android Volley,我在尝试从几个雅虎财经链接中提取股票数据时遇到了一个问题。基本上,我想得到至少4股票在同一时间使用截击方法,这意味着使用4个不同的网址在同一时间。在这个例子中,我试图一次至少得到两样东西,所以 及 但我只是不知道怎么做,而且我收到了一些在队列中创建(添加)新请求的提示,但我已经尝试过了,它就是不起作用,或者可能我不知道如何正确地做。有人能帮忙吗? 我正在为此使用LiveRatesActivity、CustomJSONObjectRequest和CustomVolleyRequestQueue活动

我在尝试从几个雅虎财经链接中提取股票数据时遇到了一个问题。基本上,我想得到至少4股票在同一时间使用截击方法,这意味着使用4个不同的网址在同一时间。在这个例子中,我试图一次至少得到两样东西,所以

但我只是不知道怎么做,而且我收到了一些在队列中创建(添加)新请求的提示,但我已经尝试过了,它就是不起作用,或者可能我不知道如何正确地做。有人能帮忙吗? 我正在为此使用
LiveRatesActivity
CustomJSONObjectRequest
CustomVolleyRequestQueue
活动

主要活动代码:

public class LiveRatesActivity extends AppCompatActivity implements Response.Listener,
    Response.ErrorListener {
public static final String REQUEST_TAG = "LiveRatesActivity";
private TextView LastTradePriceOnlyText;
private TextView SymbolText;
private TextView NameText;
private Button GetRates;
private RequestQueue mQueue;

public static final String REQUEST_TAG2 = "LiveRatesActivity";
private TextView LastTradePriceOnlyText2;
private TextView SymbolText2;
private TextView NameText2;
private TextView ChangeText2;
private TextView PercentageChangeText2;
private TextView DaysLowText2;
private TextView DaysHighText2;
private TextView AvgVolumeText2;
private TextView PERatioText2;
private TextView MarketCapText2;
private RequestQueue nQueue;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_live_rates);

    LastTradePriceOnlyText = (TextView) findViewById(R.id.ResultsTextView);
    SymbolText = (TextView) findViewById(R.id.SymbolTextView);
    NameText = (TextView) findViewById(R.id.NameTextView);
    LastTradePriceOnlyText2 = (TextView) findViewById(R.id.ResultsTextView2);
    SymbolText2 = (TextView) findViewById(R.id.SymbolTextView2);
    NameText2 = (TextView) findViewById(R.id.NameTextView2);
    ChangeText2 = (TextView) findViewById(R.id.ChangeTextView2);
    PercentageChangeText2 = (TextView) findViewById(R.id.PercentageChangeTextView2);
    DaysLowText2 = (TextView) findViewById(R.id.DaysLowTextView2);
    DaysHighText2 = (TextView) findViewById(R.id.DaysHighTextView2);
    AvgVolumeText2 = (TextView) findViewById(R.id.AvgVolumeTextView2);
    PERatioText2 = (TextView) findViewById(R.id.PERatioTextView2);
    MarketCapText2 = (TextView) findViewById(R.id.MarketCapTextView2);
    GetRates = (Button) findViewById(R.id.Sentbutton);

    ImageButton bSettingsBlack = (ImageButton) findViewById(R.id.ibSettingsBlack);
    ImageButton bEconCalBlack = (ImageButton) findViewById(R.id.ibEconCalBlack);
    ImageButton bNewsBlack = (ImageButton) findViewById(R.id.ibNewsBlack);

    bSettingsBlack.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            startActivity(new Intent(LiveRatesActivity.this, SettingsActivity.class));
        }
    });
    bEconCalBlack.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            startActivity(new Intent(LiveRatesActivity.this, WebViewActivity.class));
        }
    });
    bNewsBlack.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            startActivity(new Intent(LiveRatesActivity.this, HomePageNews.class));
        }
    });
}



@Override
protected void onStart() {
    super.onStart();

    mQueue = CustomVolleyRequestQueue.getInstance(this.getApplicationContext())
            .getRequestQueue();
    String url = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22FB%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=";//"http://httpbin.org/get?site=code&network=tutsplus";
    final CustomJSONObjectRequest jsonRequest = new CustomJSONObjectRequest(Request.Method.GET, url, new JSONObject(), this, this);
    jsonRequest.setTag(REQUEST_TAG);

    nQueue = CustomVolleyRequestQueue.getInstance(this.getApplicationContext())
            .getRequestQueue();
    String url2 = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22YHOO%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=";//"http://httpbin.org/get?site=code&network=tutsplus";
    final CustomJSONObjectRequest jsonRequest2 = new CustomJSONObjectRequest(Request.Method.GET, url, new JSONObject(), this, this);
    jsonRequest2.setTag(REQUEST_TAG2);

    GetRates.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mQueue.add(jsonRequest);
            nQueue.add(jsonRequest2);
        }
    });
}

@Override
protected void onStop() {
    super.onStop();
    if (mQueue != null) {
        mQueue.cancelAll(REQUEST_TAG);
    }
    else if (nQueue !=null) {
        nQueue.cancelAll(REQUEST_TAG2);
    }
}

@Override
public void onErrorResponse(VolleyError error) {
    LastTradePriceOnlyText.setText(error.getMessage());
    LastTradePriceOnlyText2.setText(error.getMessage());
}

@Override
public void onResponse(Object response) {
    LastTradePriceOnlyText.setText("Response is: " + response);
    try {
        JSONObject response2 = ((JSONObject) response).getJSONObject("query");
        response2 = ((JSONObject) response2).getJSONObject("results");
        response2 = ((JSONObject) response2).getJSONObject("quote");
        String displayed_Text = ((JSONObject) response2).getString("LastTradePriceOnly");
        LastTradePriceOnlyText.setText(displayed_Text);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    {
        SymbolText.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("symbol");
            SymbolText.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        NameText.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("Name");
            NameText.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        NameText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("Name");
            NameText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        SymbolText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("symbol");
            SymbolText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        LastTradePriceOnlyText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("LastTradePriceOnly");
            LastTradePriceOnlyText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        ChangeText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("Change");
            ChangeText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        PercentageChangeText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("PercentChange");
            PercentageChangeText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        DaysHighText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("DaysHigh");
            DaysHighText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        DaysLowText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("DaysLow");
            DaysLowText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        AvgVolumeText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("AverageDailyVolume");
            AvgVolumeText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        PERatioText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("PERatio");
            PERatioText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        MarketCapText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("MarketCapitalization");
            MarketCapText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
}

public void NotificationPageRequest(View view) {
    Intent intent = new Intent(this, LiveRatesActivity.class);
    startActivity(intent);
}
}
public class CustomVolleyRequestQueue {

private static CustomVolleyRequestQueue mInstance;
private static Context mCtx;
private RequestQueue mRequestQueue;

private CustomVolleyRequestQueue(Context context) {
    mCtx = context;
    mRequestQueue = getRequestQueue();
}


public static CustomVolleyRequestQueue getInstance(Context context) {
    if (mInstance == null) {
        mInstance = new CustomVolleyRequestQueue(context);
    }
    return mInstance;
}


public RequestQueue getRequestQueue() {
    if (mRequestQueue == null) {
        Cache cache = new DiskBasedCache(mCtx.getCacheDir(), 10 * 1024 * 1024);
        Network network = new BasicNetwork(new HurlStack());
        mRequestQueue = new RequestQueue(cache, network);

        mRequestQueue.start();
    }
    return mRequestQueue;

}   
}
和请求队列活动:

public class LiveRatesActivity extends AppCompatActivity implements Response.Listener,
    Response.ErrorListener {
public static final String REQUEST_TAG = "LiveRatesActivity";
private TextView LastTradePriceOnlyText;
private TextView SymbolText;
private TextView NameText;
private Button GetRates;
private RequestQueue mQueue;

public static final String REQUEST_TAG2 = "LiveRatesActivity";
private TextView LastTradePriceOnlyText2;
private TextView SymbolText2;
private TextView NameText2;
private TextView ChangeText2;
private TextView PercentageChangeText2;
private TextView DaysLowText2;
private TextView DaysHighText2;
private TextView AvgVolumeText2;
private TextView PERatioText2;
private TextView MarketCapText2;
private RequestQueue nQueue;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_live_rates);

    LastTradePriceOnlyText = (TextView) findViewById(R.id.ResultsTextView);
    SymbolText = (TextView) findViewById(R.id.SymbolTextView);
    NameText = (TextView) findViewById(R.id.NameTextView);
    LastTradePriceOnlyText2 = (TextView) findViewById(R.id.ResultsTextView2);
    SymbolText2 = (TextView) findViewById(R.id.SymbolTextView2);
    NameText2 = (TextView) findViewById(R.id.NameTextView2);
    ChangeText2 = (TextView) findViewById(R.id.ChangeTextView2);
    PercentageChangeText2 = (TextView) findViewById(R.id.PercentageChangeTextView2);
    DaysLowText2 = (TextView) findViewById(R.id.DaysLowTextView2);
    DaysHighText2 = (TextView) findViewById(R.id.DaysHighTextView2);
    AvgVolumeText2 = (TextView) findViewById(R.id.AvgVolumeTextView2);
    PERatioText2 = (TextView) findViewById(R.id.PERatioTextView2);
    MarketCapText2 = (TextView) findViewById(R.id.MarketCapTextView2);
    GetRates = (Button) findViewById(R.id.Sentbutton);

    ImageButton bSettingsBlack = (ImageButton) findViewById(R.id.ibSettingsBlack);
    ImageButton bEconCalBlack = (ImageButton) findViewById(R.id.ibEconCalBlack);
    ImageButton bNewsBlack = (ImageButton) findViewById(R.id.ibNewsBlack);

    bSettingsBlack.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            startActivity(new Intent(LiveRatesActivity.this, SettingsActivity.class));
        }
    });
    bEconCalBlack.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            startActivity(new Intent(LiveRatesActivity.this, WebViewActivity.class));
        }
    });
    bNewsBlack.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            startActivity(new Intent(LiveRatesActivity.this, HomePageNews.class));
        }
    });
}



@Override
protected void onStart() {
    super.onStart();

    mQueue = CustomVolleyRequestQueue.getInstance(this.getApplicationContext())
            .getRequestQueue();
    String url = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22FB%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=";//"http://httpbin.org/get?site=code&network=tutsplus";
    final CustomJSONObjectRequest jsonRequest = new CustomJSONObjectRequest(Request.Method.GET, url, new JSONObject(), this, this);
    jsonRequest.setTag(REQUEST_TAG);

    nQueue = CustomVolleyRequestQueue.getInstance(this.getApplicationContext())
            .getRequestQueue();
    String url2 = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22YHOO%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=";//"http://httpbin.org/get?site=code&network=tutsplus";
    final CustomJSONObjectRequest jsonRequest2 = new CustomJSONObjectRequest(Request.Method.GET, url, new JSONObject(), this, this);
    jsonRequest2.setTag(REQUEST_TAG2);

    GetRates.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mQueue.add(jsonRequest);
            nQueue.add(jsonRequest2);
        }
    });
}

@Override
protected void onStop() {
    super.onStop();
    if (mQueue != null) {
        mQueue.cancelAll(REQUEST_TAG);
    }
    else if (nQueue !=null) {
        nQueue.cancelAll(REQUEST_TAG2);
    }
}

@Override
public void onErrorResponse(VolleyError error) {
    LastTradePriceOnlyText.setText(error.getMessage());
    LastTradePriceOnlyText2.setText(error.getMessage());
}

@Override
public void onResponse(Object response) {
    LastTradePriceOnlyText.setText("Response is: " + response);
    try {
        JSONObject response2 = ((JSONObject) response).getJSONObject("query");
        response2 = ((JSONObject) response2).getJSONObject("results");
        response2 = ((JSONObject) response2).getJSONObject("quote");
        String displayed_Text = ((JSONObject) response2).getString("LastTradePriceOnly");
        LastTradePriceOnlyText.setText(displayed_Text);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    {
        SymbolText.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("symbol");
            SymbolText.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        NameText.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("Name");
            NameText.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        NameText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("Name");
            NameText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        SymbolText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("symbol");
            SymbolText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        LastTradePriceOnlyText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("LastTradePriceOnly");
            LastTradePriceOnlyText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        ChangeText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("Change");
            ChangeText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        PercentageChangeText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("PercentChange");
            PercentageChangeText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        DaysHighText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("DaysHigh");
            DaysHighText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        DaysLowText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("DaysLow");
            DaysLowText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        AvgVolumeText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("AverageDailyVolume");
            AvgVolumeText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        PERatioText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("PERatio");
            PERatioText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    {
        MarketCapText2.setText("Response is: " + response);
        try {
            JSONObject response2 = ((JSONObject) response).getJSONObject("query");
            response2 = ((JSONObject) response2).getJSONObject("results");
            response2 = ((JSONObject) response2).getJSONObject("quote");
            String displayed_Text = ((JSONObject) response2).getString("MarketCapitalization");
            MarketCapText2.setText(displayed_Text);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
}

public void NotificationPageRequest(View view) {
    Intent intent = new Intent(this, LiveRatesActivity.class);
    startActivity(intent);
}
}
public class CustomVolleyRequestQueue {

private static CustomVolleyRequestQueue mInstance;
private static Context mCtx;
private RequestQueue mRequestQueue;

private CustomVolleyRequestQueue(Context context) {
    mCtx = context;
    mRequestQueue = getRequestQueue();
}


public static CustomVolleyRequestQueue getInstance(Context context) {
    if (mInstance == null) {
        mInstance = new CustomVolleyRequestQueue(context);
    }
    return mInstance;
}


public RequestQueue getRequestQueue() {
    if (mRequestQueue == null) {
        Cache cache = new DiskBasedCache(mCtx.getCacheDir(), 10 * 1024 * 1024);
        Network network = new BasicNetwork(new HurlStack());
        mRequestQueue = new RequestQueue(cache, network);

        mRequestQueue.start();
    }
    return mRequestQueue;

}   
}