android-sdk-2.1

Is there an easy way to “deactivate logging” prior to releasing your app on the market?

笑着哭i 提交于 2019-12-03 07:29:26
I'm preparing to release an app on the market place, on reading the Google documentation located here it suggests the following : Deactivate any calls to Log methods in the source code. Is there an easier way than having to go through all my source files and remove each line manually? Also, why remove the logging, is it a resource hog? Janusz You can do this through proguard . In the latest SDK and tools a proguard configuration file should already exist. Christopher answered this in a similar question . The easiest way is probably to run your compiled JAR through ProGuard before deployment,

android: AbsListView.OnScrollListener SCROLL_STATE_IDLE is not called after SCROLL_STATE_TOUCH_SCROLL (Version 2.1)

会有一股神秘感。 提交于 2019-12-02 23:29:50
I have a problem with android version 2.1. It looks like a bug. I attached an OnScrollListener to my listView. I'm using the method onScrollStateChanged(AbsListView view, int scrollState) for monitoring the scroll's state of my listview. The scrollstate could assume 3 value (taken from the documentation): SCROLL_STATE_FLING : The user had previously been scrolling using touch and had performed a fling. The animation is now coasting to a stop SCROLL_STATE_IDLE :The view is not scrolling. Note navigating the list using the trackball counts as being in the idle state since these transitions are

Android Intent Action “ACTION_INSERT_OR_EDIT” - should it be used for adding contacts?

若如初见. 提交于 2019-12-02 21:30:57
At the moment I am searching for an easy and supported way of adding contacts in Android up from SDK level 7. (when some kind of data like the phone number is available) I looked at the default contact application and found "Intent.ACTION_INSERT_OR_EDIT" which is used for adding a new contact (or adding a number to a contact from the contact provider) from the dialer screen with the mime type "vnd.android.cursor.item/person". Now it would be nice to know how to find some documentation about the extras that should be added when using that action and if it is the correct way trying to support as

Show soft keyboard for dialog

≡放荡痞女 提交于 2019-12-02 16:04:40
I am displaying a dialog with an edittext view. However, the softkeyboard will open only if the user presses inside the editview. So I tried calling an InputMethodManager with the following code. InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(dialogField,0); The dialogField is the input field. However, when exactly am I supposed to do this? I tried it in the onStart() method of the dialog, but nothing happens. I also tried requesting the focus for the dialogField before, but that changes nothing. I also tried this code dialogField

Android 2.1 How to get Phone Numbers of contacts [duplicate]

ぃ、小莉子 提交于 2019-12-02 04:26:53
问题 This question already has answers here : Read all contacts' phone numbers in android (13 answers) Closed 3 months ago . I am new to Android and have been working on an app that needs to get all of the user's contact's phone numbers. Apparently the code I have does not work with the 2.1 SDK. So far here is the code I am using: String[] projection = new String[] { Phone.NUMBER }; Cursor c = managedQuery( Phone.CONTENT_URI, projection, null, null, null ); int colIndex = -1; try { colIndex = c

Android 2.1 How to get Phone Numbers of contacts [duplicate]

天大地大妈咪最大 提交于 2019-12-02 02:03:00
This question already has an answer here: Read all contacts' phone numbers in android 13 answers I am new to Android and have been working on an app that needs to get all of the user's contact's phone numbers. Apparently the code I have does not work with the 2.1 SDK. So far here is the code I am using: String[] projection = new String[] { Phone.NUMBER }; Cursor c = managedQuery( Phone.CONTENT_URI, projection, null, null, null ); int colIndex = -1; try { colIndex = c.getColumnIndexOrThrow( Phone.NUMBER ); } catch( Exception e ) { print( e.getMessage() ); } print( "Column Index = " + colIndex )

Issue using Contact Group delete on Android

一个人想着一个人 提交于 2019-12-01 01:20:42
I have this code to delete a Contact Group public void delete(Activity act,String[] args) { try { int b=act.getContentResolver().delete(ContactsContract.Groups.CONTENT_URI,"_ID=?", args); Toast.makeText(act, "Deleted",Toast.LENGTH_SHORT).show(); //notify registered observers that a row was updated act.getContentResolver().notifyChange(ContactsContract.Groups.CONTENT_URI, null); } catch (Exception e) { Log.v(TAG, e.getMessage(), e); Toast.makeText(act, TAG + " Delete Failed",Toast.LENGTH_LONG).show(); } } I call the method like private void processDelete(long rowId) { String[] args = { String

How to do custom ListView with colorful items' backgrounds?

岁酱吖の 提交于 2019-11-30 19:23:18
I have created an ArrayList<HashMap<String, String>> collection to hold my data for ListView . I'm using SimpleAdapter . Is it possible to change background of list item when list item's ID % 10 == 0? Here is the code (method generating layout): private void fillData() { Cursor c = this.mDbManager.getNgOrderDetailByOrderNumber(this.mNumber); ArrayList<HashMap<String, String>> items = new ArrayList<HashMap<String, String>>(); if (!c.isAfterLast()) { do { // ... filling HashMap and putting it to ArrayList } while (c.moveToNext()); } SimpleAdapter adapter = new SimpleAdapter(this, items, R.layout

Drawing an empty polygon given a set of points on a Map Overylay (Android 2.1)

夙愿已清 提交于 2019-11-30 16:48:08
I've set of n points and I want to draw a n-sided polygon using these points. I tried using android.graphics.path (please see below). Path path = new Path(); Vertex currVtx; for (int j = 0; j < vertices.size(); j++) { currVtx = vertices.get(j); if (!currVtx.hasLatLong()) continue; Point currentScreenPoint = getScreenPointFromGeoPoint( currVtx, mapview); if (j == 0) path.moveTo(currentScreenPoint.x, currentScreenPoint.y); // vertex. else path.lineTo(currentScreenPoint.x, currentScreenPoint.y); } Currently I'm getting a solid (filled with the color of the canvas) polygon with this code. Is there

How to wrap text to next line in an Android TextView?

微笑、不失礼 提交于 2019-11-30 10:52:00
I am using following TextView to display some data in it: <TextView android:id="@+id/notificationText" android:layout_height="wrap_content" android:layout_width="fill_parent" android:textSize="18sp" android:inputType="textMultiLine" android:maxLines="2" android:layout_paddingRight="20dip" android:textColor="#ffffff"/> I want to wrap text to next line. How can I do this? you must set android:scrollHorizontally="false" in your xml. You could also try android:inputType="textMultiLine" in your XML. This worked for me. vikas kumar In Some case It works by setting width to 0dp on text views. android