Apex : How do I reach my bk variable stated in a lower bound? - range

I get a Variable does not exist: bk error in this code :
String MCLU1 = 'BK2200 0015 -- 41';
if (MCLU1 != null || MCLU1 != '') {
String bk = null;
String bk_full = null;
String bk_extension = '--';
String [] bkAfterSplit = null;
bk_full = MCLU1;
if (bk_full.contains(bk_extension)) {
bkAfterSplit = bk_full.split(' -- ');
bk = bkAfterSplit[0];
System.debug(LoggingLevel.DEBUG, 'bk inside my if : ' + bk);
} else {
bk = bk_full;
System.debug(LoggingLevel.DEBUG, 'bk inside my else : ' + bk);
}
} else {
System.debug(LoggingLevel.DEBUG, 'MCLU1__c is empty');
}
String external_id = 'FRA-BLIP-' + bk;
System.debug(LoggingLevel.DEBUG, 'bk outside my if/else : ' + bk);
System.debug(LoggingLevel.DEBUG, 'external_id : ' + external_id);
my bk variable on line 23 could not be found. But when I try the (almost) same code in eclipse with Java, everything works fine. Cf sample code bellow :
public class BkDoesNotExist {
public static void main(String[] args) {
String MCLU1__c = "BK2200 0015 -- 41";
// String MCLU1__c = null;
String bk = null;
String bk_full = null;
String bk_extension = "--";
String [] bkAfterSplit = null;
if (MCLU1__c != null || MCLU1__c != "") {
bk_full = MCLU1__c;
if (bk_full.contains(bk_extension)) {
bkAfterSplit = bk_full.split(" -- ");
bk = bkAfterSplit[0];
System.out.println("bk inside my if : " + bk);
} else {
bk = bk_full;
}
} else {
System.out.println("MCLU1__c is empty");
}
String external_id = "FRA-BLIP-"+bk;
System.out.println("bk outside my if : " + bk);
System.out.println("external_id : " + external_id);
}
}
Console shows :
bk inside my if : BK2200 0015
bk outside my if : BK2200 0015
external_id : FRA-BLIP-BK2200 0015
What am I missing here ?

OMG... I defined my variables just 1 level under the right place...
Instead of
String MCLU1 = 'BK2200 0015 -- 41';
if (MCLU1 != null || MCLU1 != '') {
String bk = null;
String bk_full = null;
String bk_extension = '--';
String [] bkAfterSplit = null;
bk_full = MCLU1;
It has to be
String MCLU1 = 'BK2200 0015 -- 41';
String bk = null;
String bk_full = null;
String bk_extension = '--';
String [] bkAfterSplit = null;
if (MCLU1 != null || MCLU1 != '') {
bk_full = MCLU1;

Related

error: Conditions must have a static type of 'bool'

I tried to make a calculator in flutter for the first time, but an error occur at the bool type that i don't understand. (on the "if" opertaion)
class _CalculatorAppState extends State<CalculatorApp> {
int? firstNum;
int? secondnum;
String? textToDisplay;
String? history = '';
String? res = '';
String? operation;
void btnOnClick(String btnVal){
print(btnVal);
if( btnVal == 'C'){
textToDisplay = '';
firstNum = 0;
secondnum = 0;
res= '';
} else if (btnVal == 'C'){
textToDisplay = '';
firstNum = 0;
secondnum = 0;
res= '';
history = '';
} else if ( btnVal == '+'||
btnVal == '-'||
btnVal == '/'||
btnVal == 'X') {
firstNum = int.parse(textToDisplay!);
res = '';
operation = btnVal;
} else if (btnVal == '='){
secondnum = int.parse(textToDisplay!);
if(operation = '+') {
res = (firstNum! + secondnum!).toString();
history = firstNum.toString() + operation.toString() + secondnum.toString();
}
if(operation = '-') {
res = (firstNum! - secondnum!).toString();
history = firstNum.toString() + operation.toString() + secondnum.toString();
}
if(operation = 'X') {
res = (firstNum! * secondnum!).toString();
history = firstNum.toString() + operation.toString() + secondnum.toString();
}
if(operation = '/') {
res = (firstNum! / secondnum!).toString();
history = firstNum.toString() + operation.toString() + secondnum.toString();
} else {
res = int.parse(textToDisplay! + btnVal).toString();
}
setState(() {
textToDisplay = res;
});
}
}
error: Conditions must have a static type of 'bool'. (non_bool_condition at [calculator] lib\main.dart:46)
error: Conditions must have a static type of 'bool'. (non_bool_condition at [calculator] lib\main.dart:50)
error: Conditions must have a static type of 'bool'. (non_bool_condition at [calculator] lib\main.dart:54)
error: Conditions must have a static type of 'bool'. (non_bool_condition at [calculator] lib\main.dart:58)
You're currently typing operation = 'x' which isnt valid syntax. You need a double '=', so:
if (operation == 'x') {
// do stuff
}
The equality operator is == not =.
At those lines listed you used = instead of ==.
And declare the variables as follows:
var firstNum = 0;
var secondnum = 0;
var textToDisplay = '';
var history = '';
var res = '';
var operation = '';

get_value of a feature in IFeatureCursor

I'm trying to read the attribute "POSTCODE" of the features in IFeatureCursor. The FID was successful read but the "POSTCODE" was failed. The runtime error 'An expected Field was not found or could not be retrieved properly. Appreciate your advise. Paul
private void test2(IFeatureCursor pFeatc1)
{
IFeature feature = null;
IFields pFields;
int ctcur = 0;
while ((feature = pFeatc1.NextFeature()) != null)
{
pFields = feature.Fields;
int indxid = pFields.FindField("FID");
int indxpost = pFields.FindField("POSTCODE");
object valu = feature.get_Value(indxid);
string valupost = feature.get_Value(indxpost);
string aValu = Convert.ToString(valu);
Debug.WriteLine("FID: " + aValu + " Postcode: " + valupost);
ctcur++;
feature = pFeatc1.NextFeature();
}
MessageBox.Show("count cursor = " + ctcur);
}
I have modified the program and successfully read the feature attribute 'POSTCODE'. I have added IFeatureClass.Search(queryFilter, true) to search the feature again by FID and save in a cursor then use the 'feature.get_Value' to read the attribute. Please see my updated code below. Thanks.
private void test2(IFeatureCursor pFeatc1)
{
IMxDocument mxdoc = ArcMap.Application.Document as IMxDocument;
IMap map = mxdoc.FocusMap;
IFeatureLayer flayer;
IMaps pMaps = mxdoc.Maps;
for (int i = 0; i <= pMaps.Count - 1; i++)
{
map = pMaps.get_Item(i);
IEnumLayer pEnumLayer = map.get_Layers(null, true);
pEnumLayer.Reset();
ILayer pLayer = pEnumLayer.Next();
while (pLayer != null)
{
if (pLayer.Name == "AddrKey")
{
Debug.WriteLine("Layer: " + pLayer.Name);
flayer = (IFeatureLayer)pLayer;
IFeatureLayer pFeatureLayer = (IFeatureLayer)pLayer;
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
IFeature feature = null;
IFields pFields;
while ((feature = pFeatc1.NextFeature()) != null)
{
pFields = feature.Fields;
int indx = pFields.FindField("FID");
object valu = feature.get_Value(indx);
string sFID = Convert.ToString(valu);
IQueryFilter queryFilter = new QueryFilter();
queryFilter.WhereClause = ("FID = " + sFID);
Debug.WriteLine("FID: " + sFID);
queryFilter.SubFields = "POSTCODE";
int fieldPosition = pFeatureClass.FindField("POSTCODE");
IFeatureCursor featureCursor = pFeatureClass.Search(queryFilter, true);
while ((feature = featureCursor.NextFeature()) != null)
{
MessageBox.Show(feature.get_Value(fieldPosition));
}
feature = pFeatc1.NextFeature();
}
}
pLayer = pEnumLayer.Next();
}
}
}

Convert Number to Words in apex salesforce

Below apex code can be used to convert number (currency) into words. This code can be used in triggers,visualforce pages to convert any number/currency field value in words and stored in any text field.
How to call this class
Decimal d = 1491511.61;
NumberTOWordConvertion nwcObj = new NumberTOWordConvertion();
String numInWords = nwcObj.getNumberTOWordConvertion(d);
Output : Fourteen Lakh Ninety One Thousand Five Hundred and Eleven Rupess And Sixty One Paisa Only.
public class NumberTOWordConvertion {
// Call this method with Number to convert
public String getNumberTOWordConvertion(Decimal num) {
Decimal junkVal = num;
Decimal junkValPaisa = junkVal - Math.floor(junkVal);
junkVal = Math.floor(junkVal);
String obStr = junkVal.toPlainString();
String[] numReversed = obStr.split('');
String[] actnumber = reverse(numReversed);
String firstHalf = convertInWords(numReversed, actnumber);
Integer tmp = Math.round(junkValPaisa * 100);
junkValPaisa = (Decimal)tmp / 100; System.debug('jj :' + junkValPaisa);
String paisaStr = junkValPaisa.toPlainString();
String secondHalf;
if (paisaStr == '0') {
secondHalf = '';
} else if (paisaStr.length() != 4) {
paisaStr = paisaStr + '0';
paisaStr = paisaStr.substring(2);
String [] numReversedPaisa = paisaStr.split('');
String[] actnumberPaisa = reverse(numReversedPaisa);
secondHalf = convertInWords(numReversedPaisa, actnumberPaisa);
} else {
paisaStr = paisaStr.substring(2);
String [] numReversedPaisa = paisaStr.split('');
String[] actnumberPaisa = reverse(numReversedPaisa);
secondHalf = convertInWords(numReversedPaisa, actnumberPaisa);
}
String SumOFHalves = '';
if (secondHalf.length() > 4) {
firstHalf = firstHalf.replace('Only', 'Rupess And ');
secondHalf = secondHalf.replace('Only', 'Paisa Only');
SumOFHalves = firstHalf + secondHalf;
} else {
firstHalf = firstHalf.replace('Only', 'Rupess Only');
SumOFHalves = firstHalf;
}
// IF amount has any value
if (SumOFHalves.length() > 5) {
return SumOFHalves;
} else {
return '';
}
}
// Method reverse the number
public List<String> reverse(List<String> strToRev) {
List<String> revList = new List<String>();
for (Integer i = strToRev.size() - 1; i >= 0; i--) {
revList.add(strToRev.get(i));
}
revList.add('');
return revList;
}
public String convertInWords(String[] numRev, String[] actnum) {
List<String> iWords = new List<String> {'Zero', ' One', ' Two', ' Three', ' Four', ' Five', ' Six', ' Seven', ' Eight', ' Nine'};
List<String> ePlace = new List<String> {' Ten', ' Eleven', ' Twelve', ' Thirteen', ' Fourteen', ' Fifteen', ' Sixteen', ' Seventeen', ' Eighteen', ' Nineteen'};
List<String> tensPlace = new List<String> {'dummy', ' Ten', ' Twenty', ' Thirty', ' Forty', ' Fifty', ' Sixty', ' Seventy', ' Eighty', ' Ninety' };
Integer iWordsLength = numRev.size();
String totalWords = '';
List<String> inWords = new List<String>();
for (Integer k = 0; k < iWordsLength; k++) {
inWords.add('');
}
String finalWord = '';
Integer j = 0;
// Main For loop
for (Integer i = 0; i < iWordsLength; i++) {
if (i == 0) {
if (actnum[i] == '0' || actnum[i + 1] == '1') {
inWords[j] = '';
} else {
inWords[j] = iWords[Integer.valueof(actnum[i])];
}
inWords[j] = inWords[j] + ' Only';
} else if (i == 1) {
if (actnum[i] == '0') {
inWords[j] = '';
} else if (actnum[i] == '1') {
inWords[j] = ePlace[Integer.valueof(actnum[i - 1])];
} else {
inWords[j] = tensPlace[Integer.valueof(actnum[i])];
}
} else if (i == 2) {
if (actnum[i] == '0') {
inWords[j] = '';
} else if (actnum[i - 1] != '0' && actnum[i - 2] != '0') {
inWords[j] = iWords[Integer.valueof(actnum[i])] + ' Hundred and';
} else {
inWords[j] = iWords[Integer.valueof(actnum[i])] + ' Hundred';
}
} else if (i == 3) {
if (actnum[i] == '0' || actnum[i + 1] == '1') {
inWords[j] = '';
} else {
inWords[j] = iWords[Integer.valueof(actnum[i])];
}
if (actnum[i + 1] != '0' || Integer.valueof(actnum[i]) > 0) {
inWords[j] = inWords[j] + ' Thousand';
}
} else if (i == 4) {
if (actnum[i] == '0') {
inWords[j] = '';
} else if (actnum[i] == '1') {
inWords[j] = ePlace[Integer.valueof(actnum[i - 1])];
} else {
inWords[j] = tensPlace[Integer.valueof(actnum[i])];
}
} else if (i == 5) {
if (actnum[i] == '0' || actnum[i + 1] == '1') {
inWords[j] = '';
} else {
inWords[j] = iWords[Integer.valueof(actnum[i])];
}
if (actnum[i + 1] != '0' || Integer.valueof(actnum[i]) > 0) {
inWords[j] = inWords[j] + ' Lakh';
}
} else if (i == 6) {
if (actnum[i] == '0') {
inWords[j] = '';
} else if (actnum[i] == '1') {
inWords[j] = ePlace[Integer.valueof(actnum[i - 1])];
} else {
inWords[j] = tensPlace[Integer.valueof(actnum[i])];
}
} else if (i == 7) {
if (actnum[i] == '0' || actnum[i + 1] == '1' ) {
inWords[j] = '';
} else {
inWords[j] = iWords[Integer.valueof(actnum[i])];
}
inWords[j] = inWords[j] + ' Crore';
} else if (i == 8) {
if (actnum[i] == '0') {
inWords[j] = '';
} else if (actnum[i] == '1') {
inWords[j] = ePlace[Integer.valueof(actnum[i - 1])];
} else {
inWords[j] = tensPlace[Integer.valueof(actnum[i])];
}
}
j++;
}
// End of For loop
// Reverse the List
inWords = reverse(inWords);
for (Integer i = 0; i < inWords.size(); i++) {
finalWord += inWords[i];
}
return finalWord;
}
}
String.valueOf(num);
returns the string equivalent of the num

'DATE' cannot hold values of type 'INTEGER'

I've set up an SQL database and used 'Date' as my column header which obviously has its own format as opposed to integer or char etc. However when I put in a date such as 2/11/2016 it gives me the error message - 'DATE' cannot hold values of type 'INTEGER'. Does anyone know what code I should be using? Here's my jsp below. All goes into DB when I remove all reference to date.
<%
int tableNum = 0;
String firstName = null;
String lastName = null;
String Address = null;
int Phone = 0;
java.sql.Date date = null;
int People = 0;
if (request.getParameter("table_num")!=null){
tableNum = Integer.parseInt(request.getParameter("table_num"));
}
if (request.getParameter("first")!=null){
firstName = request.getParameter("first");
}
if (request.getParameter("last")!=null){
lastName = request.getParameter("last");
}
if (request.getParameter("address")!=null){
Address = request.getParameter("address");
}
if (request.getParameter("phone")!=null){
Phone = Integer.parseInt(request.getParameter("phone"));
}
if (request.getParameter("date")!=null){
java.util.Date utilDate = new java.util.Date(request.getParameter("date"));
date = new java.sql.Date(utilDate.getTime());
}
if (request.getParameter("people")!=null){
People = Integer.parseInt(request.getParameter("people"));
}
if(tableNum != 0 && firstName != null && lastName != null && Address != null && Phone != 0 && date != null && People != 0){
String URL = "jdbc:derby://localhost:1527/Reservations";
String USERNAME= "johnpaul";
String PASSWORD= "purlease";
Connection myCon = null;
Statement ste = null;
PreparedStatement preparedStmt = null;
try{
Class.forName("org.apache.derby.jdbc.ClientDriver");
System.out.println("Connecting to DB...");
Connection con=DriverManager.getConnection("jdbc:derby://localhost:1527/Reservations","johnpaul", "purlease");
System.out.println("Connected successfuly");
System.out.println("Inserting records into table");
Statement st = con.createStatement();
String query = "INSERT INTO CUSTOMER_RESERVATIONS(TABLE_NUM,FIRST_NAME,LAST_NAME,ADDRESS,TELEPHONE,DATE,NUMBER_IN_PARTY)VALUES(" + tableNum + "," + "'" + firstName + "'" + "," + "'" + lastName + "'" + "," + "'" + Address + "'" + "," + Phone + "," + date + "," + People +")";
st.executeUpdate (query);
System.out.println("Records inserted");
}catch(SQLException se){
se.printStackTrace();
}catch(ClassNotFoundException se){
//Handle errors for JDBC
se.printStackTrace();
}catch(Exception e){
//Handle errors for Class.forName
e.printStackTrace();
}
}
%>

How can update contact in existing contact update to postal address

This is my code to existing contact to change the postal address code
ops = new ArrayList<ContentProviderOperation>();
rawContactID = ops.size();
///Insert code are working/////
ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID,rawContactID)
.withValue(ContactsContract.Data.MIMETYPE,ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.STREET,addr)
.withValue(ContactsContract.Data.MIMETYPE,ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.CITY, edtcity.getText().toString())
.withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE, edtpostcode.getText().toString())
enter code here
`enter code here` .withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.COUNTRY, edtcountry.getText().toString()).build());
//// I am trying this update record code but not working///
btn_upcontacts.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View view) {
ops.add(ContentProviderOperation
.newUpdate(ContactsContract.Data.CONTENT_URI)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactID)
.withSelection(String.valueOf(CONTENT_URI), new String[]{CommonDataKinds.StructuredPostal.RAW_CONTACT_ID + " = " + rawContactID})
.withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.STREET, addr)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactID)
.withSelection(String.valueOf(CONTENT_URI), new String[]{CommonDataKinds.StructuredPostal.RAW_CONTACT_ID + " = " + rawContactID})
.withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.CITY, scity)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactID)
.withSelection(String.valueOf(CONTENT_URI), new String[]{CommonDataKinds.StructuredPostal.RAW_CONTACT_ID + " = " + rawContactID})
.withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE, scode)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactID)
.withSelection(String.valueOf(CONTENT_URI), new String[]{CommonDataKinds.StructuredPostal.RAW_CONTACT_ID + " = " + rawContactID})
.withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.COUNTRY,scountry)
.build());
try {
getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (OperationApplicationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
I am update the record coding to btn_upcontacts listner but not working,Please Help me
I am trying the many code use are but not working
I have a simply edit the text andd update to the exsiting contact the postal address without the sqllite datbase
Advance in Thanks
int _contact_id = 10110; // your Conatct id
Uri rawContactUri = null;
Cursor rawContactCursor = null;
try {
// if some fields not available use rawContactUri as ID
rawContactUri = null;
rawContactCursor = context.getContentResolver().query(
ContactsContract.RawContacts.CONTENT_URI,
new String[]{ContactsContract.RawContacts._ID},
ContactsContract.RawContacts.CONTACT_ID + " = " + _contact_id,
null,
null);
if (!rawContactCursor.isAfterLast()) {
rawContactCursor.moveToFirst();
rawContactUri = ContactsContract.RawContacts.CONTENT_URI.buildUpon().appendPath("" + rawContactCursor.getLong(0)).build();
}
rawContactCursor.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (rawContactCursor != null) {
rawContactCursor.close();
}
}
Boolean noAddress = true;
Cursor currAddr = null;
try {
Uri URI_ADDRESS = ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_URI;
String SELECTION_ADDRESS = ContactsContract.CommonDataKinds.StructuredPostal.CONTACT_ID + " = ? AND " +
ContactsContract.CommonDataKinds.StructuredPostal.MIMETYPE + " = ?";
String[] SELECTION_ARRAY_ADDRESS = new String[]{
String.valueOf(_contact_id),
ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE};
currAddr = context.getContentResolver().query(URI_ADDRESS, null, SELECTION_ADDRESS, SELECTION_ARRAY_ADDRESS, null);
if (currAddr.getCount() > 0) {
currAddr.moveToFirst();
while (!currAddr.isAfterLast()) {
noAddress = false;
currAddr.moveToNext();
}
} else {
noAddress = true;
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (currAddr != null) {
currAddr.close();
}
}
if (noAddress) {
// address is not available
try {
String street_name = "strt";
String number ="num";
String apartment = "app";
String postal_code = "7777";
String state ="state";
String city = "cityty";
String country = "countrrry";
ContentValues adrsValues = new ContentValues();
adrsValues.put(ContactsContract.Data.RAW_CONTACT_ID, ContentUris.parseId(rawContactUri));
adrsValues.put(ContactsContract.CommonDataKinds.StructuredPostal.TYPE, "1");
adrsValues.put(ContactsContract.CommonDataKinds.StructuredPostal.STREET,
(street_name.length() > 0 || number.length() > 0) ? number + " " + street_name : number + " " + street_name);
adrsValues.put(ContactsContract.CommonDataKinds.StructuredPostal.NEIGHBORHOOD,
(apartment.length() > 0) ? apartment : "");
adrsValues.put(ContactsContract.CommonDataKinds.StructuredPostal.CITY,
(city.length() > 0) ? city : "");
adrsValues.put(ContactsContract.CommonDataKinds.StructuredPostal.REGION,
(state.length() > 0) ? state : "");
adrsValues.put(ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE,
(postal_code.length() > 0) ? postal_code : "");
adrsValues.put(ContactsContract.CommonDataKinds.StructuredPostal.COUNTRY,
(country.length() > 0) ? country : "");
adrsValues.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE);
context.getContentResolver().insert(ContactsContract.Data.CONTENT_URI, adrsValues);
} catch (Exception e) {
isError = true;
e.printStackTrace();
}
} else {
// address is already available
try {
String street_name = "strt";
String number ="num";
String apartment = "app";
String postal_code = "7777";
String state ="state";
String city = "cityty";
String country = "countrrry";
ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
.withSelection(where1, AryStructuredAdd1)
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.STREET,
(street_name.length() > 0 || number.length() > 0) ? number + " " + street_name : number + " " + street_name)
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.NEIGHBORHOOD,
(apartment.length() > 0) ? apartment : "")
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.CITY,
(city.length() > 0) ? city : "")
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.REGION,
(state.length() > 0) ? state : "")
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE,
(postal_code.length() > 0) ? postal_code : "")
.withValue(ContactsContract.CommonDataKinds.StructuredPostal.COUNTRY,
(country.length() > 0) ? country : "")
.build());
} catch (Exception e) {
isError = true;
e.printStackTrace();
}
}