Android: How to handle multiple account entry points - android

I'm sorry if this question is a little low-quality, kindly notify me about what to do if it is.
I just want to make a clarification. I am working on an app where users can sign up as three different types of users (student, parent or teacher). I want to know how this is usually done.
My current approach is to separate all of the Java/Kotlin files relating to each of the three user types into three different packages and simply follow the flow (from authentication). I feel that this is a little bogus and inefficient. How can I achieve this same feat with less files and less complexity?
If I'm supposed to include something I did not (snapshop, code snippet, etc), please let me know. Thank you!

Related

How do I create a widget on android to display a graph of online data?

I have a profile page as a music curator account, where it shows the score for various parameters there. The most relevant one, monthly listeners, is easily inferred (just a simple excel that I've compiled with the values found on the page), but not shown.
Even though I can constantly calculate it (approximately, because the page might not be consistently updated or might have some flawed calculations), I'm still trying to find a way to have that monthly listeners value updated constantly, and seen as a graph over time.
I was wondering if it's best to do it on android, windows or any other way, to simplify for a complete noob like me, any coding process that i might have to do.
I've only had a little experience in Arduino, so even the basics as to what language to use or the code neccesary for this are foreign to me, but I'm quite interested in learning more about it.
Any help is appreciated, thanks!

Allowing a user to update the contents of an app

I just want to start by saying I am doing this for a friend as a general information app and I am receiving no money for doing this. He would like an app to help inform his clients of different treatments as well as adding in daily memos etc. I can create an app no problem and have only created apps for general use and for my University assignments (I will also add that this is not a university project but just more to improve my own abilities). I am hoping someone may have a suggestion for how I can allow my friend to update the apps information easily. For example, I will be creating a general app that will display information (contact information, advice, guidelines, exercises etc) most of which will need updated every so often. He has also said he would like to add a daily update (almost like a daily tip or piece of advice). What I would really like help with, is for guidance on how I can have my friend maintain the app after I have done the project. I want an easy way for him to add/remove/edit memos or information. I haven't come across anything like this so I don't know if it is possible or if it is possible but complex etc. I hope I have explained the scenario well enough. Only looking guidelines of things I can research and do on my own, I just don't know where to start looking.

Android Hierarchical Navigation

I'm trying to get an example or a starting reference on how to develop a drill down structure. The best example I can give is, how Android navigates through it's own folder structure. Here is a screenshot to illustrate my point:
Some things I would like to point out:
I will have know knowledge of how deep the structure will run
Minimum API level 10
Could someone please point me in the right direction.
Many thank in advance!!
To those you are wondering how I managed this, I basically call the same activity, just with the parent ID (which will be located within the bundle). This way I can fill the ListView with the parent ID provided and let my BaseAdapter sort out which UI to display.
I don't know if the was the best way of doing it, but it worked for me.
Kind regards,
IMO, technically there is no limit on the structure depth. But for the sake of design, good user interaction with the app as well as for codes maintenance, I suggest 3 to 5 level deep is enough. If you must go further than that perhaps you should re-design the app.
And you may also use breadcrumb to improve structure visibility.
http://developer.android.com/reference/android/app/FragmentBreadCrumbs.html

Android project architecture: database and map?

My project is a visitor app for a University, that basically displays places and events on a map, and allows the users to interact with one another by making posts with advice/recommendations/questions and so on.
So far I've been trying out bits of code seperately (lists, tabs, the basics), following the android tutorials and trying things for myself. My problem is that I'm not sure how to combine all the bits of code into one project.
I know that I need to make a database, and a map (using OSM rather than google).
The database will store information on places, events, and posts that users have made. With co-ordinate information because they need to go on the map. This information is also displayed in seperate tabs - e.g. a list of places.
My problem is that I don't know how this will all fit together.
Will I need seperate classes for the database, populating the lists, and displaying on the map? Or can they all be in a single class?
I'm a little hazy on how the classes and activities are going to communicate, too. At the moment I'm thinking the database object is going to get passed to the listviews and mapview, which then take and display some of the information?
Any advice on how to cobble these elements together would be much appreciated. :D
I think I will need to subclass SQLiteOpenHelper for my database, so it'll need to be its own class?
I'm thinking of using OSMdroid for the map, which I'm not sure how to do yet.
And everything needs to be inside a tabview.
Welcome to StackOverflow!
Your question is very vague and broad, and likely to get closed as "not a real question" - I suggest you take problems one by one and ask specific questions as you go along and run into problems. Try to think about your problem in these terms: what's the minimal thing I need to get it to do the thing I want. Keep in mind that ANYTHING you want to do is possible, the main question to ask yourself is: what do you want your application to do exactly? Think about the number of different screens (activities), and how they would communicate to each other (when you click XXX, that will lead you to YYY, and so on). One advice: start simple, it's very easy to get buried in too much complexity, especially since it's your first project. It can quickly become very complex, even with a simple concept.
As you didn't specify your level of expertise in coding, it's difficult to give precise advices: but coding an android application is not very different from a "regular" application, with a web or Swing or C# user interface. So I would advise you to learn about OO programming in general, things like composition, inheritance, encapsulation, dependency injection, unit-testing, etc.
Then start writing a base Activity for your main view, write its layout, and add views and graphical elements to it. Then add the listener code for your widgets, that will generate Intents to other Activity.
Then add a DatabaseHelper when you want to save stuff in a database (that can come later, to begin with, you can just "stub" the interactions to a database, by writing what you would save to db on screen using Toast for example).
All objects can be injected into other objects by passing a reference to them, either at construction time or through setters.
Sorry not to be more precise, as I said it's a very vague question.

"Social" internationalization in Android application - loading resources dynamically

I have an idea to let users translate my application to their own languages.
I imagine this in this way:
If application is not translated to user's system language, English version of UI is displayed and user is asked for help in translation (it's obvious)
Next, user is asked for translate some phrases from English to his mother tongue. And asked to check some others translations. (it's a bit of work, but nothing sophisticated)
Hard part of my idea is:
User presses "update translation" and text resources for this application are update to latest editions.
Of course it's possible to make frequent updates, but this approach has some disadvantages:
1. I have to make all of those updates frequently, and not all of users will be happy with it.
2 Even if updates will be done weekly, time from make effort to get results will be too long form most of users, and probably, response will be not as good as it can be.
Have you any idea how to load translations "on-line"?
Android currently doesn't support this. To accomplish what you want, you'd need to insert your own resource handling code to return strings everywhere they are used in your UI. This means you couldn't let the framework load strings itself (for example no use of android:text="#string/something" in your layouts), and calling your own function to retrieve a string that wraps Resources.getString()/getText().
And you'll also need to deal with the fact that resource IDs are not stable and can change with every build of your app.
So you are looking at something quite non-trivial.
I have done some internationalizations using:
launchpad with android2po
getLocalization
I will first check if they have some kind of api. If there is no API, I would check the gettext's java implementation and handle translations with it.
You could cache any of the current user's translations in a file on the SD/storage, and show it to that specific user. Then, when it gets its weekly update, remove the cached file and start again?

Categories

Resources