Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java forum!

Tim Moores

Saloon Keeper
+ Follow
since Sep 21, 2011
UK / DE
Cows and Likes
Cows
Total received
142
In last 30 days
7
Total given
11
Likes
Total received
968
Received in last 30 days
17
Total given
396
Given in last 30 days
11
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tim Moores

If that's important to know after the fact, you can keep the data from which you created the spinner around and look it up.
4 hours ago
I wouldn't create an extra XML for each case, but use the built-in array handling facilities for this. So your arrays.xml file might look like this:

Then you can access them like context.getResources().getStringArray(R.array.pizza), and display them in a dialog, somewhat like https://acomputerengineer.wordpress.com/2018/07/23/display-list-in-alertdialog-in-androidsimple-list-radio-button-list-check-box-list/
4 hours ago
For starters, most file systems don't support simultaneous read and write operations on files. If they did, simultaneous file accesses might indeed be sped up, but they don't, so the question is moot. And as I said before, if performance is of utmost concern, cache the file contents in memory. File I/O in general is very slow compared to in-memory operations.
Accessing a file from multiple threads while it is being written to is not a good idea. If this is a performance issue (you mentioned efficiency), then the reads should use an in-memory cache which gets updated as soon as the file write is finished.
Check out the getSelectedItemPosition, getSelectedItem and setSelection methods.
1 day ago

where can i post my questions


In this forum, but not in this topic (which is for welcoming the author).
2 days ago
Can you ask the person who wrote the code to clarify it? Having to make changes to other people's code is fairly common, and if there is no documentation and no adequate comments -both unfortunately also fairly common-, you may have to bite the bullet and dig into the code trying to understand it.
2 days ago
This is the FAQ for the Android forum. It's editable by everyone, so feel free to add content to it.

  • What Java API is supported by Android? How does it differ from JME?
  • Where can I get an SDK? What platforms does it support?
    • The latest version of the SDK is available for Windows, OS X and Linux here.
  • Do I need to buy hardware if I want to start writing applications that run on Android?
    • You can start writing applications even if you don?t have hardware to run them on. The Android SDK comes with an emulator and all tools necessary for application development and deployment.
    • Another option is Google's Android Studio which is based on IntelliJ.
  • Which hardware devices support Android?
  • What is Dalvik? How is it different from JVM?
    • Dalvik is a register based virtual machine optimized to run on a slow CPU,with relatively little RAM and on an OS without swap space. WikiPedia:Dalvik_virtual_machine
  • What are the different Media formats supported on Android?
  • Where can I publish my Android applications?
  • How can I get insight into how people are using my app?
  • I'd like to display ads in my app without having to negotiate it all by myself. What are my options?
  • What support does Android or Dalvik VM provide for running native C code?
    • The NDK (Native Development Kit) gives developers the ability to call into native code from Android applications. There is a Google group for NDK-related discussions. At present, Android supports libc, libm, JNI interface headers, libz, liblog, OpenGL ES 1.1 and OpenGL ES 2.0, libjnigraphics, a minimal set of headers for C++ support, OpenSL ES native audio libraries and Android native application APIs.
  • How can I view PDFs and Office documents?
  • Which Android versions are being used out in the field?
  • Is Android code compiled to a .class file?
    • The Java bytecode of a compiled class is converted into Dalvik executables or (.dex) files, using the "dx" tool bundled with the SDK . The application is packaged into .apk file which are zipped .dex files. The Dalvik virtual machine runs Dalvik executables in the apk file.
  • I want to write Android Applications too but dont know where to start?
  • Do Android projects have deployment descriptors?
  • My Application throws an Exception, where is the Stack Trace dumped?
    • Exceptions are written to a log file, named Logcat in the emulator. You can obtain a dump by executing the adb logcat command. To write log messages from your application, use the static methods of JavaDoc:android.util.Log class(Log.v(), Log.d(), Log.i(), etc.). If you are using Eclipse with ADT plugin, you can open "Logcat" view to see the logged messages.
  • What functionality of the actual device can the emulator emulate?
    • For Emulator How-Tos and limitations, read this
  • How can I send email from an Android application?
  • How can I use JAXB on Android?
  • What options for storing data do I have?
  • What 3rd party libraries should I check out?
  • How do I get the Android source code?


  • Reference material

  • Android Home Page
  • Developer Guide
  • API Reference


  • Books

  • Application Security for the Android Platform by Jeff Six
  • Professional Android 4 Application Development by Reto Meier
  • Introduction to Android Application Development: Android Essentials and Sams Teach Yourself Android Application Development in 24 Hours by Shane Conder and Lauren Darcey
  • Advanced Android 4 Games by Vladimir Silva
  • Learn Java for Android Development by Jeff Friesen
  • The Android Developer's Cookbook: Building Applications with the Android SDK by Schwarz, Dutson, Steele, To


  • Other

  • Following the Android Developers Blog is a must.
  • In-depth tutorials on many subjects by Lars Vogel
  • Frameworks for developing cross-platform mobile applications: Rhodes, Titanium Mobile, Unity, Infinite Monkeys, Kendo UI, Apache Cordova (formerly known as PhoneGap), Tabris, React Native, NativeScript-Vue, Flutter
  • Android 4.4, KitKat: The complete FAQ
  • Android 5, Lollipop: The complete FAQ
  • Android 6, Marshmallow: The complete FAQ
  • Android 7, Nougat: The complete FAQ
  • Android 8, Oreo: The complete FAQ
  • Android 9, Pie: The complete FAQ


  • Other Android variants

  • WikiPedia:Fire_OS is developed by Amazon and also based on the AOSP; it runs on Amazon's Kindle family of devices: FireOS Development
  • BlackBerry 10 can run repackaged Android apps : http://developer.blackberry.com/android/
  • Not really a variant, but Windows Phone 10 can run Android apps that have been adapted to it, as well as Cordova apps



  • CategoryFaq JavaMicroEditionFaq
    3 days ago
    What happens if you simply remove the jaxws-api.jar file?
    3 days ago
    The network IP address will most likely be an internal one like 10.x.y.z or 192.168.x.y - which will not help you at all, because those are used everywhere.
    4 days ago
    The answer, of course, is: it depends. What is the web site like? Meaning, how many concurrent users are there, what are they doing, how much storage do they need.

    I host the backend of my app (which has many more users per day than 80) along with a web site in a Tomcat instance that is just one of many on that server.
    6 days ago
    The problem with merging PDFs in this way is that PDF content -once created- is tied to particular positions on the screen. So if you have two PDFs with half a page of content each, merging them will (at best) result in a page with both content sort of overlaid on top of each other on the top half of the output PDF.

    No free tool I'm aware of can address this on its own (which is why I pointed to Adobe's tools, which may have an API that helps with this, but which will certainly cost you quite a bit).
    As I said, PDFBox can do this. Since you are already using it, why are you contemplating some other library?

    Copying just parts of a page is quite tricky, no matter which library you use. Unless you have quite some time to spend, or money to license something from Adobe, I advise to leave out that part.
    80 is a really small number. How much data will each user store? It sounds as if even a shared server will be able to store the app data and hosting whatever site you have.
    6 days ago
    Is this a web app where both jar files are located in WEB-INF/lib? If they are, then this kind of error shouldn't occur, unless one of the files -possibly the Weblogic one- is also present somewhere else, most likely in a directory that belongs to the app server rather than the web app. So try to find out if the one of the classes is also present in one of the directories that's part of the server.
    1 week ago