Saving and Viewing/Editing data in Android - java

I have been working on an app that can save your passwords for you. I would like it to work similarly to a contacts application. For example, I want to have a screen that displays all the names of the passwords entered (like the names of your contacts), then when you click on the name, it takes you to a screen with all the information you previously entered on it (like the phone numbers/email addresses that would be in your contacts). I also would like a way to edit this information. I have been searching for almost 2 weeks now and have found nothing to help me. If someone could simply point me in the right direction, or tell me what this way of saving information would be called so I can research it, it would be GREATLY appreciated. If possible, could any answers be explained well enough that a fairly new developer could understand them.

I think you need a ListView and some Adapter to show the name of the password, and when you click one of them, you create an Intent which leads you to a new Activity which show the associated details. In the detail Activity you can do some editing job and save them to database or ContentProvider.
If I am right, I think you need to follow the tutorial of Android development to learn more about Android system.

Related

Make a table from user input in Android App

I am currently making an expense tracker on Android Studio. it is my first time so I'm not too experienced and am not expecting a fully coded answer, but maybe some guidance as I have not been able to find any resources online for my particular question.
So I know how to get user input, which in my case would be something like Amount Spent: and Location... etc. The only thing I am not familiar with is how to add/append this data to a table in Android.
For example, the table would look like this:
The user input would then be added to the table depending on the header.
I hope it will be helpful for you although in your post there is a few lack of description
Adding Table rows Dynamically in Android

Salesforce: Which API to use without Login required?

I'm currently working on a native Android app for my company and ran into some problems with Salesforce lately.
I hope I can find some help here.
What I want to achieve:
The company has a lot of Accounts in Salesforce with 3 important fields for the app: Name, Business (Workshop or Parts Dealer) and location(latitude, longitude)
I would like to show those Accounts(Workshops/Parts Dealers) as markers on a google map in my Android app based on a radius around the user's current location. So it would be more than sufficient to get the data as JSON or XML(i read about sObjects, which would be nice too)
The app will be freely available on Google Play Store and every user should be able to see all the Workshops/Parts dealers around the world.
The problem I'm facing is that I can't find a way to fetch the data inside my app without authenticating every user with a Salesforce-Login. 
Which API is the best to use in this case?
It would be so awesome if anybody could help me with this problem.
What I tried so far: 
- SalesforceMobileSDK: If i extend SalesForceApplication() i always end up with the Salesforce-Login Screen.
It seems that every client has to be authenticated for API-calls to work. I tried using the method peekUnauthenticatedRestClient(), but this method only works on full path URL's(e.g. "https://api.spotify.com/v1/search?q=James%20Brown&type=artist"), which isn't really practical for my Use-case.
I feel like I read nearly all docs about salesforce API, but can't quite get my head around how to solve this problem, although it seems like to be a pretty common use-case.  
would a salesforce-apex method which would select all records inside a set radius around the user's location to be accessible without authentication?
Thanks for your help in advance!
Roman
Try asking on salesforce.stackexchange.com. Your question is more about licensing model than a particular programming problem. It might even be the case that you don't really need Salesforce for your project, you'd be better off on Heroku (even free tier) if the login piece is an issue...
All Salesforce APIs require some form of authentication. If you're positive you don't want to hardcode "Integration user" credentials in the app and you don't want to pay for (self-)registered user licenses in your org...
Try to read about these:
Site - piece of Visualforce running under specific "guest user", letting you view & interact with SF data without having to log in. You expose SF data to the world but that means it's your job to handle security (if any) and craft the API. You want to really display the data to human? Or just return JSON content or what...
Sites are meant to be displayin some incentive to contact you. Your product catalog / basic order form. Some map of nearby locations. Maybe a "contact us" form. There's limit on the traffic so eventually they'll explode as your app gets popular:
Customer Community - typically you need named licenses (even if they're fairly cheap) to let your customers log in to your SF. You create a Contact, click magic button - boom, this Contact now has a real matching User record with its own license. Think of it as some kind of step up from Sites - it'll still have some limits but will offer more than just raw API access and you'll have better control on what's going on.

Tips for new Android app - maps, directions, transit

I'm not asking for anyone to build me an app.
I just need some tips on getting started.
So what I wanted to do:
be able to map some routes/directions, similar to what Google Maps already has regarding the local transit in a city.
Why? Because Google's database is a bit outdated, first. Second, because I want to create a local database with the routes and with the stations. Unfortunately, I can't really do that using Google Maps and I think Leaflet could help me with this much better. This would've been a web app, where someone with an account could add/edit/delete the routes.
create an Android app that :
a) sees the routes, allows an user to find the closest path to get from point A to B using only the routes I have in my database, sort by tram/bus etc
b) allows the user to mark a location and say something like "bus no 37 was here at hour:minute:second" - this would appear for anyone else that is using the app, similar to what another app lets you do this for police cars and traffic jams
c) extra: allow users to input some data so that my app could also give predictions; for example, someone inputs it took 10m50s to get from point X to point Y on route Z. That remains in a database and then someone else inputs some data for the same path...i would create some algorithm that could get predictions on where would a bus be now if someone marked it at Station 'bla' 5 minutes ago. I know, I know, this might be pretty hard, and it would be pretty inaccurate, I should consider the time of day, but it would just be something small, as an extra. Also, would be cool if this stuff could be added automatically: like the user sets the route he's on, starts "recording", then stops it when he gets off the vehicle and the time and locations are automatically taken into consideration.
Hope you understand what I have in my mind.
Thing is, what would you recommend?
I know Java, Spring MVC and a bit of Android. JavaScript, HTML and CSS won't be a problem. I need to combine these. If I will use Leaflet, as far as I can find, I won't really be able to use it in an Android APP, I would have to create a web app. At the same time, Google Maps doesn't really let me do what I want for my "personal" database. I can't even create decent custom routes by adding waypoints because parts of the Tramway Line aren't on streets with car access. ALso, would you think this is easier/better to do as an Android app or as a web app? I'm kinda new to Android.
I hope this isn't an unsuitable thing to ask on stackoverflow.
I'm open to any ideas.
allows an user to find the closest path to get from point A to B using only the routes I have in my database, sort by tram/bus etc
Routing is hard. Multi-modal routing (tram+bus+car+walking+cycle) even more so. See pgRouting and Valhalla. If you're going to do anything with public transport, then you'll have to deal with GTFS too.
Research into OpenTripPlanner also, as there are several actors developing some similar platforms.
I hope this isn't an unsuitable thing to ask on stackoverflow.
I'm afraid it kinda is - see https://stackoverflow.com/help/on-topic, point 4.

Android one time tutorial

I am trying to design an app and am really new to both coding and android development.
In my app, (a homework planner that uses SQLite Database), I want a screen to prop up once, the first time the app is launched, where the user enters a number of classes (such as math, english etc).
Anyone know how I can accomplish this? one of the main problems is how to have a screen that only runs the 1st time and then never again.
Thank you!
You could use SharedPreferences to store an attribute like 'firstTime'.
The first time the application is opened, you could alter the value and check it everytime the app is opened.
You can check your database, if the user entered a number of classes. If he dont, show this dialog, else not.
There are many other ways you could solve your problem!

Android Java: How to let your app remember an answer

I'm making a quiz application on my android phone, and I am struggling with a problem for a long time now, cause I don't know how to continue. The goal of my quiz-app is to let the user listen to a sound and guess what's the name of it. So you have to type your answer in a text box. If you type the wrong answer you can try it again. If you type the right answer the app must remember that you typed the right answer. So if you finished a question and you will later return to that question page, you will see the right answer you typed.
My application can check the answer you typed, but my question is do you have to make a whole database to let the app remember your answer? And is that possible on an application?
I hope someone can help me with my problem, cause I'm not that familiar with java and making apps...
You can easily use the SharedPreferences for this.
Just save a boolean to mark the question as answered.
Example:
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
preferences.edit().putBoolean("Question_ID", true).commit();
http://developer.android.com/reference/android/content/SharedPreferences.Editor.html
You have the following options for storage on Android: http://developer.android.com/guide/topics/data/data-storage.html
If you have a large amount of quiz questions then it is no question that you should use SQLite.
However, if you have a smaller number of questions, then storing data as CSV into a file or using SharedPreferences might be a minimum viable solution to get you on your way to a functional app.
http://developer.android.com/guide/topics/data/data-storage.html
You can use a simple file, shared preferences, or a database. Read the page linked above. It has everything you need including sample code and great explanations.
If your questions are ordered - and they should be, even if you're randomly presenting them, since you read them from some stream or have them in some array when your app starts - then the user's answers can take this same order, and your program's question of "did the user get this right?" (as well as many other useful questions that quizzing software might ask of itself) is answered this simply: what # question is this, internally? Oh, it's 42. So is userGotItRight[42] true or false?
userGotItRight[] is a boolean array, something you can effortlessly persist in a single SharedPreference.
You don't need SQL. You sure don't need a 1:1 map of questions to SharedPreference keys. As your program evolves you can store an evolved serializable object array instead of a boolean array, or you might have a preference per question bank.

Categories