I am working on android project and have to write a logging system that will record everything happening in the app during production.
What is the best way to do this? I was thinking about writing my own simple writeToFile class but then I see some people use Logging libraries.
There are a number of libraries to log the data. One of the most popular and simple library that i came across is "Hugo" developed by Jake Wharton. Its simple easy to use and flexible.
You can find the link to the library here https://github.com/JakeWharton/hugo
Related
I work on a lot of closed source projects but often find myself extending the same classes, implementing the same libraries, doing the same things for caching and solving memory issues, and seeing other companies I work with facing the same issues
It makes me wonder if there are engines for android out there created for certain purposes. My cursory google search on this issue was unproductive
but I think this question is constructive because there is a real answer to this instead of discussion. Alternatively, what StackExchange site would this be a better question on?
Google Play Services and Volley are great examples and responses by google to certain problems such as but not limited to GPS/Positioning logic, network calls, bitmap caching, but I was wondering if there was anything more that is also maintained.
It sounds like you have a few different problems that each have their own solutions.
extending the same classes, [...] doing the same things for caching and solving memory issues
Making your own library that contains these custom subclasses and caching implementations would probably suit your needs pretty well.
You may also want to learn how to create your own templates for Android Studio. Templates (such as the "new Master/Detail flow" default template) can be used to automatically generate classes and XML files to avoid spending time writing boilerplate code. Here's a GitHub repo with a number of examples.
implementing the same libraries
This sounds like your core complaint is that you want a way to automatically generate a base project of sort for your projects that might automatically include certain libraries, set up a package structure, etc. This can be accomplished using Maven archetypes.
If you want an example of how to create a Maven archetype, I would check out Velcro.
I want to integrate libspotify as sound/player service and integrate spotify in more then one java applications.
Can anyone suggest me any lib or any code example to get me started?
Disclaimer: I work for Spotify
At the moment, Spotify doesn't have a nice Java wrapper for libspotify, but this is definitely something we are thinking about doing in the future. I can't offer an estimate on when this will be available, so if you are dying to get started writing apps which integrate with Spotify, you should use the natively-compiled libspotify for Android rather than waiting for a Java wrapper.
The current preferred way of doing Android work with libspotify is to use the natively-compiled library which can be found on the libspotify website. You'll have to write your own JNI wrappers around it, which can be a bit tricky, but is definitely not an impossible task. :) Unfortunately the documentation for using libspotify under Android is a bit lacking. Again, this is something that Spotify is working to improve.
There is a third-party project called jlibspotify which offers a Java wrapper around libspotify. I personally have not used it before, so I can't comment on how good the project is, but if I recall correctly it is based on an older version of libspotify, so you might be better off going the JNI route detailed above.
I noticed that there is also libjahspotify out there, which seems newer than jlibspotify. I haven't tried it though.
What I'm looking for is some library like Perl's Data::Faker, Ruby's factory_girl. Something that allows me to generate random Strings, Dates, ... for testing.
I saw this other question. But I want something that has been used by someone with Android.
I tried java-faker, jFairy - they don't work on android.
So I find fluttercode.datafactory - it's ok for android.
Add following to your app build.gradle to use it:
compile 'org.fluttercode.datafactory:datafactory:0.8'
Usage example: http://java.dzone.com/articles/generate-test-data-datafactory
From the link that you gave, it seems that you are looking for Mock libraries that could be used in Android.
This article, written by some Google engineers, use PowerMock library to do their unit tests in Android. You might want to try it out and follow the steps in the article to have your test up and running.
I've recently developed a library that can be used for generating test data for your applications in a programatic way.
Take a look at MockNeat: https://github.com/nomemory/mockneat
There are also two detailed examples on the wiki page:
Creating CSV with test data
Populating a SQL Schema with test data
I want to add a "Tweet" button to a C++ application without use of heavy libraries and frameworks. The application is portable and runs on Android and Windows.
I am not sure if I understand your setup. If you have implemented a native part of an Android app you can still write some java UI code and call your c++ code from there.
If you want to have a full portable solution though I would render simple button with help of OpenGL.
UPDATE Oh I see what you meant, so this is actually quite simple. For Android many people use Twitter4j which is not that "heavy". You can also implement API calls on your own, see the official docs. Besides, there are a couple of more possibilities on SO with links to some tutorials.
As for portability, it gets a bit trickier. I would stick with twitter API and implement HTTP calls directly. The quickest way to get it done in a portable way is to write a thin wrapper around the socket calls as someone here suggested.
You could also use Boost.Asio or cURL library, but I have not checked them personally. The latter is available for windows and has recently been ported to Android.
Hope that helps!
Is there a handy-dandy equivalent to org.apache.commons.beanutils.PropertyUtils on Android?
I can't seem to use bean utils in my android app due to some dependencies on PropertyDescriptor,and IndexedPropertyDescriptor. So I'm wondering if there are any alternatives?
Basically all I want to do is use a method name as a string "someMethod" and feed that into setMethod(anObject, "someMethod", value), much like PropertyUtils does; but without having to resort to the nasties of reflection...
Or are my hands tied and I need to use Reflection?
There is bridge library which works on Android: android-java-air-bridge.jar. Just include into project path and use all apache beanutils features in your Android project as you could use in ordinary java application. Moreover, there are lot of other classes which moved to this Android supporting library. Look at the list.
There is a possibilty to use libraries or write own code depending on the PropertyUtils. But it sure isn't dandy. You can get the general idea about what has to be done in this thread.
There are apparently some projects who have successfully solved the issue, so you can study thier solution. Take a look at Drawingpad-base and libgdx. You can find PropertyUtils in the package com.madrobot.beans in the first project and com.badlogic.gdx.beans in the second.