Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
i am getting Throwing OutOfMemoryError while running all my applications. i get this error when i import a jar file "android-async-http-1.3.1.jar". the code i used for the application is as follows

Java
public void onClick(View v) {
				// TODO Auto-generated method stub
				String iGTIN=et.getText().toString();
				RequestParams params=new RequestParams();
				params.put("iGTIN", iGTIN);
				fetchSEcondary(params); 
			}
		});
		
	}

	public void fetchSEcondary(RequestParams params) {
		// TODO Auto-generated method stub
		AsyncHttpClient fetchSecond=new AsyncHttpClient();
		fetchSecond.put("http://pharmamax.solutionsmax.com/PackageMax.svc/FetchSecondaryNumber", params,new AsyncHttpResponseHandler(){
		
			public void onSuccess(String response){
				Toast.makeText(getApplicationContext(), response, Toast.LENGTH_SHORT).show();
			try{
				JSONObject obj3 = new JSONObject(response);
				JSONArray jsonArray3 = obj3.getJSONArray("FetchSecondaryNumberResult");
			    int length = jsonArray3.length();
			    if(length!=0)
			    {
			    	for(int i=0;i<length;i++)
			    	{
			    		JSONObject user = jsonArray3.getJSONObject(i);
			    		 //result=user3.getString("Res").toString();
			    		 number.setText(user.get("Res").toString());
			    	}
			     }
			     else
			     {
			    	 Toast.makeText(getApplicationContext(), "no data", Toast.LENGTH_LONG).show();
			     }
			}catch(JSONException e){
				Toast.makeText(getApplicationContext(), "Exception", Toast.LENGTH_LONG).show();
				//e.printStackTrace();
			}
			
			}
			
			public void onFailure(int statusCode, Throwable error,String content){
				 if(statusCode == 404){
                  Toast.makeText(getApplicationContext(), "Requested resource not found", Toast.LENGTH_LONG).show();
              } 
				 else if(statusCode == 500){
                  Toast.makeText(getApplicationContext(), "Something went wrong at server end", Toast.LENGTH_LONG).show();
              }
				 else{
                  Toast.makeText(getApplicationContext(), "Unexpected Error occcured! [Most common Error: Device might not be connected to Internet or remote server is not up and running]", Toast.LENGTH_LONG).show();
              }
			 }
		});


i am not able to find out what triggers this error. please help me to solve this
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900