Usage of ListView and Adapters - Java for Android App Development

Hi guys,
I'm working for Avocarrot and we are developing a new app monetization product to embed mobile ads inside content streams (more details at: avocarrot.com/docs/#/android/instream).
If you are working with lists for your apps, we have a few questions we'd like to ask:
1) Do you use usually use ListView, ExpandableListView or both?
2) Do you use usually create your own adapter by extending and overriding the BaseAdapter, ArrayAdapter, CursorAdapter?
3) Would you prefer fully customizing appearance of the ads using your own XML or drag-and-drop templates that are quick to integrate?
Any brief answers will be appreciated!
Thanks,
George

Related

Selection List Control

Hi,
I'm looking for an enhanced .NET Selection List Control which can show various entries each with at least two lines of text. The ListView control that comes with VS 2005 is too limited. I know, that it could be overwritten, but I'd like to use an existing solution.
Does anybody know a free or commercial one? I could not find nothing.
Regards from Cologne,
Chris

Implementing a plugin system in my app

Hi all,
I'm new to Android development, kind of a Java noob, but not to programming in general. I'm not looking for code examples, just theory or a basic 'how this is done' in Java/Android. I also hope this will become useful information for other developers heading down this path.
I've had some success creating my first Android app - I apologize for not going into details about the specifics of the app, as I plan to eventually sell it commercially on the market - the question should, however, be applicable to any application using this flow model.
My current goal for this application is to create a 'plugin' type system ( like those used in OpenHome and other apps that allow user-generated plugin-able content / functionality ), to allow for flexibility in both my own further component development, as well as eventually creating an open interface for other developers to use to extend the application.
Currently my application is laid out as follows:
Main UI class
- entry point to the application
- starts the service class to spawn 'spinners' ( data processors )
- presents the user with an (ideally) extendable interface to the service
- binds to the service class using AIDL
Service class
- presents an AIDL interface for communication from the UI process
- creates 'spinners' of various types based on user interaction that process data
- persistent, will run in background, new Main UI instances will connect to the running service and present the currently running spinners.
- extendable via an as-yet-unimplemented plugin interface to add new types of spinners
Spinner classes
- use a generic interface with a handfull of common methods to communicate with the Service class, bubbling up data to the UI interface.
- processes user defined data streams, outputs to a buffer/sink suppled by the Service
Assumptions I can make are:
- the plugin (Spinner) class will always implement / override a group of methods to present to the Service class; ie 'putData()', 'getStatus()', 'start()' and 'exit()'
- the plugin class should always return data to the Service class via a supplied/shared buffer ( short array, for example )
Where I'm stuck at the moment is exactly how to implement extendable classes without those classes being a part of the current code base package. More simply, how do I interface with these classes without knowing their names, methods, etc?
As mentioned, I'm new to Java so I may just be overlooking an already implemented class that handles this interaction. If that is the case, I'd be happy for anyone to tell me to shut up and read the docs, if you can point me at the proper docs
What I really don't want to do is create a 'plugin language' for these external bits, as I feel this could hamper development of fast/functional plugins vs. those written as native Java classes. This would also expose potential security issues, as I'd need to create a public interface to the Service class for these applications to link to. I'd prefer if execution of the plugins remained private / internal to the 'main' application.
I'm already using an AIDL interface between the UI class and the Service class - it would potentially be possible to use further AIDL interfaces into each plugin, but from my romp-through-the-park implementing the UI -> Server communication in this way, I find it cumbersome and difficult to pass any kind of complex data sets/controls. And I'm still unsure how the Service class would actually implement these without inheriting the interface directly.
I've poked around Intents in Android, but I'm having trouble wrapping my head around them/what they're for - it seems it might be possible to inherit the plugins that define themselves as sinks for my applications specific Intent type, but I'm lost in the details of how this works exactly, or if it would even be a viable path for what I'm trying to do. Can new Intents even be introduced into Android?
I apologize for the long-winded explanation of what boils down to a simple question:
How can I implement a 'plugin' interface in my application to allow myself and other developers to extend my app through their own classes?
I've been a Java developer for 10 years or so.
From what I understand the "Android" way, would be intents. I'm still working on wrapping my brain around them too.
However, the "Java" way would be to define an interface (or several) for the plug-in(s) to implement. Then use reflection to identify classes in the classpath that implement that interface.
There are some advanced techniques using custom class-loaders, but researching reflection should get you started; if you choose to go that route.
Thanks for the quick response, I'll take a look at the reflection implementation.
Intents do seem to be the 'way to go' for inter-application communication in Android the more I read about it though - if I can figure out how to pull in plugins which specify my applications 'Intent' dynamically. Intents seem to work really well for spawning a 'dumb instance' of an application - like the browser when clicking a link in another app - when your application doesn't want to deal with that data locally.
Seems a bit more difficult to wrap them around a bi-directional interface between the service and the external plugin application. If anyone's got experience with this kind of thing I'd definitely appreciate prodding in the right direction. Documentation on Intents is confusing at best.

[Q] Some questions about developing

Hi there, i'm new to developing Android Apps, so i have some questions.
1. I know that always have a chance of breaking security on computer world
2. Whats the most secure method to generate a UniqueID? because my app needs to work on china tablets, original tablets, cellphones, hacked phones, etc. I need this for verification of paid things (wait, xda will have a free version ;o)
3. There is any way to encript the program without affecting the performance too much? I'm new to java and comming from C++, so there is any compaction, encrypt, etc? Because if anybody knows the NEW IDA will come with android support.
4. There is any HTML parser on java? Because i need to fetch a html page with httpclient and after i need to parse it to get content... the contect is dynamic (html table with N rows), so i need a parser... or there is any other way?
5. I know how to make a tabed interface, but how is the best way to know the app state? Like it:
App Start -> User Already Logged (Save on SQLite?) ?
Yes = Display app interface and unlock config menu (here is the tabed interface)
No = Display login interface and lock config menu (here is just a relative layout with login bnts)
Thanks in advance.
1: Number one is not a question.
2: Do you mean most secure possible, or most secure practical? Those concerns should be addressed. Most secure would be to have a courier bring the user one-time-pads for every session, but that's not very practical. That said, what is the nature of your ID? Depending on what you are using it for, I would think a few randomly generated bits from some user entered entropy (like touchpad event timing) should suffice.
3: Again, what is the nature of your need for encryption? Do you want to keep it from being decompiled and analysed? If so, you're pretty much out of luck as there is always a way for a dedicated hacker to disassemble the code that does the decryption unless you use some sort of challenge-handshaking algorithm to load the keys at runtime for every session from some secure source but that requires connectivity and user interaction which necessarily complicates the process.
4: The XML parsers available as part of the Android SDK do a pretty good job of parsing HTML if it is clean compliant HTM> See, i.e. the Sax classes:
http://developer.android.com/reference/org/xml/sax/package-summary.html
5: You can use the API included preference classes to save state between sessions:
http://developer.android.com/reference/android/preference/package-summary.html
Note: for general application cryptography information, you still can't beat the venerated Applied Cryptography by Bruce Schneier.
Thanks for the answers.
I just wanna know how the most used programs like rom manager, power amp, titanium backup and whatsapp protect their paid versions, and how they validate it.
Another question that leaves on it is that some programs have a dedicated paid version, and some have just a key that you download and unlock the free version, how they did it? They just check if key is installed assuming that it was downloaded from market?
My uses is just for two reasons:
1.) protect my app as possible from newbie crackers
2.) transmit user information with a secure method to my server. Its important because my app will be used on open networks.
As for UniqueID generating, i just wanna a "unique world global super id" for each user of my app, and it will be installed on cellphones, tablets without phone, tv with android, and all of this.
Also, what to do if html is not well formated?

What Topic Do I Need To Tackle To Develop This Kind Of App?

The harvard university android app from google play store. (I can't seem to post any outside link yet for this account)
I want to create one for may school but I'm just starting to learn android programming, so guys I need your help on the topics that I need to study to create an app like that. I greatly appreciate any kind of comments. Cheers!
clonedaccnt said:
The harvard university android app from google play store. (I can't seem to post any outside link yet for this account)
I want to create one for may school but I'm just starting to learn android programming, so guys I need your help on the topics that I need to study to create an app like that. I greatly appreciate any kind of comments. Cheers!
Click to expand...
Click to collapse
Fragments, ListViews, JSON parsing (for communication with the web server to download news etc), Android SQLite databases (I suggest using this to store the information from the webserver locally so the app does not require a constant internet connection to view a news article for example), Google Cloud Messaging notifications, notifications, encryption.
There are lots more but these are some of the main ones. In addition I would not advise trying to copy the "look" or aesthetics of the Harvard application as it frankly looks disgusting, whoever designed that needs a course in UI design
any book suggestions?? im only studying at home and wanted to start studying android app development
m0nm0npalam0n said:
any book suggestions?? im only studying at home and wanted to start studying android app development
Click to expand...
Click to collapse
Android Application Development for Dummies and Learn Java for Android Development are 2 that I have in ebook form, though I can't say I've used them much as I don't really learn by reading books, more like looking at the source code of other apps and messing with it to see what happens
Android Application Development for Dummies goes through a wide range of topics including widgets, SQLite storage, possibly SharedPreferences (can't remember), ListView etc but does assume that you can at least follow what the sample code is doing - the sample code is commented but if you have not done any coding at all before then you probably should learn the basics of Java before reading it
Jonny said:
Android Application Development for Dummies and Learn Java for Android Development are 2 that I have in ebook form, though I can't say I've used them much as I don't really learn by reading books, more like looking at the source code of other apps and messing with it to see what happens
Android Application Development for Dummies goes through a wide range of topics including widgets, SQLite storage, possibly SharedPreferences (can't remember), ListView etc but does assume that you can at least follow what the sample code is doing - the sample code is commented but if you have not done any coding at all before then you probably should learn the basics of Java before reading it
Click to expand...
Click to collapse
thanks man! this really helps
Jonny said:
Fragments, ListViews, JSON parsing (for communication with the web server to download news etc), Android SQLite databases (I suggest using this to store the information from the webserver locally so the app does not require a constant internet connection to view a news article for example), Google Cloud Messaging notifications, notifications, encryption.
There are lots more but these are some of the main ones. In addition I would not advise trying to copy the "look" or aesthetics of the Harvard application as it frankly looks disgusting, whoever designed that needs a course in UI design
Click to expand...
Click to collapse
Thank you very much for the reply, I'm really thankful for the information that you share. Can you please clear this one for me?
I suggest using this to store the information from the webserver locally so the app does not require a constant internet connection to view a news article for example
Click to expand...
Click to collapse
clonedaccnt said:
Thank you very much for the reply, I'm really thankful for the information that you share. Can you please clear this one for me?
Click to expand...
Click to collapse
When you get data from a server to an Android app you use php for the server code - for example you can use php/mysql to run a search for calendar events in the database and return those events. Then you need to use php's JSON encode function to send the data in a JSON array.
The output should look something like this - this is the output of the calendar database for my school:
http://wgsb.cobainschofield.com/android_db/get_calendar.php (note this is not the live schools site, its the test server the guy who maintains the live site allows me to mess with err use).
You would then use a JSON parser class and an AsyncTask from within the app to "download" the content of the JSON array and then display it in a listview or textview etc.
Now obviously to get this information requires an internet connection yes? So every time someone wanted to check for an event on the calendar or read a news article for example they would need a working internet connection to receive the output of the get_calendar script, this is inefficient and bad design as it does not allow for offline viewing of the data.
Therefore what you can do is use androids SQLite implementation to create a local sql database then the first time you need to get the data from the webserver, you connect to the internet and get the output of the php script, the using the JSON parser class you store the information in the sqlite database then get the information from the database to display to the user.
By this way users can view news articles or calendar events offline and you only need to connect to the internet to refresh the information
I've uploaded screenshots in the attachments of how I've done it for my school's app.
That made it clear! Thank you very much.

[Q] Regarding layout and storing of data

Hi there, I'm in the middle of building an app with the same navigation structure as this app which involves a list of items which when clicked displays details pertaining to that item in another layout.
So I wanted to ask a few questions:
1) Which is better?
a) To use fragments, one for the listView and another one to display the details.
b) To use 2 separate activities for each layout and to pass data using intents to handle selection.
2) What is a better way to store data in this case? JSON or SQLite? Can you please briefly explain why?
Thanks for your time.
K12 said:
Hi there, I'm in the middle of building an app with the same navigation structure as this app which involves a list of items which when clicked displays details pertaining to that item in another layout.
So I wanted to ask a few questions:
1) Which is better?
a) To use fragments, one for the listView and another one to display the details.
b) To use 2 separate activities for each layout and to pass data using intents to handle selection.
2) What is a better way to store data in this case? JSON or SQLite? Can you please briefly explain why?
Thanks for your time.
Click to expand...
Click to collapse
1) A: Fragments as its easier to create large screen (tablet/phablet) layouts for fragments as you can have them side-by-side
2) SQLite - fast, easy to store and get data from, easy to code for, compact.
Jonny said:
1) A: Fragments as its easier to create large screen (tablet/phablet) layouts for fragments as you can have them side-by-side
2) SQLite - fast, easy to store and get data from, easy to code for, compact.
Click to expand...
Click to collapse
Regarding 2),
If I want to make the app accessible to people of different languages, which would be a better approach?
a) To create separate databases for different languages.
b) To create one database with the relevant tables for different languages.
K12 said:
Regarding 2),
If I want to make the app accessible to people of different languages, which would be a better approach?
a) To create separate databases for different languages.
b) To create one database with the relevant tables for different languages.
Click to expand...
Click to collapse
I would go for having one database and relevant tables for the different languages.

Categories

Resources