[Q] Newbie question for best Android coding practices - Android Software Development

Hi,
A year ago I developed an app as part of a group project at uni. Due to the limitations set by the project rules the app isn't properly designed for Android. The app is a tour guide, in 2 parts. The guide itself is an XML file which has all the content on it. The other part is the player, which is an Android app. The player parses the XML and forms Java Classes to store the data and then play it. The content is saved in the form of Slides in a Slideshow (part of the requirements of the project, not our choice). So for instance 1 slide will be the main menu, then clicking a button will take you to another slide which will be a sub menu and so on.
Now a year later I've come to update this app, originally I was just intending to change the AbsoluteLayouts we used to Relative/Linear/List/whatever works best for that particular slide and also to put the layouts into XML rather keep them in the Java. However I was wondering what would be the best Android practice for an app such as this?
The advantage of using XML for the guide is that say if we had a guide to a different city we could just upload that new XML to a server (the player can download remotely) and then download it to get a new tour guide. However would it be best for me to strip away all of this and start afresh, with Android in mind? I.E. by removing the need to parse an XML file at the start and just have a new app for each city.
I've been thinking about a complete overhaul as changing AbsoluteLayout will be a pain. At the moment each component is given X and Y coordinates in the main XML file, so changing that to relative commands, changing the parser to read that will be hard. Also it's best practice to store the layouts in R.layout but it would be hard to convert the layout from the main Tour Guide XML to a layout XML... if that makes sense :/
If I were to remove the main XML, how would I handle each menu or content page? Would they be given their own activity?
Sorry for the long post, I just want to be clear on what the best way to update this app would be and am just learning how to properly design Android apps. I really appreciate any advice and for taking the time to read this post!

If I've put this in the wrong forum then let me know and I'll move it
Sent from my GT-I9100 using XDA App

check out
http://www.appcelerator.com/
i created my first app using it
and its on the market with around 2k downloads
it has its issues and bugs but it was my first real coding experience.
its worth checking out
and its free

Related

Viewing Web-based PDF files within app

Hey all-
I am very new to developing (and Java). Currently working on my 2nd android app so be gentle here. Is there a way, or a good work-around to display web-based pdf files with android? Basically I am trying to have one of the buttons in my program pull up a website that happens to be a web-based pdf. I don't believe WebView will support that.
I have tried converting the pdf files to .png but I loose all the resolution I need as I need the user to be able to zoom in and see the detail.
Is there anyway to either host the pdf file on-line as something else and/or convert it to something else to make it available off-line?
Thanks for any help
Just throwing this out there, but why not have the link download the PDF file to the user's phone.
Only downside I see to this is in the even that the user doesn't have a PDF "viewer."
Otherwise, I'm not aware of any real way to display a PDF within the browser.
If someone can work this out, I'd be interested in learning his/her technique as well.
Thanks for the reply- I did think of doing it that way but I didn't want to make use of my app dependent on another app- It sounds like that's what I will have to do though as I have searched high and low without finding a solution. I had wanted to make two versions of the app- in the free version the user would need web access, in the paid version the user could have off-line access.
With Adobe's pdf viewer on the market for free and most new phones coming stock with pdf viewers, I suppose it wouldn't be the worst thing in the world. Is there no graphic format I can convert a pdf to and then host on-line? Thank you again
OREGONMX said:
Thanks for the reply- I did think of doing it that way but I didn't want to make use of my app dependent on another app- It sounds like that's what I will have to do though as I have searched high and low without finding a solution. I had wanted to make two versions of the app- in the free version the user would need web access, in the paid version the user could have off-line access.
With Adobe's pdf viewer on the market for free and most new phones coming stock with pdf viewers, I suppose it wouldn't be the worst thing in the world. Is there no graphic format I can convert a pdf to and then host on-line? Thank you again
Click to expand...
Click to collapse
Yeah, I know exactly what you are saying. Having an app-to-app dependency can cause quite a hysteria with users. They'll complain that the app is faulty and rate it 1 star.
My other suggestion would be to screenshot the PDF, page by page, and paste them into Photoshop and save the files as jpg's with the highest resolution. It will definitely take up a lot of your time if you have a lot of PDFs with many pages. Granted, you'll be taking up much more space, and the image will be loading a lot slower but you'll have pretty neat quality.
You'll have to weigh the factors on what you find more important - speed or quality.
If you don't mind me asking, what type of app are you making.
Thanks again- well just a few minutes ago my friend who is a bit more proficient with the whole coding thing came up with an idea that might just work-
he suggested taking the PDF and splitting it up into several different images and just creating an arrow button on the sides or top or bottom (depending on where in the image you are looking) and then applying an onClickListener to the buttons which will call up a different image view, which would be the next corresponding image/area of the pdf. I'm hoping that by cutting the pdf into small pieces like that and saving them as either jpg or png files I can retain the resolution I am after AND host them on-line myself for the free-app and give users the option to download the pdf to their SD card in the paid version- which would make my original idea a possibility.
My app is a program aimed at dirtbiking enthusiasts- surprisingly there is not a lot of crossover between the dirtbiking community and the developing community- I am all alone Ha!
I don't imagine I stand to make a bajillion dollars but learning android and java and actually seeing what I am doing work (sometimes) has been a fantastically gratifying experience. Just wish I had more time to do it- a 4-year-old and 5-year-old + wife + full-time job make it hard. I'm in no hurry though
That sounds fairly similar to what Facebook has on their "Touch" version of their site (touch.facebook.com)
If you view pictures within an album, you'll notice you get the arrows on the bottom left and right to keep switching between pictures.
Sounds like that would definitely work.
Keep me posted on your app. I give you props for even being on your 2nd app, as I've seen many people in your same situation (wife, kids, job) just give up after downloading the SDK.
But yeah, I'm interested to see how it turns out.
Thanks hopefully my vision will come together sooner rather than later. I'll keep you posted
Sent from my SGH-T959 using XDA App

Need Android Application Developer to Complete Mostly Finished App (Anywhere)

Found this and figure someone might be interested.
Taken from the Post:
looking for an Android application developer to pick up where another developer left off work on a drill-down Application/Travel Guide. It is a fairly simple application, displays tables, content and images in about 130 separate views. (The only animations are moving between views and scrolling through content.) Project is based on an existing iPhone application.
http://newyork.craigslist.org/mnh/cpg/2013929163.html

[REPO] The library thread

Hello everyone,
Based on the release of the new forums here, and the seemingly enthusiastic response, I have decided to create a repository of libraries that are useful to Android developers.
Libraries:
AChartEngine : This is a library that lets you make and display all kinds of charts, from line to bar to scatter charts. A very good solution, should you need charts.
Uses: Well... Charts!
Made by 4ViewSoft.
ActionBarSherlock: This library will help you in maintaining an easy-to-use and consistent UI across all version of Android above 2.1.
On Android 3.0+, it will use the native ActionBar, and below that, a backport of the 4.x native ActionBar has been used. Note that this is not needed if you want to target APIs that support the AB natively.
Made by Jake Wharton.
aFileChooser: The basic version of Android File Chooser, it features somewhat less graphical hints about, for example, your current folder, but does provide a somewhat cleaner UI.
Uses include a simple file chooser for opening a file from a specific folder.
Made by Paul Burke.
android-hybridchoice: A ListView that lets users open a single list item, while also letting you select one or more other items. This way, you can (for example) view a mail while selecting others to throw away, instead of having to do that separately.
Uses: Making any app with items that have detailed info in a ListView that can be changed.
Made by Kiran Rao.
android-lockpattern: A library for you to include a lock pattern in your app. It was adapted straight from Android source code, and is very useful for keeping data secure.
Uses: Root apps, apps with sensitive data or other apps that could hurt one's phone.
Made by Hai Bison.
Android FileChooser: Helps you in letting the user select a file. A visual GUI is made available to you and the user, through which the user can navigate to select a folder.
Use cases: A file explorer, a downloading action, moving/copying files, etc.
Made by Hai Bison.
Android Maps Extensions: A library that extends a number of Google Maps API v2 features. It features things like marker grouping, where it won't display individual markers when there's a lot of them together.
Can be used in an application with a Maps View, to make it clearer and easier to understand.
Made by Maciek G
Android Proxy Library: This lets you provide an easy and better (than Google's) solution to the Android Issue 1273 (OF DOOOOOOOM!). It allows you to easily get the proxy settings of an Android device.
Uses: You know, getting the proxy settings.
Made by Marco Pagliari.
BetterPickers: A cool library that implements the Android 4.2 Clock time picker for you to use in your own apps as you please. It is a very nice way to keep your app Holo-themed, and it continues the push for a consistent UI in Android.
Among others, uses include clock and calendar apps.
Made by Derek Brameyer.
Build.prop Tools: A library to get access to the properties in a device's build.prop, which include its codename, Android version, CPU name and others.
Uses: Having to edit or otherwise get access to certain build.prop entries in your app, for example to display system info.
Made by Jonathan Haylett.
Cieo: A library that lets you animate text. It is currently in very early Alpha stages of development, but does work.
Uses: Word games, for example Hangman, where you can add a little extra to make it more dynamic.
Made by Igor <LastNameUnknownException>.
DroidParts: This library helps you add the most used parts of Android apps without problems. It can help you add a number of more complicated parts that have been modded to be simpler, like an ImageFetcher and an improved ASyncTask.
Uses: Just about every app can do this. Easier everything!
Made by Alex Yanchenko.
droidText: A PDF creator library. Should you need to create a PDF easily, this is the library you want!
Uses include parsing user input and saving it to a PDF file for later use, or to send (i.e. via email).
Made by Markus Neubrand.
EventBus: This helps you tie together Activities, Fragments and background threads. It eliminates the need for overly complex listeners and interfaces, to make your life a lot easier.
Uses: Apps with background threads, Activities and/or Fragments working together.
Made by Markus Junginger.
FlipView: A FlipBoard-like animation to use for scrolling. Give your app a little extra eye candy, when you have multiple pages to scroll through.
Uses: News readers and other apps that separate content into clear "pages".
Made by Emil Sjölander.
GAST (Great Android Sensing Toolkit): A library to help you use an Android phone's internal sensors. It will help you control many sensor, including NFC, the camera and the accelerometer.
Uses: A diagnosing app, or one that uses certain sensors for controlling an app feature.
Made by Greg Milette and Adam Stroud.
GoogleDateTimePickers: TimePickers done right. A beautiful replacement for Google's standard DatePickers and TimePickers, It is designed with the Holo style in mind, and makes it much, much easier to select the date and time of your liking.
Uses: Letting the user pick a date or time, e.g. when setting an alarm.
Made by Mirko Dimartino.
Hansel And Gretel: This allows you to visually display the Fragment Stack. When you open a new Fragment, it is added to a 'tower' of Fragments, from which you can also pop (remove) the top one. This library allows you to visually represent that Stack in your app.
Uses: If, for example, you travel through multiple Fragments within one Activity, you can show which Fragments the user has gone through.
Made by Jake Wharton.
HoloEverywhere: A library that backports the Holo UI design to earlier Android versions (like ActionBarSherlock does for the ActionBar). It uses the Android 4.1 Jelly Bean assets and makes them usable on Android versions 2.1 Eclair and up.
Uses: An application that needs Holo on all platforms it runs on. Be aware that it might disrupt the UI consistency for the user, so think about that before including this in your app.
Made by Sergey Shatunov and Waza_Be.
Inscription: For displaying information about your app to the user. It contains a ChangeLogDialog and a WhatsNewDialog, where the former displays more detailed information (version numbers, etc.) than the latter.
Useful for showing a dialog after the user updated your app, without having to write too much code.
Made by Martin van Zuilekom.
JacksonInFiveMinutes: A library to help in parsing and processing JSON, offering different ways to do so: A streaming API, a tree model and data binding.
Of course, you can use this anywhere to parse JSON data (Twitter apps, for example).
Made by Tatu Saloranta (?).
JazzyViewPager: Makes it easy to add a nice effect when changing pages with a ViewPager. Easily done: just add it, change some references and pick an animation!
Uses: Spicing up your app's animation portfolio, when using a ViewPager.
Made by Jeremy Feinstein.
ListViewAnimations: An easy way of animating your ListView items easily and nicely, to give your app that little bit extra.
Uses: To spice up any ListView that needs more fancies.
Made by Niek Haarman.
NumericPageIndicator: A ViewPagerIndicator 'plug-in' that lets you easily display which page you're looking at. For example, show "page 2 of 20" at the bottom of the page.
Uses: Letting the user know which page they are on.
Made by Manuel Peinado.
OrmLite: A library that simplifies database interaction in Android apps. It is designed to work with multiple database systems, including SQLite and MySQL.
Uses: Database creation, management in Android. Various DB systems supported.
Made by Gray Watson.
osmdroid: An almost full, free replacement of Google's MapView. It includes numerous functionalities, like a number of on- and offline tile sources.
Uses: To add a map to your app, and easily use functionalities surrounding it.
Made by a number of non-disclosed awesome people!
PDFViewer SDK: A free PDF viewer library that works well. However, it does have a watermark on the screen, and you'll have to pay to remove it.
Uses are obvious: Building all kinds of PDF viewers!
Made by GEAR.it.
PlayView: This helps you in creating a Google Play-like style in your UI, by extending the CardsUI library (which can be found in the PlayView thread).
Good to use in an application where you want a nice smooth UI, with a modular and changeable look and feel.
Made by Androguide.fr and GadgetCheck, among others.
ProgressButton: A nice library that shows you the progress of a download in the same button that you press to start the download. See Google Music for a working example.
Comes in handy when there's a list of items to download, and you want to facilitate easy downloading and keeping tracks of those downloads.
Made by Prateek Srivastava, based off of Roman Nurik's examples.
PullToRefresh: Expand a Listview (multiple versions are supported) with the ability to refresh its content upon pulling down at the top.
Uses include social media clients, lists of other network-based updated items (orders, for example).
Made by Chris Banes.
Remote Metadata Provider: Get system information about, for example, which music is playing on your phone. This could help you implement lockscreen music controls for your app.
Uses: Lockscreen music controls, for example.
Made by XDA member Dr.Alexander_Breen.
RoboSpice: A library that makes long-running asynchronous tasks easy. For example, it offers caching (very useful for orientation changes).
Uses: Any app that implements an ASyncTask, especially when it is a bigger and longer-running one.
Made by Octo Technology.
RootTools: This library will make it very easy for you to gain superuser access and execute commands based on that. This way, you can, for example, move and replace files anywhere on the system.
This is especially handy when you are making a sort of backup app, or when you need the ability to do things that aren't possible without root access.
Made by Stericson.
ShowcaseView: This is a library that lets you highlight certain areas of the screen. Just like the Android launcher on first launch (or YouTube), it will allow you to tell the user how to interact with what, and what it does.
Uses: Clarifying certain UI elements and their purpose to the user.
Made by Alex Curran.
SlidingMenu: This lets you include a menu that slides into your app from the side, like the YouTube app has it. There, you can add a whole hosts of options and actions that don't fit or belong in the ActionBar. SlidingMenu also lets you customise the menu. The new Android supportv4 library version, revision 13, also has a basic version of this.
Uses: Menus with additional items, like channels in the YouTube app, shortcuts to your app's settings, etc.
Made by Jeremy Feinstein.
Spring For Android: A library that helps you integrate some features easily. For example, it can simplify using REST in your app.
Uses: Whenever your app needs REST of auth support.
Made by GoPivotal.
StandOut: A library that enables you to make your apps float! Basically, you can make any app you want float. Look in the thread for numerous examples!
Useful when you are making an app that is also used parallel to other apps, like a calculator or note taking app.
Made by Mark Wei.
StickyListHeaders: This is a great way to help you order alphabetised lists in a clear and very recognisable way. The current letter which you are scrolling through will be shown at the top of the screen, for as long as the first letter of the top item on the screen starts with that letter.
Use cases are, for example, scrolling through songs, email addresses, names and articles.
Made by Emil Sjölander.
Sugar ORM: An easy way to use SQLite libraries in your app. It takes away some of the more complex and annoying tasks of database management.
Uses: Managing and querying SQLite databases in your app.
Made by Satya Narayan.
UpdateChecker: This library is a quick and easy way of making sure that users know about updates to your app. It will show a Dialog every 5 times (by default) the app is launched, informing of an app update being available in the Play Store.
Uses: Making sure people update your app. It is handy in just about every app.
Made by Pietro Rampini.
ViewPagerIndicator: This library emulates the multiple ways of showing tab locations without using the ActionBar. This can be used to replicate the Play Store, older Google+ versions, launcher-like indicators and more!
This library is always handy when using tabs, but without wanting to, for example, sacrifice too much screen real estate to use the ActionBar.
Made by Jake Wharton.
Sites, etc. collecting libraries:
Android Libraries provides a big list of libraries for all sorts of tasks, including graphics engines.
Android Snippets is a collection of little snippets of code to help you in navigating some commonly (and less commonly) seen challenges in Android development.
Android UI Patterns for all kinds of UI libraries, with a nice app to go with it.
AndroidKickstartR is a web-based tool for quickly starting an Android app, including a number of (library) options to help ease some of the pain of adding extras. Fair warning: this seems to include older versions of some things, double check the generated project.
AndroidViews for multiple nice UI-based libraries that help make your app look and work awesome!
DevAppsDirect is an app with examples of libraries. Test without setting up a whole new project!
ramdroid77's Google+ community for GitHub-based libraries.
Libraries for developers: A nice little app that has a collection of libraries available to developers.
Also make sure to spread the word about and contribute to this repo!
Have fun,
bassie1995
very helpful thread! thanks mate
roottools is also a very helpful library: http://code.google.com/p/roottools/
nikwen said:
roottools is also a very helpful library: http://code.google.com/p/roottools/
Click to expand...
Click to collapse
Forgot that one as a big one. Shame, since I used it . Will add in a sec.
Sent from my Nexus 7 using Tapatalk HD
I used this library to include a file-chooser in my App:
https://code.google.com/p/android-filechooser/
Click to expand...
Click to collapse
and forked this, that acts basically the same:
https://github.com/dentex/aFileChooser
Click to expand...
Click to collapse
xda_dentex said:
I used this library to include a file-chooser in my App:
and forked this, that acts basically the same:
Click to expand...
Click to collapse
I shall be including this later today. Thanks for contributing!
bassie1995 said:
I shall be including this later today. Thanks for contributing!
Click to expand...
Click to collapse
You're welcome!
Also the other project seems valid. If you want, point to the original repository.
The main difference is that it stays on the standard sdcard only, by default.
I also found a really good site with cool libraries: http://www.androidviews.net/
I'm sure I will want to include some of them.
xda_dentex said:
You're welcome!
Also the other project seems valid. If you want, point to the original repository.
The main difference is that it stays on the standard sdcard only, by default.
I also found a really good site with cool libraries: http://www.androidviews.net/
I'm sure I will want to include some of them.
Click to expand...
Click to collapse
Yep, I'm including both. Also, AndroidViews is already mentioned at the bottom of the OP .
Sent from my Nexus 7 using Tapatalk HD
bassie1995 said:
...AndroidViews is already mentioned at the bottom of the OP
Click to expand...
Click to collapse
Oops... Sorry.
Sent from my GT-I9100 using xda app-developers app
I'm running a community on G+ about Android libraries hosted on github. Tons of stuff in there:
https://plus.google.com/u/0/communities/100609058582053363304
ramdroid77 said:
I'm running a community on G+ about Android libraries hosted on github. Tons of stuff in there:
https://plus.google.com/u/0/communities/100609058582053363304
Click to expand...
Click to collapse
Nice, will include the link in OP.
I was going to mention androidviews too; a very handy site. There's also a handy little app out on the Play store called Android UI Patterns (free), which is basically an app with quite a few libraries built in, so you can see what they look like in action on an actual device.
And I'm not sure if I should post this, or if it should have it's own thread (paid libraries or something), but I would argue that as there are quite a few professional developers here, a compilation of good, paid, non viral licensed libraries would be a good resource. On the other hand, XDA is all about the homebrew, open, sharing community.
Anyway, whatever the mod-gods decide, I was looking for a good, cheap, non-gpl3 licenced PDF framework for the company I work for. Many frameworks were RIDICULOUSLY expensive and many open source ones were SLOW or not functional enough. In the end I found a good alternative at androidpdf.mobi . It's fully functional, affordable and they have good support. I know this may sound like an add, but I spent some time researching this, we now use it in production and figure I might save someone some time.
MacDegger said:
I was going to mention androidviews too; a very handy site. There's also a handy little app out on the Play store called Android UI Patterns (free), which is basically an app with quite a few libraries built in, so you can see what they look like in action on an actual device.
And I'm not sure if I should post this, or if it should have it's own thread (paid libraries or something), but I would argue that as there are quite a few professional developers here, a compilation of good, paid, non viral licensed libraries would be a good resource. On the other hand, XDA is all about the homebrew, open, sharing community.
Anyway, whatever the mod-gods decide, I was looking for a good, cheap, non-gpl3 licenced PDF framework for the company I work for. Many frameworks were RIDICULOUSLY expensive and many open source ones were SLOW or not functional enough. In the end I found a good alternative at androidpdf.mobi . It's fully functional, affordable and they have good support. I know this may sound like an add, but I spent some time researching this, we now use it in production and figure I might save someone some time.
Click to expand...
Click to collapse
I have seen and used Android UI Patterns, forgot to include it.
About the licensed libraries/technologies, maybe that's a good divide for this thread. Not between UI and functional libraries, but between paid and free? Don't think there are many paid libraries for daily use, though?
If you can link me to the PDF parsing library you used, I will be including that.
Also, everyone, updates are a little slow due to school work. Hardest exam that's yet to come is on Monday, will update it probably that afternoon (my time zone ).
Sent from my Nexus 7 using Tapatalk HD
The pdf library is found at androidpdf.mobi.
You can d/l the sdk and use it for free; you pay to get rid of the watermark on each page (the fee is per application, though).
I have come across some paid UI widget libraries (coverflow type things etc). It took me a while to adapt existing OS code to achieve the same kind of effect, so sometimes, if it's the right price, it's more effective to buy these kinds of things...
AChartEngine is a good one for charts and graphs http://www.achartengine.org/
MacDegger said:
The pdf library is found at androidpdf.mobi.
You can d/l the sdk and use it for free; you pay to get rid of the watermark on each page (the fee is per application, though).
I have come across some paid UI widget libraries (coverflow type things etc). It took me a while to adapt existing OS code to achieve the same kind of effect, so sometimes, if it's the right price, it's more effective to buy these kinds of things...
Click to expand...
Click to collapse
tmka said:
AChartEngine is a good one for charts and graphs http://www.achartengine.org/
Click to expand...
Click to collapse
Thank you both. I hope to be updating the OP tomorrow.
Sent from my Nexus 7 using Tapatalk HD
StandOut is a great library to create floating app :good:
Hello everyone,
I'd suggest also DroidText, for creating PDF files
Tiwiz
ciao99 said:
StandOut is a great library to create floating app :good:
Click to expand...
Click to collapse
That looks awesome, I think I'll try it myself
tiwiz said:
Hello everyone,
I'd suggest also DroidText, for creating PDF files
Tiwiz
Click to expand...
Click to collapse
Nice, a PDF creator! I'll take a look and add it.
To everyone: Sorry for not updating, exams are busting my nuts right now . I'll try and get some more in there today or tomorrow .
Sent from my GT-I9300 using Tapatalk 2
With the exams over and spare time at 1:44 AM, I'll update this again with all the suggestions from this thread. I'll add more "external" ones later.
EDIT: Done!

Practice App Ideas

I am new to Android App development. I need some simple application ideas to practice. please give me some ideas. I just made Rock, Paper, Scissor game. So easy games like this will be fine(I think )
Build a notepad app that lets you write and save notes. Build it steps where you increase the difficulty as you go on:
Make an app with a textbox that lets you enter text
Add a save button and learn how to execute code when the button is hit. Whenever you encounter any problems or don't know what to do, use Google! There are a lot of other running the same path as you and me who have encountered problems. The solution is almost always a search away!
Implement a save function that saves the content when the button is hit. When the user reopens the app load the text file and put the content in the textbox. Tip: Use SharedPreferences
Time to add support for multiple notes! Start off by learning how to move between activities (windows), in your notepad app add a button labeled "All notes" that sends you to another activity when clicked. Use Google to finds articles on how to do this.
Once you've figured out how to move between windows, it's time to create a list with all the notes. To display a list you use ListViews, before jumping in to showing the actual notes create a mock list containing your favorite cars, cats, Justin Bieber songs, whatever! Once you get a hang of it, move on to the next step
Learn how to store multiple strings instead of just one. Check out JSON, it's a simple data structure that lets you store.. data. Tip: store the notes in JSONObjects in a JSONArray. The final JSON-string can be stored in SharedPreferences.
Once you get a grip of JSON, add an add button, preferably in the ActionBar, that lets you add notes. Save the new note in the JSONArray.
Replace the cars or cats that are currently shown by the created lists.
Voilà, you have a fully functional notepad app and you've learned how to: move between activities, store data, ListViews, find solutions with Google etc. Good luck!
What are you aiming for, eventually ? Do you want to be a game developer, utility developer, are you aiming for a job developing apps ?
That might help you decide what kind of test apps to make.
If you go for a game you could spend a fair bit of time dealing with the graphical elements and gameplay without understanding the basics... so before you do that I'd suggest getting familiar with the building blocks (Activity, Intent, Service, Handler, Looper and so on) first.
jokernw said:
I am new to Android App development. I need some simple application ideas to practice. please give me some ideas. I just made Rock, Paper, Scissor game. So easy games like this will be fine(I think )
Click to expand...
Click to collapse
I started with memory game, you can go for it as well

Way to store Preferences

Hey Guys,
I am creating a app to rename other apps via xposed and the main code is written. Now I simply want to make a interface where you can define a app to rename and then enter a new name. For the beginning I thought about a Activity where you enter the Package Name and the desired name. Later on I want to use a list view to show all apps, from where you can choose one to rename(Like App Settings etc.). To show the renamed apps I want to use a ListView. Now I am stuck with a problem: My xposed code works with an array to check and rename. The list view can be used with an array or an arraylist, but I need a way to store the preferences(which are stored in a array).
Do you have a good idea or a sample how to realise this? And does somebody know a nice App List type of thing(I googled, but the project there aren't usable with my kind of approach.)
GalaxyInABox said:
Hey Guys,
I am creating a app to rename other apps via xposed and the main code is written. Now I simply want to make a interface where you can define a app to rename and then enter a new name. For the beginning I thought about a Activity where you enter the Package Name and the desired name. Later on I want to use a list view to show all apps, from where you can choose one to rename(Like App Settings etc.). To show the renamed apps I want to use a ListView. Now I am stuck with a problem: My xposed code works with an array to check and rename. The list view can be used with an array or an arraylist, but I need a way to store the preferences(which are stored in a array).
Do you have a good idea or a sample how to realise this? And does somebody know a nice App List type of thing(I googled, but the project there aren't usable with my kind of approach.)
Click to expand...
Click to collapse
Ah the data storage problem... I think we all came across this at least once . I suppose you read this guide on the different options available? Well there are actually three options: SharedPreferences, text or csv file and SQL.
The first one would need some work around and is probably the slowest. You would save a separate string directly into the SharedPreferences (maybe in a new file to avoid collisions?) with the array name and its index somehow in the key. That's just two methods of coding but not the nicest way to do it.
The text or csv file however is the more common way, here you'd save your array in one line of the file, each item separated with a ; or some other char. Needs a bit more coding and also the WRITE_EXTERNAL_STORAGE permission on preKitKat if I remember correctly.
The third one is the nicest and most modular one. Because it makes use of SQL it needs quite a bit of knowledge and some coding (but less than the text file).
I guess for simple things that you want to do it is better to stay away from SQL for now unless you know how to use it and use the SharedPreferences.
Edit: take a look at the answers to this question, they give you the code as well... And you can use StringSets in ICS and above if the order of your list doesn't matter !
I'd say go down the SQLite DB way, chances are that if you plan on expanding your coding knowledge and want to keep creating apps you'll be needing to learn this in the future anyway so why delay?
Google AndroidHive and look at their SQL tutorial - I used it when learning and found it very informative
Sent from my HTCSensation using Tapatalk
Thank you very much! As coming from windows, first of all I thought about SQL as well, but it seems oversized for the set of data i want to store. I also took a look at the stackoverflow thread you linked. It looks easy to implement, but the need to use an external class file made me look for another way. I found this one, which works pretty well for me, as I look forward to interchange the method of saving the data with a better one using the SharedPreferences(which actually should be really easy with my code).
Maybe you can tell me yet another thing: Is there a way of declaring an object(like the ArrayList) to make it accessible from every class except from giving every class(activity) it's own "load the preferences" and "save the preferences" code block or sending intents all over the place? This would make saving much easier and allow me to update the preferences during runtime and without a reboot
Edit: This was my answer to.SimplicityApks ^^ I'll take a closer look at SQL now, since you, Jonny, told me that it' nevertheless necessary.
GalaxyInABox said:
Thank you very much! As coming from windows, first of all I thought about SQL as well, but it seems oversized for the set of data i want to store. I also took a look at the stackoverflow thread you linked. It looks easy to implement, but the need to use an external class file made me look for another way. I found this one, which works pretty well for me, as I look forward to interchange the method of saving the data with a better one using the SharedPreferences(which actually should be really easy with my code).
Maybe you can tell me yet another thing: Is there a way of declaring an object(like the ArrayList) to make it accessible from every class except from giving every class(activity) it's own "load the preferences" and "save the preferences" code block or sending intents all over the place? This would make saving much easier and allow me to update the preferences during runtime and without a reboot
Edit: This was my answer to.SimplicityApks ^^ I'll take a closer look at SQL now, since you, Jonny, told me that it' nevertheless necessary.
Click to expand...
Click to collapse
Welcome
You mean you want to make your ArrayList, which is an instance variable in the activity, accessible to every other class within your package without having an instance of your activity at hands? Well the basic solution would be to make the ArrayList static. But that is not recommended because it won't be created and garbage collected at the same time as your activity and also it's not a nice way .
If you had an instance of the activity it would be just using a public getter for it, but without I'd put your ArrayList into a separate class following the Singleton pattern. That way you have only one global instance which contains the ArrayList.
Thanks again for your reply! I changed my mind about the ArrayList and created a method, where everything is stored in the SharedPreferences and the ArrayList's only purpose is the use with the ListView and Adapter. This way I don't have to write the ArrayList to the SharedPreferences and changes will be much easier to control. Although I had to implement another type of save/load method to interact with the class thats being loaded by xposed. That was needed because of the restriction that you can only load SharedPreferences with a context, which my class doesn't have. It's an inconvenient way, but it works

Categories

Resources