Coder Social home page Coder Social logo

There was an Error about simplewebapi HOT 6 OPEN

obaro avatar obaro commented on July 21, 2024
There was an Error

from simplewebapi.

Comments (6)

obaro avatar obaro commented on July 21, 2024

Hi SameerKhan,

What API are you calling?

Send sample code, and I'll assist if I can

On Sat, Oct 15, 2016 at 2:36 PM, SameerKhan1406 [email protected]
wrote:

I am passing two values instead one and using my api url since it accepts
two parameter.

Just tell me how to api which i created i have my url and it accepts two
parameter and return response in Json which i want to print
{
Status=1
message"dewegow523yrinc" any random everytime i am calling
}


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#2, or mute the thread
https://github.com/notifications/unsubscribe-auth/ADxkCnz1mhc-j0QPf_ieOqFG8Ns-KLz5ks5q0NbRgaJpZM4KXtVc
.

From,
Obaro

from simplewebapi.

SameerKhan1406 avatar SameerKhan1406 commented on July 21, 2024

Thank you for asking. I am terrified since Saturday and i am beginner in android
Please resolve this
Find below detail for API :

URL : http://192.168.0.19/monika/slim_prj/public/code

Request Parameter (in POST)

  • mac_address
  • key

Response (in JSON) -

{
"status": 1,
"message": "qYNoQBImXRhOMety"
}

from simplewebapi.

SameerKhan1406 avatar SameerKhan1406 commented on July 21, 2024

Have you started working on how to do this thing?

from simplewebapi.

SameerKhan1406 avatar SameerKhan1406 commented on July 21, 2024

`This is my code``
package com.medmainfomatix.myapplication1;

import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class MainActivity extends AppCompatActivity {

EditText emailText;
EditText emailText1;
TextView responseView;
ProgressBar progressBar;

static final String API_URL = "http://192.168.0.19/monika/slim_prj/public/code/";

@OverRide
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

responseView = (TextView) findViewById(R.id.responseView);
emailText = (EditText) findViewById(R.id.emailText);
emailText1= (EditText) findViewById(R.id.emailText1);

progressBar = (ProgressBar) findViewById(R.id.progressBar);

Button queryButton = (Button) findViewById(R.id.queryButton);
queryButton.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View v) {
new RetrieveFeedTask().execute();
}
});
}

class RetrieveFeedTask extends AsyncTask<Void, Void, String> {

private Exception exception;
String mac_address = emailText.getText().toString();
String key= emailText1.getText().toString();

protected void onPreExecute() {
progressBar.setVisibility(View.VISIBLE);
responseView.setText("");
}

protected String doInBackground(Void... urls) {

// Do some validation here

try {
URL url = new URL(API_URL + "mac_address=" + mac_address + "Key=" + key);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
StringBuilder stringBuilder = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line).append("\n");
}
bufferedReader.close();
return stringBuilder.toString();
}
finally{
urlConnection.disconnect();
}
}
catch(Exception e) {
Log.e("ERROR", e.getMessage(), e);
return null;
}
}

protected void onPostExecute(String response) {
if(response == null) {
response = "THERE WAS AN ERROR";
}
progressBar.setVisibility(View.GONE);
Log.i("INFO", response);
responseView.setText(response);
// TODO: check this.exception
// TODO: do something with the feed

// try {
// JSONObject object = (JSONObject) new JSONTokener(response).nextValue();
// String requestID = object.getString("requestId");
// int likelihood = object.getInt("likelihood");
// JSONArray photos = object.getJSONArray("photos");
// .
// .
// .
// .
// } catch (JSONException e) {
// e.printStackTrace();
// }
}
}
}

from simplewebapi.

obaro avatar obaro commented on July 21, 2024

How about you post on stackoverflow.
Your question and the solution would then be available to others who run into the same issue.

Let me know when you've made a post, so I'll answer it

from simplewebapi.

SameerKhan1406 avatar SameerKhan1406 commented on July 21, 2024

I already did that go to the link below :
http://stackoverflow.com/questions/40071964/android-i-need-to-call-web-api

from simplewebapi.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.