Running this GTFS sample code - java

I am having trouble finding an API that will allow me to read in GTFS data. After much searching I was able to find and run This code, but there is not really much of an explanation. I am ultimately having trouble trying to figure out how to get information and display it in .xml layouts.
Question:
Do I need to create another class with an onCreate method and call these other classes?
Does this program not require me to load values into a database?
Where can I find an API that would help me understand how to read in, parse, and display values.

There is nothing in the source of xml, manifest, not even MainActivity.java or any activity
so there is not much thing you could do besides using the class which you're totally
capable to do it yourself by reading spec.
Question:
1. Do I need to create another class with an onCreate method and call
these other classes?
There is no activity, so no onCreate, no calling methods, nothing.
2. Does this program not require me to load values
into a database?
Same as question one.
3. Where can I find an API that would help me understand how to read in, parse, and
display values.
You could really just implement this by following the spec all by yourself. It's really simple.
Anyway, I made an example for you so you could use git clone to get the source code and do
whatever you like.
https://github.com/cwhsu1984/GtfsDemo.git

Look at https://developers.google.com/transit/gtfs/ for more GTFS specs
That project was a piece of a project built in a class project that I wanted to open source. Other team members didn't believe the open source model as I did.
If I recall, what I did was make a sqlite DB of the GTFS data, and in a activity pull info from the DB.
I'm sorry, in frustration with the team, I pretty much deleted all the code I had ;)
Also, I haven't touched Android since, soo.... Sorry I can't help.

Related

How can I make my java program retrieve data sets online?

Currently I am working on a program that will assist me for making decisions when trying to bet on sports. My goal is for the program is that each day I would like to retrieve things like weather, past games, player/team stats etc. then aggregate it all so that I can see which teams make the most sense to bet on.
I'm not exactly sure if it's even possible to do on IntelliJ, the text editor I'm using, because I do not think its connected to the internet on its own. I think one approach would be to use a separate program (not IntelliJ) to automatically go to each website and copy the appropriate information into an excel document; then I could copy the file into my project each day before I run it. Something like that is what I have in mind, but I would appreciate some help if anyone knows which strategy I could use to move past this obstacle.
I've recently learned how to and created a GUI to navigate my program a little easier than through the console; therefore, my work ethic is not an barrier in this instance. I've taken one programming class in college and would consider myself an apprentice (one step above a novice).
You can use jsoup for scraping data from a website, Then you can use Apache POI to add it to an excel file.
Heres the website https://jsoup.org/
Heres a good tutorial about apache POI https://www.baeldung.com/java-microsoft-excel

Deciding whether to embed or externally save my code

I've made a code which displays an array which shows traffic lights flashing, should I save externally as script files or embed it into the HTML.
I also need to explain why I've done this.
Please I've got until over Christmas to finish this, I've looked everywhere and can't find much, so I'm turning to this where apparently experienced programmers are and who have done all this before.
Please don't close the question, I really need help. Thanks
What is the ultimate goal?
Code maintainability - use external script
Reuseability - use external script
Downloadtime/network i/o - a bit better if embedded.
Want the HTML/CSS redone by designer later - use external script
The more I think of it, the more reasons I see to put it extern.
And tge one I listed pro embed - that's nullified at second load (script from cache)
Revering to the MVC-Pattern I'd put it in an extra file. It's just better structured and better to read.
Another advantage is that you can reuse your code. Like if you'd have a second page which uses this code you would just need the include it there, too.

Connecting to API

I plan to build a simple website that takes data from a websites API and puts it into charts that are listed on my website. Here is what I am trying to do:
Take data from the API listed on localbitcoins.com
https://localbitcoins.com/api-docs/
Code a program that parses this data as I see fit.
Create a graphical layout that displays the data.
Post the graphs on a website that I have created, ideally to update in real-time.
I don't know where to begin.
I am not asking for some one to hold my hand through it all, but more so to give me some pointers on where to start, what resources are there that I can look at, and so on.
My instinct tells that that I need to tackle API and coding part first. Can someone point me to a resource that could take me through this? Should I stick with Java or should I use another language for this?

XML and Passing Variables between the .java file and the values folder (.xml)

This is a simple and fundamental question about android development. So I have these text fields in my program, and I want to send the text to the java side, check it and what not, then send it back to XML on another layout. So I really need to know how to take a java variable and store it in the XML values folder (the thing I would use #string/abc to refer to) Thanks! If you need clarification please ask, I know I'm not too great at wording these questions. :)
From what I could decipher from your question, you are looking to pass data between two different activities. You can use Intents for that in android. Here is a SO resource.
If you are looking to save values, you can also look at Shared Preferences in android. Look at the official documentation here and here You can write to a shared preference in one activity and read from it in another. Generally I design one singleton class which does shared preference handling and interact with that class from different activities.
And its better to show some code, any attempts. This community understands code better than text! :)

Wrting Objects to a file and searching through them in an Android App

I want to create an android that allows the user to enter data, like name and id number. I want to save that data as an object, to a file. I know I can do that using ObjectOutputStream, which I did, and it works. However, I also want the user to come back later, be able to add more entries to the same file, and search through his/her previous entries. I know that only RandomAccessFile has that capability, but I still want to write objects since it's easier to deal with.
Does anyone have any tips on what's the best way to approach this?
I am aware of this post, but I am not sure if I can use the libraries mentioned there on android. I was also looking at SQLite, but I have no experience with it and I am not sure if it's the right option for me.
Thanks in advance!

Categories

Resources