query where relation contains any object from array - android

Some time ago i tried to use a BaaS service (parse.com), now I want to make a query to fetch a result set where parse' table contained tag values as "tag1, tag2, tag2"
I found similar question, but it doesn't work fo me, in my case I get row where TAG column equals one of tags item, but not contained one of them
query.whereContainedIn("Tags", Arrays.asList("tag1", "tag2"));
If someone had same issue please help me resolve it or give a correct way to figure it out

Related

How to take values from .CSV and set them to a double?

I have been stuck on this problem for a few days and cannot find any help online. I want to take specific values from a .CSV depending on the user's location. My .CSV looks something like this:
State,Value
California,0.85
Arizona,0.95
New York,0.75
etc...
The app currently tracks the user's state and sets it to local like so:
final String local = address.get(0).getAdminArea();
I am trying to find a way to have the app look through the .CSV and find the row when local=[state] then take the value from the second column and set it to a double. I have no clue where to start and could really use any help anyone can provide! Thank you!
Just to clarify, I am not trying to print the .CSV, I only need to extract a single value.
Edit:
I solved the issue by using a buffered reader and reading the values into a HashMap then calling the correct key based on location.

Save and Load contents TStringGrid

I have a simple form containing TstringGrid with 2 columns, a TStringColumn and TCheckColumn added. I have seen many examples of saving the contents to file if the cells contain text or numbers. I have not seen any examples of saving with a TCheckColumn. I am assuming that I must check each CheckColumn cell, determine its state and assign a value that can be saved to file. Or maybe there is a more elegant way to do this.
As for sorting - again many examples using strings or numbers but none with TCheckColumn. I have HeaderClick enabled. On the TStringColumn I would like to sort Alphabetically - On the TCheckColumn - I would like checked items at the top of the column.
I am using Delphi 10.2.1 and will compile for Android.
Without saying you shouldn't start from here - I will just answer the specific questioN;
To keep it simple, I would:
Save: iterate through the rows and take the state of the checkboxes and prefix the string item with BoolToStr(theCheckValue)+':'+theContents of the string.
Then save the stringList.
To Load:
load into the stringList and then iterate and break the string apart using pos on the ':' and StrToBool the left portion, setting the checked item based on this.
Not got an IDE up, so haven't tested, but that would be my approach as a bit of a hack.

How to get Recently Added / Edited / Deleted contact from Phonebook in android

I making an application in which my requirement is to get the Recently Added or Edited or Deleted Contact in Phonebook. So is there is way to achieve this. Any help will be appreciated.
You need to show what you tried, so that we can write our answers based on your try.
First, make sure you have this:
<uses-permission android:name="android.permission.READ_CONTACTS" />
According to the android docs, you can easily read contacts, and, to get specific selections (which is exactly what you want) you can:
Define a search text expression that retrieves rows for a specific
contact's LOOKUP_KEY and the Data.MIMETYPE of the details you want.
Enclose the MIMETYPE value in single quotes by concatenating a "'"
(single-quote) character to the start and end of the constant;
otherwise, the provider interprets the constant as a variable name
rather than as a string value. You don't need to use a placeholder for
this value, because you're using a constant rather than a
user-supplied value.
Take a look at the different ways to get specific selection keys on contacts, so that you can get exactly what you want.
http://developer.android.com/training/contacts-provider/retrieve-details.html

Implementing OR Condition using Parse Android SDK?

I am new to Parse and i am working on a Project that uses Android PARSE Sdk so i was wondering on how can i make a where query with or condition using the android sdk.
I want to make a query like this [Psuedo code]
Select * from employ where employId is ("1","2","3")
I found this on parse documentation, i don't know if it helps or not.
Edit:
This is what i found on PARSE but its not working
String[] id= {"1","2","3"};
query.whereContainedIn("employId ", Arrays.asList(id));
It returns me an empty list but if i query them one by one i get result... Can anyone tell me whats wrong ?
You can use whereContainedIn to select specific rows. See this post you can get more ideas. https://www.parse.com/questions/different-arrays-and-wherecontainedin-for-android.
List<String> employId = new ArrayList<String>();
employId.add("1"); employId.add("2"); employId.add("2");
query.whereContainedIn("employId", employId);
If you are still not clear. check this https://www.parse.com/docs/android_guide#queries
I have found the solution and i must say its pretty lame of PARSE to not mention this anywhere in there documentation.
The problem was that the values that i was using inwhereContainedIn method were of type String but in reality they were pointers to another table's row.
I was trying to get the values using only there ids[as it is displayed on parse] but instead i had to pass the whole object in order to retrieve them. That was the reason on why it was returning empty list.
The thing is Even though it displays IDs [pointer to object in a table] we cant search using only ID's instead we have to use complete Parse objects if we want to search a table based on Specific Object.

Delete one single cell from ContactsContract-ContentProvider

Hi fellow android programmers,
I wan't my application to delete one single information from a contact and I don't mean one phonenumber or one adress, I actually mean like only the street from the adress or only the job_description from the organization. Technically I won't to delete one cell of one row in the Data-Table of the ContactsContract-ContentProvider.
I red the documentation twice, but they are only talking about whole rows when they describe the insert-, update-, delete-, query-Methods :(
Is anyone aware of how to delete one particular cell? Or am I supposed to update one row with one cell so to "" (empty string)? Or do I even need to read one whole row, set the one cell to "" (empty string) and update the whole row?
Cheers and thanks in advance Ali3n
Do not delete it.. try to update it..
1) add your new value of particular column, like contentValues.put(STREET,"");
2) update the table by using update method. and use a where condition where contact_id = ur id.
PS:column names are not right.

Categories

Resources