Coder Social home page Coder Social logo

Comments (13)

UweTrottmann avatar UweTrottmann commented on May 27, 2024

Did you make sure to build the full URL? The TMDb API only returns the image path, e.g. /8uO0gUM8aNqYLs1OsTBQiXu0fEv.jpg. You will have to assemble the full URL by adding the current image base url and a size specifier as described in the docs.

from tmdb-java.

syedalinaqi avatar syedalinaqi commented on May 27, 2024

how to obtain size using your tmdb???

from tmdb-java.

UweTrottmann avatar UweTrottmann commented on May 27, 2024

Either obtain them via the /configuration endpoint or just look at the example response in the docs. You can pretty much hard-code the base url and resolutions as they don't really change.

from tmdb-java.

syedalinaqi avatar syedalinaqi commented on May 27, 2024

thanks and one more thing how do i use a single async method for returning one id's tiitle,poster path and year.

from tmdb-java.

UweTrottmann avatar UweTrottmann commented on May 27, 2024

Can't you just return the whole movie object in 'doInBackground()' instead
of a single property?
On Sep 3, 2014 5:57 PM, "syedalinaqi" [email protected] wrote:

thanks and one more thing how do i use a single async method for returning
one id's tiitle,poster path and year.


Reply to this email directly or view it on GitHub
#16 (comment)
.

from tmdb-java.

syedalinaqi avatar syedalinaqi commented on May 27, 2024

so u r saying that i should use

return movie.toString();

but if i use this then how do i separate the three things i need from the whole thing???

and another thing how do i use the same Async method for multiple tmdb ids??

from tmdb-java.

syedalinaqi avatar syedalinaqi commented on May 27, 2024

and also how do i extract the titles and posters of the MostPopular movies as it returns a list.

from tmdb-java.

syedalinaqi avatar syedalinaqi commented on May 27, 2024
 1   Tmdb tmdb = new Tmdb();
 2   tmdb.setApiKey("76f029219decc8a8e1c6d5474e37d7c9");
 3   MoviesService movieService = tmdb.moviesService();
 4   ResultsPage movie = movieService.popular();

 5  return movie.results;

ok after using the above method how do i use the data that comes in a list from the 4 line. how do i view it

from tmdb-java.

syedalinaqi avatar syedalinaqi commented on May 27, 2024

at leat tell me what type of list it returns

arraylist
string list
etc

from tmdb-java.

UweTrottmann avatar UweTrottmann commented on May 27, 2024

Just look at the type? E.g. hover your mouse cursor over it in eclipse, or press Ctrl+Q in Android Studio/IntelliJ.

from tmdb-java.

syedalinaqi avatar syedalinaqi commented on May 27, 2024

well i did and it said

com.uwetrottmann.tmdb.entities.ResultsPage
public java.util.List<com.uwetrottmann.tmdb.entities.Movie> results

so as i said before it returns a list. SO how do i use it.

from tmdb-java.

UweTrottmann avatar UweTrottmann commented on May 27, 2024

It returns a list of Movie objects wrapped into a standard Java List interface (List<Movie>). See the Java documentation for List on how to use it.

from tmdb-java.

syedalinaqi avatar syedalinaqi commented on May 27, 2024

ok i did exactly as u said but the activity stopped instantly

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

    tv = (TextView) findViewById(R.id.textView);
    new showMovieInfo().execute();
    tv.setText( mplist.get(1).title);

}
public class showMovieInfo extends AsyncTask<Integer,Integer,List> {

    protected void onPreExecute(Integer f){
        //setting up variables for whole method
    }

    @Override
    protected List doInBackground(Integer... params) {
        Tmdb tmdb = new Tmdb();
        tmdb.setApiKey("76f029219decc8a8e1c6d5474e37d7c9");
        MoviesService movieService = tmdb.moviesService();
        ResultsPage movie = movieService.popular();//you can use a String[] array at the place of 550.
        //String str = String.valueOf(movie.title);
        //you can create multiple return statements or u can use if else statement for different commands.
        return movie.results;
        ///MenuInflater inflater = new MenuInflater(MainActivity.this);
        //inflater.inflate(android.R.layout.simple_list_item_1, false);


    }
    protected void onProgressUpdated(Integer... progress)
    {

    }
    protected void onPostExecute(List result)
    {
        mplist = result;
      mplist = new List<Movie>() {
          @Override
          public void add(int location, Movie object) {

          }

          @Override
          public boolean add(Movie object) {
              return false;
          }

          @Override
          public boolean addAll(int location, Collection<? extends Movie> collection) {
              return false;
          }

          @Override
          public boolean addAll(Collection<? extends Movie> collection) {
              return false;
          }

          @Override
          public void clear() {

          }

          @Override
          public boolean contains(Object object) {
              return false;
          }

          @Override
          public boolean containsAll(Collection<?> collection) {
              return false;
          }

          @Override
          public boolean equals(Object object) {
              return false;
          }

          @Override
          public Movie get(int location) {
              return null;
          }

          @Override
          public int hashCode() {
              return 0;
          }

          @Override
          public int indexOf(Object object) {
              return 0;
          }

          @Override
          public boolean isEmpty() {
              return false;
          }

          @Override
          public Iterator<Movie> iterator() {
              return null;
          }

          @Override
          public int lastIndexOf(Object object) {
              return 0;
          }

          @Override
          public ListIterator<Movie> listIterator() {
              return null;
          }

          @Override
          public ListIterator<Movie> listIterator(int location) {
              return null;
          }

          @Override
          public Movie remove(int location) {
              return null;
          }

          @Override
          public boolean remove(Object object) {
              return false;
          }

          @Override
          public boolean removeAll(Collection<?> collection) {
              return false;
          }

          @Override
          public boolean retainAll(Collection<?> collection) {
              return false;
          }

          @Override
          public Movie set(int location, Movie object) {
              return null;
          }

          @Override
          public int size() {
              return 0;
          }

          @Override
          public List<Movie> subList(int start, int end) {
              return null;
          }

          @Override
          public Object[] toArray() {
              return new Object[0];
          }

          @Override
          public <T> T[] toArray(T[] array) {
              return null;
          }
      };
        //you can use s string array here and use stringarray.add(result) to add multiple items to the array and then you can get those items by using stringarray.get(1).
    }
}

ADB Log

09-04 22:13:28.501 4865-4865/com.ITAN.cinematheque E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ITAN.cinematheque/com.ITAN.cinematheque.activities.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2255)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2309)
at android.app.ActivityThread.access$700(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5317)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.ITAN.cinematheque.activities.MainActivity.onCreate(MainActivity.java:39)
at android.app.Activity.performCreate(Activity.java:5326)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2218)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2309)
            at android.app.ActivityThread.access$700(ActivityThread.java:157)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:176)
            at android.app.ActivityThread.main(ActivityThread.java:5317)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
            at dalvik.system.NativeStart.main(Native Method)

from tmdb-java.

Related Issues (20)

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.