How to use CalendarProvider on Android?

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

Was this solution helpful to you?

Just Added Q & A:

Find solution

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.