Are there certain restrictions for the default/native Java Packages/Classes an Android App can use? (Please read description)
-
I am trying to make a Finance Android App where the user can enter a stock symbol (AAPL) and the current price and other information about the price shows up. Now, I know that the app is crashing/closing on the Android Emulator because of the objects I am creating from my classes. Whenever I comment out where I created the object, the app works perfectly no errors, but when I uncomment it, the app crashes. My Question: Are there specific classes/packages that are default with Java (don't reference anything online) that do not work with Android? I am talking about classes like java.io, java.net.URL? Earlier in the year, I wrote a Java GUI Application where the user entered a stock symbol, and my program would print the current price, volume, closing price, range, historical prices etc. for that stock. Everything works perfectly for it, but when I add it to Eclipse for Android, everything compiles, but the Emulator says it no longer works. The First Class: The first class I used downloaded the HTML of http://finance.yahoo.com/q?s=AAPL (where AAPL would be replaced with the stock symbol entered). It then parsed the HTML until it found the current price (on Yahoo Finance HTML, every thing has a unique ID, for example, the Market Close Price is found after the unique identifying tag "yfs_l84"). This program uses import java.io.BufferedInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import java.util.regex.Pattern; The Second Class: This class downloads historical data from Yahoo Finance using http://ichart.finance.yahoo.com/table.csv?s= which gets all the historical prices as a CSV file (nothing is saved on the actual hard drive), and parses it. I use import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.Arrays; import java.util.StringTokenizer; import java.util.Scanner; import java.text.DecimalFormat; import java.util.Collections; Are there specific classes/packages (ie. java.io.) that Android does not support?
-
Answer:
Yes, there may be differences. The Android Java library is not based on the Java SE library. Only the classes in the SDK android.jar are supported. There are other classes in the Android firmware, but these are not officially supported for use from standard applications. If the cause of the crash is a missing class, this will be logged in the Android logger, visible via logcat.
Miguel Paraz at Quora Visit the source
Related Q & A:
- How to develop native android app?Best solution by Stack Overflow
- How to implement app purchase in Android app?Best solution by Stack Overflow
- How to connect Android app to App engine?Best solution by groups.google.com
- How can I as an American make my English accent better? (please read details)Best solution by Yahoo! Answers
- Is it possible to set up a wireless printer so that only certain people can use it?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.