Android Survey


Source link: https://github.com/AndreiD/surveylib

Android Survey

Special thanks to https://github.com/howettl for his contribution.

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

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.

License

Copyright 2015 AndroidAdvance.com  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

Set of samples of views with slick interaction patterns and animations.

Material spinning favorite/star button.

TabbedCoordinatorLayout is a sample project demonstrating the usage of CoordinatorLayout paired with TabLayout.

Simple logger with support sections and json representation in the original form.

Lintrules is a Gradle plugin that allows bundling custom lint rules with AARs.

A new canvas drawing library for Android.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes