Coder Social home page Coder Social logo

simplewebapi's People

Contributors

obaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

simplewebapi's Issues

There was an Error

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
}

The Code is not working

I neither get a response nor do I get any progressBar movement.

package com.example.shreyanshu.sample;

import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
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;
TextView responseView;
ProgressBar progressBar;

static final String API_KEY = "key added";
static final String API_URL = " https://api.fullcontact.com/v2/person.json?";

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

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

    Button queryButton = (Button) findViewById(R.id.queryButton);
    queryButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View view) {
            new RetrieveFeedTask().execute();
        }
    });
}

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

    private Exception exception;
    String email;
    public RetrieveFeedTask() {
        this.email = emailText.getText().toString();
    }

    protected void OnPreExecute() {
        progressBar.setVisibility(View.VISIBLE);
        responseView.setText("About to start");
    }

    protected String doInBackground(Void...urls) {

        try {
            URL url = new URL(API_URL + "email=" + email + "&apiKey=" + API_KEY);
            Log.e("URL", url.toString());
            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  onPostExcecute(String response) {

        if (response == null) {
            response = "There was an ERROR";
        }
        progressBar.setVisibility(View.GONE);
        Log.e("INFO", response);
        responseView.setText(response);
    }
}

}

No license - I would like to use your code

Obaro,
Would you consider adding a license to your code such as MIT license to allow others to use it? That would also probably get more credit for you when people do use your code. There's a short explanation of how to do that here, https://github.com/blog/1530-choosing-an-open-source-license

In particular, I am interested in using part of your SimpleWebAPI as starter code for an Android app and possibly in a YouTube video, but need a license to use it.
Many thanks,
Joe James

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.