Can someone explain ContactsContracts? - android

I'm relatively new to android and programming in general and I'm practicing by trying to make an app that emulates what the Contacts/People app does (show my contacts). I've spent some time doing research and I'm having trouble understanding how ContactsContract work.
I'm not understanding how to access the contacts information, for example Emails, Phone numbers and addresses. I know you can get the contact _id or lookup_key (not sure which is better) from the ContactsContract.Contacts but to get all the compiled information for that particular aggregated contact would mean that you have to go through all the raw contacts associated with it. That seems inefficient and complicated. Is there a way to access all that information from one spot for example say a "ContactsContract.Contacts.Data.(Data associated with that aggregated Contact)"?
On a side note, would it be possible to modify the data (i.e adding a new phone number or removing an email) directly into that "ContactsContract.Contacts.Data" table if it exists? I have done little to no research on adding information to contacts so this may actually be really easy and I have no clue, I just thought I'd ask while I'm here.

Simple example of ContactsContract API
Just to let you know some stack overflow users will down mark you or stop your post because you say you not done much looking etc. So be sure to have a look on the net before you ask a question hope this link helps you.

Related

How Would i Store OCR text into SQLite database?

I am developing a routine app to store the data of Routine posted on a notice board based on a keyword entered. For example, if you are from group A (should be certain unique keyword), Just enter the Keyword and Scan the piece of Paper and it will store the data from it to your phone.So that's the Concept.I have gotten to the point where my phone can detect text.But i am stuck on storing the data.Can any one help?
PS: I am new to android development..So please Elaborate it a bit..
first things first, this question is very broad and asks for a final solution, not really about a problem. You should learn more about Android development with tutorials and classes you can find free online.
Now, to answer some part of it, here follows a class on GitHub that accesses the database and persists some things:
https://github.com/ravi8x/AndroidSQLite/blob/master/app/src/main/java/info/androidhive/sqlite/database/DatabaseHelper.java
You have to pay attention to the code in GitHub, since it uses additional classes you can browse. I hope this is enough to help you a bit.

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.

How to get a list of locally stored phone contacts with App Inventor 2?

So wasn't sure how to title this one but I'm hoping someone with Android experience can answer this for me.
I'm trying to turn Android code into App Inventor 2 code. I need to start a new activity and have the relevant Action, ActivityPackage, ActivityClass, DataType, ExtraKey, ExtraValue (whether all of these are needed for this specific situation I'm not sure) to input into an ActivityStarter that views the locally stored phone contacts.
I am sure there is a way, there is in just Android app making with Java but I need help translating that code across. I'm pretty sure I want an android.intent.action.VIEW and contactsContract.CommonDataKindsPhone I'm just not sure in which parts in should go and what else I need to than be able to add that information to a list.
This is what I have so far:
I'm sure others would appreciate this information, as well as how to get other related data to contacts into App Inventor 2.
Also I know about ContactPicker.PhoneNumberList and PhoneNumberPicker.PhoneNumberList neither of which are able to find any contacts on my phone which is why I'm trying to work out a work-around.
Anyway any help is appreciated,
Thanks.
Unfortunately it's not possible to get a list of locally stored phone contacts with App Inventor. See also issue 734 in the Issues List. I suggest you to star this issue, so probably one day we get this feature into App Inventor.
The ContactPicker.PhoneNumberList or PhoneNumberPicker.PhoneNumberList only give you all phone numbers of a contact after picking a contact.
App Inventor has its limitations and unfortunately you can't do something like this as described in this Stackoverflow answer. The only thing you can do is to access the Google Contacts API with the web component to get a list of contacts, but precondition is, your contacts are synchronized with Google, but this is not what you want. An example to do that you can find here.

Database options for android?

I am a CS major and I just recently decided to start putting some of my java knowledge to use by learning how to program with Android. I have just been doing tutorials and reading some books on how to get started, but I would like to write an app and eventually release it to the app store. I have most of the ins and outs of the app figured out, but I'm not sure how to approach data storage. Part of my app will track shipping numbers and info, however, each shipment will have a pretty long list of fields (Name, ID, Address, Weight, Girth, ect.). The list in full approaches 10 items, if you include optional fields. Thats a lot of information to have a user fill out, especially if they have to do it on their phone (app is designed for small businesses, so lots of shipping for tracking). I would prefer not to have to build a sister website to hold this info for the user, so I guess my question would be, is there a service for mobile apps to use to push and pull info that a user could access through their computer? Or would it be better to use a file uploader and just format the info? I'm still an android novice, so I figured I need a little advice from the pros. Any and all advice would be appreciated, and if you know a database type service that is safe and reliable, that would help very much. Thank you!

How to insert rows/info into Android SQL DB with EditText and Buttons?

im working on a simple Android app, it is much like any other simple Database app. I have 4 EditText fields where the user inputs 4 different small pieces of text. I want this text to be inserted in to my Database table in the corrects rows for my columns. I am not really sure how to go about doing this. I know onClickListener needs to be used but not sure how to use it.
What you are looking for is the glue to make it work, as you have a storage ( your database ) and the user interface. But, as you pointed out just right, your onClick actions, or more widely spoken, your whole user-interaction needs to be filled with action.
I won't give you a specific advice here as I think you should read a bit about the Model-View-Controller Pattern here, as well as about how Android handles all that stuff. A good entrypoint for gaining knowledge is, as always, Wikipedia.
Don't get me wrong, I don't mean to offend you by not answering the specific question: I just think it's more valuable for you to first learn the basics required for building great apps instead of reading a step-by-step manual!
On my phone right now, but you are correct about setting up an onClick method for, let's just say, a Submit button.
I would look at the Developers Guide on the SQLiteDatabase on ways to insert values by executing a SQL statement or check into using ContentValues to insert values when the button's pressed, both could help you out.
Also, with a fair share of knowledge on databases the Developer Guide should be all you need, but if you need further help search for related questions.
NOTE
A good practice is getting used to debugging your code using LogCat. It helps when things go astray, especially when working with databases.
Tne Notepad Tutorial in the Android Developer Documentation takes you through creating an application which stores data from fields in an SQLite database.
You could work through this, or if you didn't want to do that it would be a good source of sample code.

Categories

Resources