ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Mobile Application Development
    EC-333
    Progress0 / 33 topics
    Topics
    1. Mobiles Application Development Platform2. HTML5 for Mobiles3. Android OS: Architecture, Framework and Application Development4. iOS: Architecture, Framework5. Application Development with Windows Mobile6. Eclipse7. Fragments8. Calling Built-in Applications using Intents9. Displaying Notifications10. Components of a Screen11. Adapting to Display Orientation12. Managing Changes to Screen Orientation13. Utilizing the Action Bar14. Creating the User Interface15. Listening for UI Notifications16. Views17. User Preferences18. Persisting & Sharing Data19. Sending SMS Messages20. Getting Feedback21. Sending E-mail22. Displaying Maps23. Consuming Web Services Using HTTP24. Web Services: Accessing and Creating25. Threading26. Publishing Android Applications27. Deployment on App Stores28. Mobile Programming Languages29. Challenges with Mobility and Wireless Communication30. Location-aware Applications31. Performance/Power Tradeoffs32. Mobile Platform Constraints33. Emerging Technologies
    EC-333›Getting Feedback
    Mobile Application DevelopmentTopic 20 of 33

    Getting Feedback

    7 minread
    1,121words
    Intermediatelevel

    Getting Feedback in Android

    Getting feedback from users is an essential part of creating an interactive and user-friendly Android application. Feedback can help improve the user experience, monitor app performance, and guide users in achieving their goals. Feedback can be collected in various ways in Android apps, including through visual cues, touch gestures, sound, and direct input from the user.

    There are different types of feedback you might consider providing to users, such as:

    1. Visual Feedback
    2. Audio Feedback
    3. Haptic Feedback
    4. User Input Feedback (Forms, Ratings, Surveys)
    5. Error and Success Messages

    Let's go through each one.


    1. Visual Feedback

    Visual feedback refers to providing information to users through graphical elements such as icons, text, or animation to indicate the status of an action. This kind of feedback helps users understand what's happening in the app without needing further explanation.

    A. Progress Indicators

    Progress indicators are used when an action takes time to complete. They can be either indeterminate (when the app doesn't know how long the process will take) or determinate (when the app knows the expected completion time).

    • ProgressBar (Determinate):
    ProgressBar progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
    progressBar.setMax(100);
    progressBar.setProgress(50);  // Update progress
    setContentView(progressBar);
    
    • ProgressBar (Indeterminate):
    ProgressBar progressBar = new ProgressBar(this);
    setContentView(progressBar);
    

    These visual indicators give users feedback that an operation is happening, and the progress or result will follow soon.

    B. Toast Messages

    Toast messages are simple notifications that appear briefly on the screen to give users feedback. These are commonly used for short notifications such as "Saved Successfully" or "Error".

    Toast.makeText(getApplicationContext(), "Data saved!", Toast.LENGTH_SHORT).show();
    

    C. Snackbar

    Snackbar is a more flexible version of a Toast and can be used for actions like undoing a recent change, confirming actions, or showing longer messages. Unlike Toast, Snackbar allows for user interaction.

    Snackbar.make(view, "Item deleted", Snackbar.LENGTH_LONG)
            .setAction("Undo", new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    // Handle the undo action
                }
            })
            .show();
    

    2. Audio Feedback

    Audio feedback provides an audible response to the user’s actions, such as a sound when a button is clicked or a notification is received. It's often used in situations where visual feedback may be less noticeable or when the app is running in the background.

    A. Playing a Sound

    To play a simple sound in response to user actions:

    MediaPlayer mediaPlayer = MediaPlayer.create(this, R.raw.sound_file);
    mediaPlayer.start();  // Play sound
    

    You can place sound files (like .mp3 or .ogg) in the res/raw directory.

    B. Vibration Feedback

    While vibration is not exactly audio, it’s another form of feedback that is often used in conjunction with audio. Vibration gives users physical feedback, for example, when a button is pressed.

    Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
    if (vibrator != null) {
        vibrator.vibrate(500);  // Vibrate for 500 milliseconds
    }
    

    Ensure you request the appropriate permissions in the manifest if your app uses vibration:

    <uses-permission android:name="android.permission.VIBRATE" />
    

    3. Haptic Feedback

    Haptic feedback provides physical sensations (like a vibration or touch feedback) to the user. It is often used to reinforce interactions, like button presses or touch gestures, and improve the user experience.

    A. Using Haptic Feedback for Button Presses

    You can trigger haptic feedback on touch interactions, for example, when the user clicks a button:

    Button button = findViewById(R.id.my_button);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // Give haptic feedback when button is pressed
            v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
        }
    });
    

    This will produce a slight vibration when the user interacts with the button.


    4. User Input Feedback (Forms, Ratings, Surveys)

    User input feedback involves directly asking users for their opinion, typically through forms, surveys, or ratings. This kind of feedback is essential for understanding how users feel about the app and can guide future updates and improvements.

    A. User Rating Prompt

    A simple and effective way to gather user feedback is by asking users to rate your app. Android provides a built-in method to prompt users to rate your app directly in the Google Play Store.

    AppRate.with(this)
        .setInstallDays(0)  // Number of days after which the prompt is shown
        .setLaunchTimes(3)  // Number of times the app has been launched before showing the prompt
        .setRemindInterval(2)  // Interval (in days) to show the prompt again if declined
        .monitor();
    AppRate.showRateDialogIfNeeded(this);
    

    B. Feedback Form via Dialogs

    Another way to collect feedback is by using dialog boxes, where users can provide textual feedback. You can create a custom dialog to collect input:

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("We value your feedback!")
           .setMessage("Please leave your comments.")
           .setView(inputField)  // EditText for feedback input
           .setPositiveButton("Submit", new DialogInterface.OnClickListener() {
               @Override
               public void onClick(DialogInterface dialog, int which) {
                   String feedback = inputField.getText().toString();
                   // Handle feedback submission (send to server or store locally)
               }
           })
           .setNegativeButton("Cancel", null)
           .show();
    

    This dialog can contain an EditText field for users to write their feedback, which you can then process and store or send to a server.

    C. Survey

    For more structured feedback, you can use tools like Google Forms or SurveyMonkey to create surveys and embed them in your app via an Intent to open a web browser.

    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.surveyformlink.com"));
    startActivity(intent);
    

    5. Error and Success Messages

    Feedback is crucial when something goes wrong or when an action is successfully completed. Error messages should be clear, actionable, and informative.

    A. Error Feedback

    When something goes wrong, it's important to provide clear feedback to the user:

    Toast.makeText(this, "Error: Unable to complete the action", Toast.LENGTH_SHORT).show();
    

    You can also use AlertDialog to show a more detailed error message:

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Error")
           .setMessage("Something went wrong. Please try again later.")
           .setPositiveButton("OK", null)
           .show();
    

    B. Success Feedback

    For successful actions, providing a Toast, Snackbar, or Dialog can be useful:

    Toast.makeText(this, "Action completed successfully!", Toast.LENGTH_SHORT).show();
    

    You can also use Snackbar for more interactive success messages:

    Snackbar.make(view, "Data saved successfully", Snackbar.LENGTH_LONG)
            .setAction("Undo", new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    // Undo the action
                }
            })
            .show();
    

    6. Conclusion

    Getting feedback in Android can be achieved through various methods such as visual feedback (using progress bars, Toast, or Snackbar), audio feedback (playing sounds), haptic feedback (vibrations), and direct user input (forms or surveys). Proper feedback not only enhances user experience but also helps guide users in their interactions with your app.

    By integrating feedback mechanisms into your app, you provide a more responsive, intuitive, and user-friendly experience that can also help you improve the app based on real user insights.

    Previous topic 19
    Sending SMS Messages
    Next topic 21
    Sending E-mail

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time7 min
      Word count1,121
      Code examples0
      DifficultyIntermediate