Comments (13)
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.
how to obtain size using your tmdb???
from tmdb-java.
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.
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.
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.
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.
and also how do i extract the titles and posters of the MostPopular movies as it returns a list.
from tmdb-java.
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.
at leat tell me what type of list it returns
arraylist
string list
etc
from tmdb-java.
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.
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.
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.
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)
- Istancing new Tmdb launches excpetion HOT 1
- Discover Api call doesnot get any genres into the Movie object HOT 2
- RxJava support HOT 8
- Translations are missing HOT 1
- Remove myself from pom.xml if Sonatype OSSRH allows it HOT 2
- Update supported API calls HOT 1
- Find results should return base media classes
- TMDb Unsynced Servers
- TaggedImage Entity Missing Fields
- On Video entity type field can be ENUM
- On TestData Actor's Origin place has been updated
- MovieService may be broken HOT 2
- 2.2.0 Version not in maven central HOT 1
- Provide existing configured OkHttpClient HOT 2
- Update Entity IDs to Long?! HOT 3
- include_adult missing for search.tv method HOT 3
- Vote avaerage and vote count are missing HOT 1
- Tv tagline is missing HOT 1
- spoken languages for series is missing HOT 1
- Add trending endpoint HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tmdb-java.