Getting video Ids from youtube playlist & downloading them - android

so I'm currently working on a project... I want to create an Array containing the Ids of videos from a youtube playlist.. Also i wanna download a specific video when user click on download button, how can i do that?
Also, another question:
I have created a ListView, and set when the user click on one of the rows, String clicked = videoIds.get(position);. But i want to get the clicked string to use in another methods, like when he clicks the download button, how can i do that too?
Thanks for reading :)

https://www.youtube.com/t/terms
You shall not download any Content unless you see a “download” or similar link displayed by YouTube on the Service for that Content.

Related

Storing and dynamically loading pdf files from server in node js

I am trying to create an app that displays a list of pdf files, and then load the pdf file in a new browser tab / android activity.
The idea is the user will click a button "Lectures" and then will be shown the list of lectures, clicking on any list item will load the specific pdf file.
I currently have a node js mysql back end, for user login and routes to other pages, which is followed up with both a handlebars and android front end.
I am struggling to understand how I can store pdf files so they can be called based on what the user clicks, I want to store the pdf files on a server rather than within my application and then call them when required.
I have seen a method using ejs view engine to render list of files in public folder, which then allows you to do this, but this entails storing pdfs within the application, alternatively I can host the files with my web hosting, still need to figure out how to load them based on user action.
Would appreciate any direction or solution!
Thanks in advance
Mohamed V
Without knowing how you have the DB set I will talk more along the lines of how you would do this and then modify as needed. In most cases you would probably want to use an object store to store the PDF files. This will allow for access on any application.
Your DB should contain a file name of the PDF file, as an example, lets say you table for 'files' is as such
id, filename, name, extension, courceID
Here you would have the filename maybe the extension type and a refrenceID
Next, in your response callback, you simply return the query for the files, for example let say you run a query like SELECT filename, name WHERE courceID = '12345'
You then return this to the view, if its ejs then you would just pass the object and do something like
<% for ( in in files ) {%>
<div><a href="url-to-object-store/<%-files[i].filename%>"><%-files[i].filename%>
<%}%>

How to save images by name as 1,2,3,....n in android

My app contains the camera functionality. I have develop the app.
As the app get starts one ListView of stations will popup(Like Station1, Station2,Station3....) & user has select one item from it. Then it will open the camera activity. So once the user took a picture, the image has to be stored like 'Station1_1', 'Station1_2', 'Station2_1', 'Station2_2' inside gallery. I have covered with the initial station name(Station1, station2..). But how do I store the last portion because it contains the sequence for each Station. So is there any way to save the images by 1,2,3....?
Thanks in advance.
There is a way but it isn't appropriate. If you just want to store each image having last portion is different then you can do in the following ways:-
You can call API for just handling counter.
You can store counter in PREFERENCE, but it won't work perfect if user clear data then new images were override old one.
You can store TIMESTAMP as end portion and it is appropriate way.

How many Activities do I need?

I'm in the middle of making my first Android app and have been asked to make an app that displays information on books. I currently have a login screen which brings me to a new page of buttons with different genres. When you click on a genre it brings you to a listview of books in that genre, you then click on a book and it should display information on that book.
My main issue is, I have made a lot a activities already and I'm wondering if I'm going about this the wrong way? When I get to displaying information on each of the books that will be clicked inside of my listview, do I then have to make a new activity for each or is there a better way to do this that I seem to be missing?
Try the following pattern:
Create your first activity for Login (i.e LoginActivity.class)
Create your second activity that contains your genres (i.e GenresActivity.class)
Create your third activity that contains a list of books in that particular genre - remember this will be reused for all genres because it is simply a list of items. (Have you heard of RecyclerView instead of a ListView?)
Create your 4th activity for details of a book (i.e BookDetails.class) - this will also be reused each time to display a book's information. The caveat would be to have the same structure/layout used because a book object has the same information like title, author, year and perhaps cost. So, when a user clicks a book from a list, you want to direct them to a details view where they can view more information on that particular book!
That brings you to 4 activities - not too many if you think about it.
I hope this helps! Good luck!

How would I go about displaying data from an API website and putting it in text format on an activity page?

I want to show data in a sensible form for my movie database app. The website I am using to extract data from is www.omdbapi.com. I have already created a code that extracts the title and year of the movies and displays it in a ListView form which contains items that are all clickable to another activity. I would like each activity that the ListView item clicks to to display the movie information under different headers etc.
I have been stuck on this issue all day. I'm new to coding and have no clue what most processes are called etc. Im not asking for the entire code, just instructions on what to do because I am stumped. I would be very very grateful.
Thank you.
Depending on the format the response is formatted you would either use (probably) an xml parser or a JSON parser and grab the info between specific xml tags or the specific keys within the JSON output.
There are thousands of examples of both methods. If you can get the title to display, then you already know how to get the other elements.

Open next image when button is pushed in Android

Hi i am very new to android so i dont know much about it
my question is
How do i store an image and related sound, text somewhere and get it back to display
and how to implement the next button when its pushed the next image with next sound and text is displayed.
thank you !
Keep images (drawables) ids in an array e.g Array array = new Array(){R.id.one, R.id.two};
Keep your sound file in res/raw folder and put sound id as same above in an array.
E.g. Array sound_array = new Array(){R.raw.horn_sound, R.id.peep_sound};
Keep counter and loop over the arrays....

Categories

Resources