Giter VIP home page Giter VIP logo

surveylib's Introduction

Android Survey

A simple to use, survey library for collecting feedback from your users.

alt text

Instalation:

compile 'com.androidadvance.surveylib:surveylib:0.0.1'

How to use it:

  1. Take a look at the example project
Step 1:

You will need: A json file with the questions. Check the assets folder to see 3 examples.

Step 2:

Call the class SurveyActivity and pass as an extra the json string.

        private static final int SURVEY_REQUEST = 1337;
        a_button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i_survey = new Intent(MainActivity.this, SurveyActivity.class);
                i_survey.putExtra("json_survey", loadSurveyJson("example_survey_1.json"));
                startActivityForResult(i_survey, SURVEY_REQUEST);
            }
        });

What is loadSurveyJson ? check this function.

Step 3:

The activity is started with a request code.

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == SURVEY_REQUEST) {
            if (resultCode == RESULT_OK) {

                String answers_json = data.getExtras().getString("answers");
                Log.d("****", "****************** WE HAVE ANSWERS ******************");
                Log.v("ANSWERS JSON", answers_json);
                Log.d("****", "*****************************************************");

                //do whatever you want with them...
            }
        }
    }
Last step:

Add this activity to your manifest file.

<activity android:name="com.androidadvance.androidsurvey.SurveyActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
            android:windowSoftInputMode="stateHidden"/>
The Json format of the Questions.

You have couple of question types: String, StringMultiline, Number, Radioboxes, Checkboxes. They can be "required" or not, the choices can be random. Check the examples, everything is simple to use.

Customizations
Colors

Use html codes in your json question title, choices. You can see a compiled list here

Define your material design colors in the style.

Not enough ? You have to do it yourself. Simplest way is to Fork this project and style, add, modify who you like.

More question types / Other Stuff

Fork this project

Troubleshooting

  1. Make sure you have the latest shit. At this moment: compileSdkVersion 23, targetSdkVersion 23, buildToolsVersion "23.0.1", compile 'com.android.support:appcompat-v7:23.1.0', compile 'com.android.support:design:23.1.0' etc.
  2. Feed a valid json! Otherwise you'll get errors.
  3. Check the sample project.

Updates, Questions, and Requests

Ping me here :)

TODO://

  • Offline mode storage.
  • Sync with server example.
  • Adding a sliding bar / stars question type
  • Waiting for your suggestions

You like this library ? Check my other projects.

If you use this library, please star this project.

surveylib's People

Contributors

andreid avatar

Watchers

Michael jentsch avatar  avatar

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.