This is code:
@Override
protected DVLAInformation doInBackground(String... params) {
try {
Intent intent = getIntent();
String dvlaNumFin = intent.getStringExtra("dvlaNumber");
final URL url = new URL("https://dvlasearch.appspot.com/DvlaSearch?licencePlate=" + dvlaNumFin + "&apikey=");
HttpURLCoection coection = (HttpURLCoection) url.openCoection();
coection.setRequestMethod("GET");
coection.setRequestProperty("USER-AGENT", "Mozilla/5.0");
coection.setRequestProperty("ACCEPT-LANGUAGE", "en-US,en;0.5");
BufferedReader br = new BufferedReader(new InputStreamReader(coection.getInputStream()));
String line;
StringBuilder responseOutput = new StringBuilder();
while ((line = br.readLine()) != null) {
responseOutput.append(line);
}
br.close();
DVLAInformation obj = new DVLAInformation(url.toString());
obj.readAndParseJSON(responseOutput.toString());
retu obj;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
retu null;
}
My question is how to retu object from two JSON URL in same activity
For example is I will have two urls
final URL url = new URL("https://dvlasearch.appspot.com/DvlaSearch?licencePlate=" + dvlaNumFin + "&apikey=DvlaSearchDemoAccount");
HttpURLCoection coection = (HttpURLCoection) url.openCoection();
final URL url2 = new URL("https://dvlasearch.appspot.com/MotHistory?licencePlate=mt09nks&apikey=DvlaSearchDemoAccount");
HttpURLCoection coection = (HttpURLCoection) url.openCoection();
And I do not know how to retu something like this:
DVLAInformation obj = new DVLAInformation(url.toString());
obj.readAndParseJSON(responseOutput.toString());
DVLAInformation obj2 = new DVLAInformation(url2.toString());
obj2.readAndParseJSON(responseOutput.toString());
retu obj, obj2
Sorry for my explanation, I know the way is incorrect, I just try to explain what I would like to do.
