CodePath Tech Fellows
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    ###### tags: `fbu` # Flixster FAQs Here's a list of useful notes you may find help save you time while developing the Flixster Movies App or running into problems. ## Extra Features :::spoiler **How do I use a custom launcher icon?** - To use a custom launcher icon for the app, you can first download any image from [IconFinder](https://www.iconfinder.com/). Within the Android project select `New → Image Asset` and browse to find the image file. You can use this tool which will generate the launcher icon specified for all drawable density folders. ::: :::spoiler **How do I add a "play icon" over an image?** - If you wish to add a play icon over an image, you can use a YouTube [play icon](https://www.youtube.com/yt/brand/downloads.html) and rely on RelativeLayout and [use width and height alignment](https://hackmd.io/@slavkoder/H1P5E7QHU#Using-Alignment-to-Control-Width-or-Height) against the trailer image to overlay it directly. If the user clicks on the trailer, you can launch another activity to play the video immediately using `loadVideo()`. For the detail page, you can simply use `cueVideo()` to show a preview. ::: :::spoiler **How do I round the corners on my images?** - For displaying rounded corners with Glide, you can apply a [bitmap transform](https://guides.codepath.org/android/Displaying-Images-with-the-Glide-Library#rounded-corners) as outlined. You can use glide-transformations and apply the transform before loading the image into the view ::: :::spoiler **How do I provide an alternate resource layout for landscape mode?** - To provide an alternate resource layout for landscape mode, you can [create an alternate layout file](http://guides.codepath.org/android/Understanding-App-Resources#creating-alternate-resources) through Android Studio that will be placed in a `res/layout-land` directory. You can also reuse any layouts using `<merge>` or `<include>` tags. ::: ### Troubleshooting :::spoiler **How do I scroll vertically on the Emulator?** - Scrolling vertically on the Android emulator is done via pushing down on the left mouse and dragging up as you would do to scroll with your finger on the device. ::: :::spoiler **How do I make the UI of the Flixster client?** - To make the UI of your Flixster client, switch to XML view of your activity layout and play around with different [attributes](http://guides.codepath.org/android/Defining-Views-and-their-Attributes). Read more about this in our [RelativeLayout guide](https://hackmd.io/@slavkoder/H1P5E7QHU#RelativeLayout). ::: :::spoiler **I'm having trouble loading/formatting images.** 1. Making the photo appear allows for experimentation with a few different properties. - First, check out the different [scale types](http://guides.codepath.org/android/Working-with-the-ImageView#scale-types) for the `ImageView` and make sure when setting `scaleType` to `fitXY` to also set `adjustViewBounds` to `true`. - When loading with Glide, experiment with different loading behaviors such as `.fitCenter()` or `.override(width, height)` specified before the `.into(...)` command. - If you want to determine the width of the screen, you can check the width of the layout item or use this [device dimensions helper](https://gist.github.com/nesquena/318b6930aac3a56f96a4) - In the adapter, you can calculate the aspect ratio of the image (`width / height`) and then set the `ImageView` width to screen width and the height to correct calculated height to maintain the aspect ratio of the image. ::: :::spoiler **Why does my app crash when I exit DetailActivity?** - If you are in landscape mode and your app crashes when you exit DetailActivity, it is probably because of differences in the layout file for item_movie.xml and layout-land/item_movie.xml. Check-in logcat to see which line is causing the crash, and then check your default (portrait) / landscape layout files to make sure that there are no discrepancies. ::: ::: spoiler **Why is my placeholder()/transformation() method not working?** - If you see that the `placeholder()` or `transformation()` methods doesn't exist for Glide, you are most likely using the v4 version. Double-check to see that you've followed the [setup instructions here](https://github.com/codepath/android_guides/wiki/Displaying-Images-with-the-Glide-Library#setup). ::: :::spoiler **My YouTube player isn't working... Help?** - **Issues with YoutubePlayer**: Review the following hints related to playing YouTube videos - When adding in the [YouTubeAndroidPlayerApi.jar](https://developers.google.com/youtube/android/player/downloads/) file into your app, you can load a JAR file into Android Studio by [following this GIF](http://i.imgur.com/k9a6WET.gif) and then select `Tools => Android => Sync project files with Gradle` in the menu. - To pass data from the main activity to a detailed page, you can pass simply the unique movie ID integer in each Movie payload (see [guide](http://guides.codepath.org/android/Using-Intents-to-Create-Flows#passing-data-to-launched-activities)). - You can use this movie ID to be able to fetch the YouTube video clip, you will need to [make a separate API call](http://docs.themoviedb.apiary.io/#reference/movies/movieidvideos/get) to view trailers. You then need to pass the `key` value (i.e. "fis-9Zqu2Ro") to the `YouTubePlayerView`. To avoid race conditions, you should probably make the network call after the YouTube player is initialized within `onInitializationSuccess`. - **Error DeadObjectException:** If you receive the `java.lang.IllegalStateException: android.os.DeadObjectException` exception, you need to open up the "Play Store" and update the Youtube app on the Android device. - **Error Leaked ServiceConnection:** If you are using an emulator, upgrade to Lollipop (API 21) and open up the "Play Store" to check for updates to the Youtube app. ::: ### API-Related Issues ::: spoiler **My API Key has been exposed!** - If Github sends you an email about exposing your Youtube API key, you can follow [this guide](https://guides.codepath.org/android/Storing-Secret-Keys-in-Android#secrets-in-resource-files) to hide sensitive API keys. ::: :::spoiler **What should my API response look like?** - Make sure to review the [Movie API](https://www.themoviedb.org/documentation/api) and what the expected response looks like. - [Now Playing API response](https://api.themoviedb.org/3/movie/now_playing?api_key=a07e22bc18f5cb106bfe4cc1f83ad8ed) - [Configurations API response](https://api.themoviedb.org/3/configuration?api_key=a07e22bc18f5cb106bfe4cc1f83ad8ed) to see what image sizes can be used. For instance, movie posters come back with URLs prefixed as `https://image.tmdb.org/t/p/[IMAGE_SIZE]` (i.e. `https://image.tmdb.org/t/p/w342/6bCplVkhowCjTHXWv49UjRPn0eK.jpg`). - [Videos API Response](https://api.themoviedb.org/3/movie/209112/videos?api_key=a07e22bc18f5cb106bfe4cc1f83ad8ed) - [Trailer API response](https://api.themoviedb.org/3/movie/209112/trailers?api_key=a07e22bc18f5cb106bfe4cc1f83ad8ed) ::: :::spoiler **Why am I getting an exception when parsing JSON data?** - Parsing JSON data can raise an exception if certain keys are null! When parsing JSON data, you want to program defensively and verify that keys exist and are not null. You can verify that a key exists with the `notNull` method or optionally extract a key (only if it exists) with the `opt` prefix method. For example, `if (movieJSON.optJSONObject("title") != null) { ... }` will extract the title only if the caption is not null and will return null otherwise. ::: :::spoiler **I'm not getting a JSON response from my API calls!** - Can't get back the JSON Response! A number of people always run into issues with their emulator and not being able to access the Movie Database API. If you are pretty sure you have the code right and you can't seem to get any response back from the API, try these steps: - Getting `No address associated with hostname` exception? Emulator doesn't have internet, try a restart. - Check the URL to ensure that you are passing the correct `client_id` with the request. - Make sure you have added the internet permission `<uses-permission android:name="android.permission.INTERNET" />` to your manifest. - Ensure the emulator has [access to the internet](http://i.imgur.com/kZqZko6.gif), otherwise, all network requests fail. - Restart the emulator (close window and relaunch) until you have verified internet access above. - Obtain the exact url (by breakpointing or logging) that you are going to send a request to and paste the url into your browser to verify the API response is coming back correctly. - Make sure you are using the `new JsonHttpResponseHandler()`([docs](https://guides.codepath.org/android/Using-Codepath-Async-Http-Client#sending-a-json-request)) in your AsyncHttpClient network call and make sure you are sending `client.get(url, new JsonHttpResponseHandler() { ... })` - The Movie Database API returns a JSON dictionary so make sure the onSuccess() is using JSONObject and not JSONArray in this case. Make sure you are using `jsonArray` or `jsonObject`, which is entirely dependent on whether a dictionary or array is the root object. - Add an `onFailure` to the `JsonHttpResponseHandler` callbacks and log there to ensure that it's not being hit - Check your LogCat to make sure there are no specific error messages (and watch this [debugging video](https://player.vimeo.com/video/73990805) for more tips), use filters to more easily read the log. - [Uninstall the app](http://stackoverflow.com/questions/12447839/how-to-uninstall-my-app-from-android-emulator-on-a-mac-10-7-4) from the emulator and allow it to be fully re-installed by relaunching it from within Android Studio. :::

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully