Example usage for android.database Cursor getColumnIndexOrThrow

List of usage examples for android.database Cursor getColumnIndexOrThrow

Introduction

In this page you can find the example usage for android.database Cursor getColumnIndexOrThrow.

Prototype

int getColumnIndexOrThrow(String columnName) throws IllegalArgumentException;

Source Link

Document

Returns the zero-based index for the given column name, or throws IllegalArgumentException if the column doesn't exist.

Usage

From source file:com.example.user.lstapp.CreatePlaceFragment.java

private String getRealPathFromURI(Context mContext, Uri contentUri) {
    String[] proj = { MediaStore.Images.Media.DATA };
    CursorLoader loader = new CursorLoader(mContext, contentUri, proj, null, null, null);
    Cursor cursor = loader.loadInBackground();
    int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
    cursor.moveToFirst();// www  .j  av  a2 s.  c  o m
    return cursor.getString(column_index);
}

From source file:com.bitants.wally.fragments.SavedImagesFragment.java

private ArrayList<Uri> getFileUrisFromCursor(Cursor cursor) {
    ArrayList<Uri> filePaths = new ArrayList<Uri>();
    if (cursor != null) {
        int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media._ID);
        while (cursor.moveToNext()) {
            int imageID = cursor.getInt(columnIndex);
            Uri uri = Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
                    Integer.toString(imageID));
            filePaths.add(uri);//from   www. ja  va  2  s  .  c  o  m
        }
    }
    return filePaths;
}

From source file:com.cloudstudio.camera.ForegroundCameraLauncher.java

/**
 * Queries the media store to find out what the file path is for the Uri we
 * supply/* w  w w .  jav a2 s  .c o m*/
 * 
 * @param contentUri
 *            the Uri of the audio/image/video
 * @param ctx
 *            the current applicaiton context
 * @return the full path to the file
 */
private String getRealPathFromURI(Uri contentUri, CordovaInterface ctx) {
    String[] proj = { _DATA };
    Cursor cursor = cordova.getActivity().managedQuery(contentUri, proj, null, null, null);
    String[] dd = cursor.getColumnNames();
    int column_index = cursor.getColumnIndexOrThrow(_DATA);
    cursor.moveToFirst();
    return cursor.getString(column_index);
}

From source file:com.gsma.rcs.ri.messaging.adapter.TalkCursorAdapter.java

public int getItemViewType(Cursor cursor) {
    int providerId = cursor.getInt(cursor.getColumnIndexOrThrow(HistoryLog.PROVIDER_ID));
    Direction direction = Direction.valueOf(cursor.getInt(cursor.getColumnIndexOrThrow(HistoryLog.DIRECTION)));
    String mimeType = cursor.getString(cursor.getColumnIndexOrThrow(HistoryLog.MIME_TYPE));
    switch (providerId) {
    case ChatLog.Message.HISTORYLOG_MEMBER_ID:
        switch (mimeType) {
        case ChatLog.Message.MimeType.GROUPCHAT_EVENT:
            return VIEW_TYPE_RCS_GROUP_CHAT_EVENT;

        case ChatLog.Message.MimeType.GEOLOC_MESSAGE:
        case ChatLog.Message.MimeType.TEXT_MESSAGE:
            if (Direction.INCOMING == direction) {
                return VIEW_TYPE_RCS_CHAT_IN;
            }/*from   w  w  w . j a  va2  s . co m*/
            return VIEW_TYPE_RCS_CHAT_OUT;
        }
        throw new IllegalArgumentException("Invalid mime type: '" + mimeType + "'!");

    case FileTransferLog.HISTORYLOG_MEMBER_ID:
        if (Direction.INCOMING == direction) {
            return VIEW_TYPE_RCS_FILE_TRANSFER_IN;
        }
        return VIEW_TYPE_RCS_FILE_TRANSFER_OUT;
    }
    throw new IllegalArgumentException("Invalid provider ID: '" + providerId + "'!");
}

From source file:com.bufarini.reminders.AlarmReceiver.java

private void setReminders(Context context, String accountName) {
    RemindersDbHelper dbHelper = new RemindersDbHelper(context);
    SQLiteDatabase db = dbHelper.getReadableDatabase();
    Cursor cursor = db.rawQuery(String.format("select %s, %s, %s, %s, %s, %s, %s from %s where %s=\"%s\"",
            Tables.COMPLETED, Tables.REMINDER_DATE, Tables.REMINDER_INTERVAL, Tables.ID, Tables.DUE_DATE,
            Tables.LIST_ID, Tables.TITLE, Tables.TASK_TABLE, Tables.ACCOUNT_NAME, accountName), null);
    try {//from  ww  w . j a  v  a 2 s .  c  o  m
        while (cursor.moveToNext()) {
            boolean notCompleted = cursor.getLong(cursor.getColumnIndexOrThrow(Tables.COMPLETED)) == 0;
            if (notCompleted) {
                long reminderDate = cursor.getLong(cursor.getColumnIndexOrThrow(Tables.REMINDER_DATE));
                long reminderInterval = cursor.getLong(cursor.getColumnIndexOrThrow(Tables.REMINDER_INTERVAL));
                if (reminderDate > System.currentTimeMillis() || reminderInterval > 0) {
                    long id = cursor.getLong(cursor.getColumnIndexOrThrow(Tables.ID));
                    String title = cursor.getString(cursor.getColumnIndexOrThrow(Tables.TITLE));
                    long dueDate = cursor.getLong(cursor.getColumnIndexOrThrow(Tables.DUE_DATE));
                    long listId = cursor.getLong(cursor.getColumnIndexOrThrow(Tables.LIST_ID));
                    NotificationUtils.setReminder(context, id, title, dueDate, listId, reminderDate,
                            reminderInterval);
                }
            }
        }
    } finally {
        cursor.close();
        db.close();
    }
}

From source file:com.yuntongxun.ecdemo.storage.IMessageSqlManager.java

/**
 * ?getItem/*from  ww w .  j a  v a 2  s . c  om*/
 *
 * @param cursor
 * @return
 */
public static ECMessage packageMessage(Cursor cursor) {
    long id = cursor.getLong(cursor.getColumnIndex(IMessageColumn.ID));
    String sender = cursor.getString(cursor.getColumnIndexOrThrow(IMessageColumn.sender));
    String msgId = cursor.getString(cursor.getColumnIndexOrThrow(IMessageColumn.MESSAGE_ID));
    // long ownThreadId =
    // cursor.getLong(cursor.getColumnIndexOrThrow(IMessageColumn.OWN_THREAD_ID));
    long createDate = cursor.getLong(cursor.getColumnIndexOrThrow(IMessageColumn.CREATE_DATE));
    int version = cursor.getInt(cursor.getColumnIndexOrThrow(IMessageColumn.VERSION));
    String userData = cursor.getString(cursor.getColumnIndexOrThrow(IMessageColumn.USER_DATA));
    int read = cursor.getInt(cursor.getColumnIndexOrThrow(IMessageColumn.READ_STATUS));
    int boxType = cursor.getInt(cursor.getColumnIndexOrThrow(IMessageColumn.BOX_TYPE));
    int msgType = cursor.getInt(cursor.getColumnIndexOrThrow(IMessageColumn.MESSAGE_TYPE));
    int sendStatus = cursor.getInt(cursor.getColumnIndexOrThrow(IMessageColumn.SEND_STATUS));

    ECMessage ecMessage = ECMessage.createECMessage(ECMessage.Type.NONE);
    if (msgType == ECMessage.Type.TXT.ordinal() || msgType == Type.NONE.ordinal()) {
        String content = cursor.getString(cursor.getColumnIndexOrThrow(IMessageColumn.BODY));
        ecMessage.setType(ECMessage.Type.TXT);
        ECTextMessageBody textBody = new ECTextMessageBody(content);
        ecMessage.setBody(textBody);
    } else if (msgType == Type.CALL.ordinal()) {
        String content = cursor.getString(cursor.getColumnIndexOrThrow(IMessageColumn.BODY));
        ECCallMessageBody body = new ECCallMessageBody(content);
        ecMessage.setType(Type.CALL);
        ecMessage.setBody(body);
    } else if (msgType == ECMessage.Type.LOCATION.ordinal()) {
        String content = cursor.getString(cursor.getColumnIndexOrThrow(IMessageColumn.BODY));
        ecMessage.setType(ECMessage.Type.LOCATION);

        String lon;
        String lat;
        try {
            JSONObject jsonObject = new JSONObject(content);
            lon = jsonObject.getString("lon");
            lat = jsonObject.getString("lat");
            ECLocationMessageBody textBody = new ECLocationMessageBody(Double.parseDouble(lat),
                    Double.parseDouble(lon));
            textBody.setTitle(jsonObject.getString("title"));
            ecMessage.setBody(textBody);
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    else {
        String fileUrl = cursor.getString(cursor.getColumnIndexOrThrow(IMessageColumn.FILE_URL));
        String fileLocalPath = cursor.getString(cursor.getColumnIndexOrThrow(IMessageColumn.FILE_PATH));

        if (msgType == ECMessage.Type.VOICE.ordinal()) {
            ecMessage.setType(ECMessage.Type.VOICE);
            int duration = cursor.getInt(cursor.getColumnIndexOrThrow(IMessageColumn.DURATION));
            ECVoiceMessageBody voiceBody = new ECVoiceMessageBody(new File(fileLocalPath), 0);
            voiceBody.setRemoteUrl(fileUrl);
            ecMessage.setBody(voiceBody);
            voiceBody.setDuration(duration);
        } else if (msgType == ECMessage.Type.IMAGE.ordinal() || msgType == ECMessage.Type.VIDEO.ordinal()
                || msgType == ECMessage.Type.FILE.ordinal()) {
            ECFileMessageBody fileBody = new ECFileMessageBody();
            if (msgType == ECMessage.Type.FILE.ordinal()) {
                ecMessage.setType(ECMessage.Type.FILE);
            } else if (msgType == ECMessage.Type.IMAGE.ordinal()) {
                fileBody = new ECImageMessageBody();
                ecMessage.setType(ECMessage.Type.IMAGE);
            } else {
                fileBody = new ECVideoMessageBody();
                ecMessage.setType(ECMessage.Type.VIDEO);
            }
            fileBody.setLocalUrl(fileLocalPath);
            fileBody.setRemoteUrl(fileUrl);
            fileBody.setFileName(DemoUtils.getFileNameFormUserdata(userData));
            ecMessage.setBody(fileBody);
        } else if (msgType == Type.RICH_TEXT.ordinal()) {
            {
                ECPreviewMessageBody body = new ECPreviewMessageBody();
                ecMessage.setType(Type.RICH_TEXT);
                String content = cursor.getString(cursor.getColumnIndexOrThrow(IMessageColumn.BODY));
                body.setTitle(content);
                body.setLocalUrl(cursor.getString(cursor.getColumnIndexOrThrow(IMessageColumn.FILE_PATH)));
                body.setUrl(cursor.getString(cursor.getColumnIndexOrThrow(IMessageColumn.FILE_URL)));
                ecMessage.setBody(body);
            }
            //            return null;
        }
    }
    ecMessage.setId(id);
    ecMessage.setFrom(sender);
    ecMessage.setMsgId(msgId);
    ecMessage.setMsgTime(createDate);
    ecMessage.setUserData(userData);
    if (sendStatus == ECMessage.MessageStatus.SENDING.ordinal()) {
        ecMessage.setMsgStatus(ECMessage.MessageStatus.SENDING);
    } else if (sendStatus == ECMessage.MessageStatus.RECEIVE.ordinal() || sendStatus == 4) {
        // sendStatus == 4 ?
        ecMessage.setMsgStatus(ECMessage.MessageStatus.RECEIVE);
    } else if (sendStatus == ECMessage.MessageStatus.SUCCESS.ordinal()) {
        ecMessage.setMsgStatus(ECMessage.MessageStatus.SUCCESS);
    } else if (sendStatus == ECMessage.MessageStatus.FAILED.ordinal()) {
        ecMessage.setMsgStatus(ECMessage.MessageStatus.FAILED);
    }
    ecMessage.setDirection(getMessageDirect(boxType));

    return ecMessage;
}

From source file:edu.stanford.mobisocial.dungbeetle.DBIdentityProvider.java

public RSAPublicKey publicKeyForPersonId(String id) {
    if (id.equals(mPubKeyTag)) {
        return mPubKey;
    }/* w w w.jav  a2s  .  c  om*/
    Cursor c = mHelper.getReadableDatabase().query(Contact.TABLE, new String[] { Contact.PUBLIC_KEY },
            Contact.PERSON_ID + " = ?", new String[] { id }, null, null, null);
    try {
        if (!c.moveToFirst()) {
            return null;
        }

        RSAPublicKey k = RSACrypto
                .publicKeyFromString(c.getString(c.getColumnIndexOrThrow(Contact.PUBLIC_KEY)));
        return k;
    } finally {
        c.close();
    }
}

From source file:fi.mikuz.boarder.gui.internet.Login.java

private void showLoggedOutView() {
    setContentView(R.layout.internet_login_logged_out);

    mLogin = (Button) findViewById(R.id.submit);
    mUsername = (EditText) findViewById(R.id.userName);
    mPassword = (EditText) findViewById(R.id.userPassword);

    boolean usernameInDb = false;
    String dbPassword = null;//from   w  ww  . j a  v a  2s .  com

    try {
        Cursor loginCursor = mDbHelper.fetchLogin(InternetMenu.USERNAME_KEY);
        startManagingCursor(loginCursor);
        mUsername.setText(loginCursor.getString(loginCursor.getColumnIndexOrThrow(LoginDbAdapter.KEY_DATA)));
        usernameInDb = true;
    } catch (SQLException e) {
        Log.d(TAG, "Couldn't get database login info", e);
    } catch (CursorIndexOutOfBoundsException e) {
        Log.d(TAG, "Couldn't get database login info", e);
    }

    dbPassword = getDbPassword();

    final CheckBox rememberPassword = (CheckBox) findViewById(R.id.rememberPassword);

    if (dbPassword == null) {
        rememberPassword.setChecked(false);
    } else {
        rememberPassword.setChecked(true);
        mPassword.setText(dbPassword);
    }

    final CheckBox rememberUsername = (CheckBox) findViewById(R.id.rememberUsername);
    rememberUsername.setChecked(usernameInDb);

    mLogin.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            mWaitDialog = new TimeoutProgressDialog(Login.this, "Waiting for response", TAG, false);

            String username = mUsername.getText().toString();
            String password = mPassword.getText().toString();
            Boolean entrancePassword = true;
            String dbPassword = getDbPassword();

            // Password in the Android database is always the same as in the server database
            // Being an entrance password means that the password is not the same as in the server database
            if (dbPassword != null) {
                if (dbPassword.equals(password)) {
                    entrancePassword = false;
                }
            }

            // If the password is now an entrance password then it's plain text and wants to be hashed
            if (entrancePassword) {
                try {
                    password = Security.passwordHash(password);
                } catch (NoSuchAlgorithmException e) {
                    String msg = "Couldn't make a password hash";
                    Toast.makeText(Login.this, msg, Toast.LENGTH_LONG).show();
                    Log.e(TAG, msg, e);
                }
            }

            if (rememberUsername.isChecked()) {
                mDbHelper.putLogin(InternetMenu.USERNAME_KEY, username);
            } else if (!rememberUsername.isChecked()) {
                mDbHelper.deleteLogin(InternetMenu.USERNAME_KEY);
            }

            if (rememberPassword.isChecked()) {
                if (!entrancePassword) {
                    mPasswordOperation = PASSWORD_OPERATION_NONE;
                    mDbHelper.putLogin(InternetMenu.PASSWORD_KEY, password);
                } else {
                    mPasswordOperation = PASSWORD_OPERATION_SAVE;
                }
            } else if (!rememberPassword.isChecked()) {
                mDbHelper.deleteLogin(InternetMenu.PASSWORD_KEY);
            }

            mDbHelper.deleteLogin(InternetMenu.USER_ID_KEY);
            mDbHelper.deleteLogin(InternetMenu.SESSION_TOKEN_KEY);
            CheckBox rememberSession = (CheckBox) findViewById(R.id.rememberSession);
            if (rememberSession.isChecked()) {
                mRememberSession = true;
            }

            HashMap<String, String> sendList = new HashMap<String, String>();
            sendList.put(InternetMenu.USERNAME_KEY, username);
            sendList.put(InternetMenu.PASSWORD_KEY, password);
            sendList.put(InternetMenu.ENTRANCE_PASSWORD_KEY, entrancePassword ? "1" : "0");
            new ConnectionManager(Login.this, InternetMenu.mLoginURL, sendList);
        }
    });

    Button recoverPassword = (Button) findViewById(R.id.recoverPassword);
    recoverPassword.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {

            LayoutInflater inflater = (LayoutInflater) Login.this.getSystemService(LAYOUT_INFLATER_SERVICE);
            View layout = inflater.inflate(R.layout.internet_login_alert_recover_password,
                    (ViewGroup) findViewById(R.id.alert_settings_root));

            final EditText input = (EditText) layout.findViewById(R.id.input);
            Button submitButton = (Button) layout.findViewById(R.id.submitButton);

            AlertDialog.Builder builder = new AlertDialog.Builder(Login.this);
            builder.setView(layout);
            builder.setTitle("Password recovery");

            submitButton.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                    mWaitDialog = new TimeoutProgressDialog(Login.this, "Waiting for response", TAG, false);
                    String inputText = input.getText().toString();

                    HashMap<String, String> sendList = new HashMap<String, String>();
                    sendList.put(InternetMenu.EMAIL_KEY, inputText);
                    new ConnectionManager(Login.this, InternetMenu.mRecoverPasswordURL, sendList);
                }
            });

            builder.show();
        }
    });

}

From source file:br.com.bioscada.apps.biotracks.MarkerListActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    myTracksProviderUtils = MyTracksProviderUtils.Factory.get(this);
    sharedPreferences = getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
    long trackId = getIntent().getLongExtra(EXTRA_TRACK_ID, -1L);
    if (trackId == -1L) {
        Log.d(TAG, "invalid track id");
        finish();/*from w  ww . j  a va2s  .com*/
        return;
    }
    track = myTracksProviderUtils.getTrack(trackId);

    setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);

    listView = (ListView) findViewById(R.id.marker_list);
    listView.setEmptyView(findViewById(R.id.marker_list_empty));
    listView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = IntentUtils.newIntent(MarkerListActivity.this, MarkerDetailActivity.class)
                    .putExtra(MarkerDetailActivity.EXTRA_MARKER_ID, id);
            startActivity(intent);
        }
    });
    resourceCursorAdapter = new ResourceCursorAdapter(this, R.layout.list_item, null, 0) {
        @Override
        public void bindView(View view, Context context, Cursor cursor) {
            int typeIndex = cursor.getColumnIndex(WaypointsColumns.TYPE);
            int nameIndex = cursor.getColumnIndex(WaypointsColumns.NAME);
            int timeIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.TIME);
            int categoryIndex = cursor.getColumnIndex(WaypointsColumns.CATEGORY);
            int descriptionIndex = cursor.getColumnIndex(WaypointsColumns.DESCRIPTION);
            int photoUrlIndex = cursor.getColumnIndex(WaypointsColumns.PHOTOURL);

            boolean statistics = Waypoint.WaypointType.values()[cursor
                    .getInt(typeIndex)] == Waypoint.WaypointType.STATISTICS;
            int iconId = statistics ? R.drawable.ic_marker_yellow_pushpin : R.drawable.ic_marker_blue_pushpin;
            String name = cursor.getString(nameIndex);
            long time = cursor.getLong(timeIndex);
            String category = statistics ? null : cursor.getString(categoryIndex);
            String description = statistics ? null : cursor.getString(descriptionIndex);
            String photoUrl = cursor.getString(photoUrlIndex);

            ListItemUtils.setListItem(MarkerListActivity.this, view, false, true, iconId, R.string.image_marker,
                    name, null, null, null, 0, time, false, category, description, photoUrl);
        }
    };
    listView.setAdapter(resourceCursorAdapter);
    ApiAdapterFactory.getApiAdapter().configureListViewContextualMenu(this, listView,
            contextualActionModeCallback);

    final long firstWaypointId = myTracksProviderUtils.getFirstWaypointId(trackId);
    getSupportLoaderManager().initLoader(0, null, new LoaderCallbacks<Cursor>() {
        @Override
        public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
            return new CursorLoader(MarkerListActivity.this, WaypointsColumns.CONTENT_URI, PROJECTION,
                    WaypointsColumns.TRACKID + "=? AND " + WaypointsColumns._ID + "!=?",
                    new String[] { String.valueOf(track.getId()), String.valueOf(firstWaypointId) }, null);
        }

        @Override
        public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
            resourceCursorAdapter.swapCursor(cursor);
        }

        @Override
        public void onLoaderReset(Loader<Cursor> loader) {
            resourceCursorAdapter.swapCursor(null);
        }
    });
}

From source file:com.kylebarlow.android.crickettherm.ServerSync.java

public Boolean postData(Long rowId) {
    // see http://androidsnippets.com/executing-a-http-post-request-with-httpclient
    // Create a new HttpClient and Post Header
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost(POSTURL);
    Cursor c = mDbHelper.fetchLog(rowId);
    //Log.i("ServerSync","Syncing row"+rowId);
    try {//from  w  w  w .j a  va2 s  .c  om
        // Add your data
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
        nameValuePairs.add(new BasicNameValuePair("rowid", rowId.toString()));
        nameValuePairs.add(new BasicNameValuePair("cricketctemp",
                c.getString(c.getColumnIndexOrThrow(DataDBAdapter.KEY_CRICKETCTEMP))));
        nameValuePairs.add(new BasicNameValuePair("numchirps",
                c.getString(c.getColumnIndexOrThrow(DataDBAdapter.KEY_NUMCHIRPS))));
        nameValuePairs.add(new BasicNameValuePair("numsecs",
                c.getString(c.getColumnIndexOrThrow(DataDBAdapter.KEY_NUMSECS))));
        nameValuePairs.add(new BasicNameValuePair("latitude",
                c.getString(c.getColumnIndexOrThrow(DataDBAdapter.KEY_LATITUDE))));
        nameValuePairs.add(new BasicNameValuePair("longitude",
                c.getString(c.getColumnIndexOrThrow(DataDBAdapter.KEY_LONGITUDE))));
        nameValuePairs.add(new BasicNameValuePair("locationaccuracy",
                c.getString(c.getColumnIndexOrThrow(DataDBAdapter.KEY_LOCATIONACCURACY))));
        nameValuePairs.add(new BasicNameValuePair("weatherapi",
                c.getString(c.getColumnIndexOrThrow(DataDBAdapter.KEY_WEATHERAPI))));
        nameValuePairs.add(
                new BasicNameValuePair("ctemp", c.getString(c.getColumnIndexOrThrow(DataDBAdapter.KEY_CTEMP))));
        nameValuePairs.add(new BasicNameValuePair("condition",
                c.getString(c.getColumnIndexOrThrow(DataDBAdapter.KEY_CONDITION))));
        nameValuePairs.add(new BasicNameValuePair("humidity",
                c.getString(c.getColumnIndexOrThrow(DataDBAdapter.KEY_HUMIDITY))));
        nameValuePairs.add(new BasicNameValuePair("windcondition",
                c.getString(c.getColumnIndexOrThrow(DataDBAdapter.KEY_WINDCONDITION))));
        nameValuePairs.add(new BasicNameValuePair("timestamp",
                c.getString(c.getColumnIndexOrThrow(DataDBAdapter.KEY_TIMESTAMP))));
        //Log.i("ServerSync","Manualtemp to sync(c):"+c.getString(c.getColumnIndexOrThrow(DataDBAdapter.KEY_MANUALTEMP)));
        nameValuePairs.add(new BasicNameValuePair("manualtemp",
                c.getString(c.getColumnIndexOrThrow(DataDBAdapter.KEY_MANUALTEMP))));
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        StringBuilder response = null;
        // Execute HTTP Post Request
        try {
            response = inputStreamToString(httpclient.execute(httppost).getEntity().getContent());
        } catch (Exception e) {

        }
        if (response != null) {
            //Log.i("ServerSync","Response="+response);
            if (new String(response).startsWith(SUCCESS)) {
                return true;
            }
        }

    } catch (IOException e) {
        return false;
    }
    return false;
}