[android-developers] How to query multiple number of a contact
Hi, I have the following code which queries 1 number of a contact. It works. But how can I change it so that I can query multiple numbers (work, mobile, home) for the same contact and the type of each number? int phoneColumnIndex = cursor.getColumnIndex(People.NUMBER); if (phoneColumnIndex != -1) { String phoneNumber = cursor.getString(phoneColumnIndex); System.out.println ( phoneNumber: + phoneNumber); } } Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] how can i launch the intent to pick image from SD card?
Hi, Can you please tell me how can i launch the intent to pick image from SD card? Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Create an Adapter for Gallery
Hi, I am trying to create a simple adapter for Gallery. And I call setAdapter() of my Gallery. The text is displayed on screen, but they are overlapping each other. Do I need to set the size of the TextView that I create to make sure it has enough space for the text it is holding? if yes, how to do that? public class MyAdapter extends BaseAdapter { private String[] values = {name1, name2, name3, name4}; public View getView(int position, View convertView, ViewGroup parent) { TextView tv = new TextView(mContext); tv.setText(values[position]); return tv; } public int getCount() { return values.length; } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public void setContext(Context mContext) { this.mContext = mContext; } } Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to use SimpleCursorAdapter to include Button
Hi, I have read the Gallery2.java example, which show how to map a Column's value to an elment in the view I want to create (in this case, it maps 'NAME' to text1 element0. But what if I have a Button in my view, how can I know which Person is being clicked? or how can I query the person's info when a button in the new is clicked? From the Gallery2.java example: SpinnerAdapter adapter = new SimpleCursorAdapter(this, // Use a template that displays a text view android.R.layout.simple_gallery_item, // Give the cursor to the list adatper c, // Map the NAME column in the people database to... new String[] {People.NAME}, // The text1 view defined in the XML template new int[] { android.R.id.text1 }); Gallery g = (Gallery) findViewById(R.id.gallery); Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Question about picking an image from sd card
Hi, I have the following code to pick an image from sd card: private void pickPhotoAction() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null); intent.setType(image/*); intent.putExtra(crop, true); intent.putExtra(aspectX, 1); intent.putExtra(aspectY, 1); try { intent.putExtra(return-data, true); startActivityForResult(intent, PHOTO_PICKED); } catch (ActivityNotFoundException e) { } } It did launch an activity for me to pick an image from sd card. But my question is why the bitmap i get from the activity is limited to 188 x 188? Here is they code I have for getting the result: protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case PHOTO_PICKED: { final Bundle extras = data.getExtras(); if (extras != null) { Bitmap photo = extras.getParcelable(data); // why this is 188 x 188? System.out.println ( PHOTO_PICKED photo.getWidth(): + photo.getWidth() + getHeight(): + photo.getHeight()); } } Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to query all phone numbers of all Contacts in the Database?
Hi, Can you please tell me how can I query all phone numbers of all Contacts in the Database? Where can I find some examples for that? Thank you. Regards, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: add my Launcher.apk into emulator
Can you please tell me where in android code which specify using Launcher.apk when android starts? I have grep 'Launcher' in the code, i can't find anywhere it specify android to use Launcher.apk. On Fri, May 22, 2009 at 9:51 AM, Dianne Hackborn hack...@android.com wrote: You need to give it a different package name. If you don't, you are trying to replace the current Launcher .apk, and since you aren't signed with the same cert, you can't. On Fri, May 22, 2009 at 4:38 AM, allstars allstars@gmail.com wrote: hi i try to modify the Launcher in mydroid/package/apps/Launcher and i try to use it as an APK so i dont have to mess up the original system image so i copy it to another project , say mydroid/package/apps/MyLauncher i have changed the package name in case it will conflict with the original Launcher and because some files use android.internal.R using 'android' to install/update is not feasible hence i build my MyLauncher inside mydroid , and i modify the LOCAL_PACKAGE_NAME in Android.mk when i build out the MyLauncher.apk i try to install it with adb install but it complains Failure [INSTALL_FAILED_ALREADY_EXISTS] but i am sure i havent installed this APK before and if i use $adb install -r , it will complain Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES] so i would like to ask what's the correct way to install my MyLauncher.apk into emulator thanks -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How can I clone a View and its children
Hi, If I have a reference to a View, how can I clone it with all its children and grandchildren (i.e. deep cloning)? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to overlay an image on a view
Hi, I need to create a function which input is a reference is a view, and the function basically creates a new View which overlay an image on top of the input view? What is the best way to achieve that? I am thinking of create a new ViewGroup (as my output), add the input view as a child to that ViewGroup. But how can I overlay an Image on top of the input view in the ViewGroup? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Exception: Finalizing cursor android.database.sqlite.SQLiteCursor
On Wed, May 6, 2009 at 1:43 PM, Romain Guy romain...@google.com wrote: You're not calling close() on one (or more) of your Cursor. You can look at the pid (713) here to see what process it occurs on. Thanks. But for the case of implementing ContentProvider's query() method, who should close the Cursor? The Caller of the query method? or the ContentProvider (since it is the one creating the Cursor) @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { On Wed, May 6, 2009 at 1:39 PM, Meryl Silverburgh silverburgh.me...@gmail.com wrote: I am seeing the exception in 'adb logcat'. But I don't know if it is caused by my application or android platform. Can you please give me any idea how to troubleshoot this exception? Thank you. I/dalvikvm( 713): Uncaught exception thrown by finalizer (will be discarded): I/dalvikvm( 713): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.sqlitecur...@435ca1c0 on contacts that has not been deactivated or closed I/dalvikvm( 713): at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596) I/dalvikvm( 713): at dalvik.system.NativeStart.run(Native Method) I/dalvikvm( 713): Uncaught exception thrown by finalizer (will be discarded): I/dalvikvm( 713): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.sqlitecur...@435c99b0 on contacts that has not been deactivated or closed I/dalvikvm( 713): at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596) I/dalvikvm( 713): at dalvik.system.NativeStart.run(Native Method) -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Exception: Finalizing cursor android.database.sqlite.SQLiteCursor
I am seeing the exception in 'adb logcat'. But I don't know if it is caused by my application or android platform. Can you please give me any idea how to troubleshoot this exception? Thank you. I/dalvikvm( 713): Uncaught exception thrown by finalizer (will be discarded): I/dalvikvm( 713): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.sqlitecur...@435ca1c0 on contacts that has not been deactivated or closed I/dalvikvm( 713): at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596) I/dalvikvm( 713): at dalvik.system.NativeStart.run(Native Method) I/dalvikvm( 713): Uncaught exception thrown by finalizer (will be discarded): I/dalvikvm( 713): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.sqlitecur...@435c99b0 on contacts that has not been deactivated or closed I/dalvikvm( 713): at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596) I/dalvikvm( 713): at dalvik.system.NativeStart.run(Native Method) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How drawing cache in View works
Can you please tell me how does android determine when View should enable the drawing cache? I try calling in my class (which inherits form LinearLayout) Bitmap drawingCache = getDrawingCache(); I get a null in my drawingCache. Thank you. On Thu, Apr 30, 2009 at 3:48 PM, Romain Guy romain...@google.com wrote: You can also use the View's drawing cache API. On Thu, Apr 30, 2009 at 3:38 PM, dan raaka danra...@gmail.com wrote: Bitmap b = Bitmap.create( ); Canvas c = new Canvas(b); your_view.draw(c); use b to in setDrawable else where there are missing lines, but you should get the idea Dan On Thu, Apr 30, 2009 at 2:23 PM, Moto medicalsou...@gmail.com wrote: Hi, I need to somehow get a drawable of the contents of a Layout, once I get that drawable I want to set it as a background on an empty layout How can I go about doing this? Thanks! Moto! -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Question about CellLayout.CellInfo Class
Hi, My understanding of CellLayout.CellInfo is it is a data-structure class which represents an item in CellLayout. My question is why it needs to implements ContextMenu.ContextMenuInfo? What is the relationship between ContextMenu and CellLayout? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to Snap a picture of a Layouts contents?
Hi, I am doing a similar thing. But I need to do that to a ViewGroup. But what I find out is I see everything exception the background of my ViewGroup. Can you please tell me why? or if background drawable of ViewGroup is painted differently? Thank you. On Fri, May 1, 2009 at 12:42 PM, dan raaka danra...@gmail.com wrote: Romain : however the drawing cache (or the code snippet i pasted before) will not work if the View has SurfaceView as its child On Thu, Apr 30, 2009 at 3:48 PM, Romain Guy romain...@google.com wrote: You can also use the View's drawing cache API. On Thu, Apr 30, 2009 at 3:38 PM, dan raaka danra...@gmail.com wrote: Bitmap b = Bitmap.create( ); Canvas c = new Canvas(b); your_view.draw(c); use b to in setDrawable else where there are missing lines, but you should get the idea Dan On Thu, Apr 30, 2009 at 2:23 PM, Moto medicalsou...@gmail.com wrote: Hi, I need to somehow get a drawable of the contents of a Layout, once I get that drawable I want to set it as a background on an empty layout How can I go about doing this? Thanks! Moto! -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Application Not Responding (ANR) dialog
In the follow blog, it talks about Application Not Responding (ANR) dialog http://developer.android.com/guide/practices/design/responsiveness.html Can you please tell me where in the code which pop up this Application Not Responding (ANR) dialog? Or how can I adjust the timer for this dialog so that it won't pop up during debugging? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Application Not Responding (ANR) dialog
In the follow blog, it talks about Application Not Responding (ANR) dialog http://developer.android.com/guide/practices/design/responsiveness.html Can you please tell me where in the code which pop up this Application Not Responding (ANR) dialog? Or how can I adjust the timer for this dialog so that it won't pop up during debugging? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to update a Cursor
Hi, I call ContentResolver's query method to get a Cursor, and I would like to update the title of that row to 'new title' can you please tell me how to do it? final ContentResolver cr = context.getContentResolver(); Cursor c = cr.query(MY_CONTENT_URI, new String[] { title}, title=?, new String[] { title }, null); if (c.getCount() 0) { // want to update the title to 'new title' } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to update a Cursor
Thank you. I have another question about cursor. I have inserted a ContentValue like this: final ContentResolver cr = context.getContentResolver(); ContentValue values = new ContentValues(); values.put(title, new title); values.put(x, 10); Uri result = cr.insert(CONTENT_URI , values); But why when I do my query and then getColumn, I get java.lang.IllegalArgumentException: column 'x' does not exist Cursor c = cr.query(CONTENT_URI, new String[] { title }, title=?, new String[] { new title }, null); if (c.getCount() 0) { // get an exception here: int xColumn = c.getColumnIndexOrThrow(x); } On Fri, Apr 24, 2009 at 3:03 PM, Mark Murphy mmur...@commonsware.com wrote: Meryl Silverburgh wrote: Hi, I call ContentResolver's query method to get a Cursor, and I would like to update the title of that row to 'new title' can you please tell me how to do it? final ContentResolver cr = context.getContentResolver(); Cursor c = cr.query(MY_CONTENT_URI, new String[] { title}, title=?, new String[] { title }, null); if (c.getCount() 0) { // want to update the title to 'new title' } context.getContentProvider().update() There is no update() method on Cursor. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to dump the content of sqlite via adb shell command
Hi, I am trying to dump the content of sqlite via adb shell command. Here is what i did: $ adb shell * daemon not running. starting it now * * daemon started successfully * # sqlite3 SQLite version 3.5.9 qlite .databases seq name file --- --- -- 0main 1temp /sqlite_stmt_journals/etilqs_S9bmllRuggSwGfp sqlite .schema main sqlite .tables My questions I try both 'tables' command and dump the schema for 'main', I can't find my table. Can you please tell me what am I doing wrong? In my java code, I am able to insert value to DB like this: Uri CONTENT_URI = Uri.parse(content://com.mycompany.app/test); final ContentResolver cr = context.getContentResolver(); Uri result = cr.insert(CONTENT_URI , values); Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to dump the content of sqlite via adb shell command
How can i find out the name of the database file? In my java code, I did this: Uri CONTENT_URI = Uri.parse(content://com.mycompany.app/test); final ContentResolver cr = context.getContentResolver(); Uri result = cr.insert(CONTENT_URI , values); Can you please tell me what is the name of the DB file? On 4/16/09, Marco Nelissen marc...@android.com wrote: On Thu, Apr 16, 2009 at 6:08 PM, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, I am trying to dump the content of sqlite via adb shell command. Here is what i did: $ adb shell * daemon not running. starting it now * * daemon started successfully * # sqlite3 SQLite version 3.5.9 qlite .databases seq name file --- --- -- 0main 1temp /sqlite_stmt_journals/etilqs_S9bmllRuggSwGfp sqlite .schema main sqlite .tables My questions I try both 'tables' command and dump the schema for 'main', I can't find my table. Can you please tell me what am I doing wrong? You didn't specify a database file when you launched the 'sqlite3' command. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to debug the Launcher activity of android in eclipse
Hi, I am trying to following this documentation 'http://source.android.com/using-eclipse' to debug android Launcher Activity in eclipse. It said ' You may need to open the Debug perspective (next to the Java perspective icon in the upper-right, click the small Open Perspective icon and select Debug). Once you do, you should see a list of threads; if you select one and break it (by clicking the pause icon), it should show the stack trace, source file, and line where execution is at. Breakpoints and whatnot should all work. My question is which threads I need to select in order to debug Launcher Activity? I don't see a thread name Launcher. Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to scale a Bitmap
Hi, I have constructed a Bitmap object in Java. Can you please tell me how can I scale it (x, y with a different ratio) on android? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to print errno in native code in android
On Tue, Apr 7, 2009 at 1:01 AM, David Turner di...@android.com wrote: On Tue, Apr 7, 2009 at 2:15 AM, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, I am trying to use LOGE function to display the value of errno. LOGE(errno: %d\n, errno); But what I get errno: 1 But '1' is not a valid errno (I look at errno.h). You are not looking very well :-). EPERM is defined as 1, but the actual definition is in bionic/libc/kernel/common/asm-generic/errno-base.h I encourage you to use strerror(errno) to get a human-friendly description of the errno value, this will save you countless hours of pain. Thank you. I print out 'errno' after I call 'ioctl', and from here:http://docsrv.sco.com/cgi-bin/man/man?ioctl+2, EPERM is not one of the errno set by ioctl. int result = ioctl(fd, KDSETMODE, (void*) KD_TEXT); if(result 0) { LOGE(exit gr_init 1 %d\n, errno); close(fd); return -1; } Can you please tell me what am I doing wrong? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How can I see LOGV content in 'adb logcat'
Hi, I put calls to LOGV() in my cpp file in WebKit code in andorid, but I don't see any log statements when I run 'adb logcat' in another shell. But as soon as I change it to LOGE(), i see them. Can you please tell me how can I see the log content of LOGV? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to become root in emulator?
Hi, Can you please tell me how can I become root in android emulator? I have googled and find this link: http://www.androidhere.com/ANDROID-NEWS/Technology/200811/19-Hack--Howto-get-root-on-your-G1_41.html so i tried # adb shell and the follow the steps #mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system #cd /system/bin #cat sh su #chmod 4755 su and run 'su' but I still can't access files which only allow to be accessed by root. Thank you for any suggestion. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to print errno in native code in android
Hi, I am trying to use LOGE function to display the value of errno. LOGE(errno: %d\n, errno); But what I get errno: 1 But '1' is not a valid errno (I look at errno.h). Can you please tell me what am I doing wrong? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Remove binaries after I download and compile android source
Hi, I have download and built android source on my local machine. Can you please tell me how can I remove all the binaries (*.o, executables) to clean up everything? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How does android decide which drawable to use when a widget has focus
Hi, I have selector drawable for my widget. But for some reason, the focused drawable (specified below) is not shown. When I use hierarchyViewer, it does show my widget has focus (the 'hasFocus' is true). And its parent has Focus too and its grand parent has Focus. My question is why andorid is not picking up the focus drawable for my widget? Is there something I need to specify to make this work? Thank you. ?xml version=1.0 encoding=utf-8? selector xmlns:android=http://schemas.android.com/apk/res/android; item android:state_pressed=true android:drawable=@drawable/my_pressed / item android:state_focused=true android:drawable=@drawable/my_focus / /selector --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] android:disabledAlpha for ToggleButton
For ToggleButton, there is an attribute for 'disbledAlpha'. Why there is no same attribute for ImageButton? How can I achieve the same thing for an ImageButton (grey out when the button is disabled). Thank you. The alpha to apply to the indicator when disabled. Must be a floating point value, such as 1.2. This may also be a reference to a resource (in the form @[package:]type:name) or theme attribute (in the form ?[package:][type:]name) containing a value of this type. This corresponds to the global attribute resource symbol disabledAlpha.Hi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Question about layout child widget in a compound widget
Hi, I am trying to create a compound widget which has 2 labels (i.e. textview), one label on each line. public class TwoLabel extends LinearLayout { private TextView mLabel; private TextView mLabel2; public TwoLabel(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mLabel = new TextView(context, attrs, R.attr.textViewStyle); mLabel2 = new TextView(context, attrs, R.attr.textViewStyle); } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Question about layout child widget in a compound widget
Hi, I am trying to create a compound widget which has 2 labels (i.e. textview), one label on each line. public class TwoLabel extends LinearLayout { private TextView mLabel; private TextView mLabel2; public TwoLabel(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mLabel = new TextView(context, attrs, R.attr.textViewStyle); mLabel2 = new TextView(context, attrs, R.attr.textViewStyle); mLabel.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT)); mLabel2.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT)); addView(mLabel); addView(mLabel2); } My question is why I only see the first label but not the second label? In the layout.xml file which uses the TwoLabel compound widget, I did this: TwoLabel android:layout_width=fill_parent android:layout_height=fill_parent android:id=@+id/textFieldLabel / So I am not sure why I only see the first label but not the second one. On Fri, Mar 20, 2009 at 6:50 PM, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, I am trying to create a compound widget which has 2 labels (i.e. textview), one label on each line. public class TwoLabel extends LinearLayout { private TextView mLabel; private TextView mLabel2; public TwoLabel(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mLabel = new TextView(context, attrs, R.attr.textViewStyle); mLabel2 = new TextView(context, attrs, R.attr.textViewStyle); } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Question about layout child widget in a compound widget
Romain, Thank you. But I change the height to wrap_content for both items. I still see only 1 item in the emulator. Any idea please? On Fri, Mar 20, 2009 at 8:48 PM, Romain Guy romain...@google.com wrote: You specified a height of fill_parent for both items. So they both have the height of their parent. So the second one is outside of the parent. On Fri, Mar 20, 2009 at 6:53 PM, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, I am trying to create a compound widget which has 2 labels (i.e. textview), one label on each line. public class TwoLabel extends LinearLayout { private TextView mLabel; private TextView mLabel2; public TwoLabel(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mLabel = new TextView(context, attrs, R.attr.textViewStyle); mLabel2 = new TextView(context, attrs, R.attr.textViewStyle); mLabel.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT)); mLabel2.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT)); addView(mLabel); addView(mLabel2); } My question is why I only see the first label but not the second label? In the layout.xml file which uses the TwoLabel compound widget, I did this: TwoLabel android:layout_width=fill_parent android:layout_height=fill_parent android:id=@+id/textFieldLabel / So I am not sure why I only see the first label but not the second one. On Fri, Mar 20, 2009 at 6:50 PM, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, I am trying to create a compound widget which has 2 labels (i.e. textview), one label on each line. public class TwoLabel extends LinearLayout { private TextView mLabel; private TextView mLabel2; public TwoLabel(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mLabel = new TextView(context, attrs, R.attr.textViewStyle); mLabel2 = new TextView(context, attrs, R.attr.textViewStyle); } } -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Question about layout child widget in a compound widget
Thank you. How can I lay out 1 label at a line? I try switching to RelativeLayout, it is still the same problem. On Fri, Mar 20, 2009 at 9:33 PM, Romain Guy romain...@google.com wrote: Your LinearLayout is horizontal and both your children are width=fill_parent. On Fri, Mar 20, 2009 at 9:30 PM, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Romain, Thank you. But I change the height to wrap_content for both items. I still see only 1 item in the emulator. Any idea please? On Fri, Mar 20, 2009 at 8:48 PM, Romain Guy romain...@google.com wrote: You specified a height of fill_parent for both items. So they both have the height of their parent. So the second one is outside of the parent. On Fri, Mar 20, 2009 at 6:53 PM, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, I am trying to create a compound widget which has 2 labels (i.e. textview), one label on each line. public class TwoLabel extends LinearLayout { private TextView mLabel; private TextView mLabel2; public TwoLabel(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mLabel = new TextView(context, attrs, R.attr.textViewStyle); mLabel2 = new TextView(context, attrs, R.attr.textViewStyle); mLabel.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT)); mLabel2.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT)); addView(mLabel); addView(mLabel2); } My question is why I only see the first label but not the second label? In the layout.xml file which uses the TwoLabel compound widget, I did this: TwoLabel android:layout_width=fill_parent android:layout_height=fill_parent android:id=@+id/textFieldLabel / So I am not sure why I only see the first label but not the second one. On Fri, Mar 20, 2009 at 6:50 PM, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, I am trying to create a compound widget which has 2 labels (i.e. textview), one label on each line. public class TwoLabel extends LinearLayout { private TextView mLabel; private TextView mLabel2; public TwoLabel(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mLabel = new TextView(context, attrs, R.attr.textViewStyle); mLabel2 = new TextView(context, attrs, R.attr.textViewStyle); } } -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] how to set android font style to bold
Hi, In android, if I have a TextPaint object, how can I set the font style to be 'bold'? I can't find any method in TextPaint or Paint to allow me do that. Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to detect Fling action in my widget
Hi, Can you please tell me how can I detect Fling action in my own widget? I have implemented my widget as OnGestureListener. And like in Gallery, I have a GestureDetector mGestureDetector = new GestureDetector(this); For my onTouchEvent(), I have @Override public boolean onTouchEvent(MotionEvent event) { // Give everything to the gesture detector boolean retValue = mGestureDetector.onTouchEvent(event); return retValue; } But my public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) is never get claeed. CAn you please tell me why? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to detect Fling action in my widget
Thanks. I have setup breakpoints for all OnGestureDetector methods. It did call onDown and I return true for the method. But onFling still did not get called. Any other idea? Thank you. On Wed, Mar 18, 2009 at 12:17 PM, Streets Of Boston flyingdutc...@gmail.com wrote: Make sure you return the correct boolean-values in the other methods of your OnGestureDetector (onDown, onScroll, etc). On Mar 18, 2:51 pm, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, Can you please tell me how can I detect Fling action in my own widget? I have implemented my widget as OnGestureListener. And like in Gallery, I have a GestureDetector mGestureDetector = new GestureDetector(this); For my onTouchEvent(), I have @Override public boolean onTouchEvent(MotionEvent event) { // Give everything to the gesture detector boolean retValue = mGestureDetector.onTouchEvent(event); return retValue; } But my public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) is never get claeed. CAn you please tell me why? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to implement android's Gallery fling action in my own widget
Thank you. How does android determine how many items in the gallery should be moved (either left or right) in 1 fling? On Thu, Mar 12, 2009 at 8:17 PM, gymshoe gyms...@bresnan.net wrote: The fling animation is automatic with the Gallery class. If you need your own (new) widget class, just make your own MyGallery class which extends Gallery. Then just overwrite the onFling() method to do whatever you want to do, and at the end of that method call super.onFling(args). Jim On Mar 12, 1:27 pm, Streets Of Boston flyingdutc...@gmail.com wrote: Take a look at the GestureDetector class. - Create an instance of GestureDetector. - Handle the onTouch event of your activity. In your onTouch event handler, forward the MotionEvent to this GestureDetector instance. - Assign a listener to this GestureDetector (one that implements onFling, amongst others) Implement the onFling method in your listener to handle flings. On Mar 12, 1:27 pm, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, Can you please tell me how implement android's Gallery fling action (with the animation) in my own widget? Thank you.- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Trying to understanding Gallery fling source code
I am trying to understand how Gallery implements it fling behaviour. I appreciate if someone can help me understand 1. why it needs special handing for ACTION_UP and ACTION_CANCEL? 2. why it does not check the retValue before calling UP/CANCEL's handling? 3. what does onUp() trying to do? Why it needs to send out Unpress event? @Override public boolean onTouchEvent(MotionEvent event) { // Give everything to the gesture detector boolean retValue = mGestureDetector.onTouchEvent(event); int action = event.getAction(); if (action == MotionEvent.ACTION_UP) { // Helper method for lifted finger onUp(); } else if (action == MotionEvent.ACTION_CANCEL) { onCancel(); } return retValue; } /** * Called when a touch event's action is MotionEvent.ACTION_UP. */ void onUp() { if (mFlingRunnable.mScroller.isFinished()) { scrollIntoSlots(); } dispatchUnpress(); } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Question about TabHost implementation
I have looked at TabHost code and I have a question. Why it expects TabContent to be a FrameLayout? I see it casts mTabContent to be FrameLayout. Why TabContent can't be an instance of ViewGroup, but a FrameLayout? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to implement android's Gallery fling action in my own widget
Hi, Can you please tell me how implement android's Gallery fling action (with the animation) in my own widget? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to port AbsoluteLayout to FrameLayout?
Hi, AbsoluteLayout has become obsolete, I need to convert it to FrameLayout. My problem is in AbsoluteLayout.LayoutParams, I can specify (x,y) in the constructor, which specify the location of my view during layout. How can I achieve using FrameLayout + FrameLayout.LayoutParams? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to layout a widget programmically in java
Hi, In xml layout, I can specify these parameters: android:layout_centerInParent=true android:layout_marginLeft=4dp android:layout_marginRight=4dp Can you please tell me what functions I can call in java code which I can achieve the same thing? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Android Web Browser profiling
Can you please tell me how to enable ANDROID_INSTRUMENT ? On Tue, Mar 10, 2009 at 9:45 PM, vinay harugop vinc...@gmail.com wrote: ravi, I tried the same and found similar conflicts in the namespace when ANDROID_INSTRUMENT was enabled. Modify platform/android/SystemTimeAndroid.cpp, platform/android/jni/WebViewCore.cpp and WebCore/WebCorePrefixAndroid.h for namespace conflicts. -vinay harugop On Wed, Mar 11, 2009 at 4:30 AM, androido...@gmail.com androido...@gmail.com wrote: All, I am looking at the % of time spent on different functions of Browser. For e.g i am let us say cnn.com takes 12 secs to load on the android browser. I wish to understand how much of it is being spent in CSS/XML parsing, HTML parsing, MIME type decoding, Java Script etc. How much of time is spent in kernel and how much in user space. I found a lot of instrumentation in the code. But i am unable to enable some of them. I did enable a few in BrowserActivity.java which provides me Pageload times that uses SystemClock.uptimeMillis(). Also i see we have traceview methods in BrowserActivity.java, which i enabled by changing BrowserSetting.java 'tracing' value to true. Any ideas of how to profile webkit core functionalities? regards, Ravi Software Engineer, Texas Instruments Inc. Dallas,TX --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Activity dispatchKeyEvent(KeyEvent event) method always return false?
Hi, Can you please tell me why Activity dispatchKeyEvent(KeyEvent event) method always return false? I press UP/DOWN key (on keyboard), and I see the focus of each button moves from one to another. So I think the Activity has handled the UP/DOWN key. My question is why dispatchKeyEvent() always return false? Another question is how another class (which only have a reference to Activity) tells if the Activity handles the UP/DOWN key for focus navigation? (e.g. return true, if the Activity moves focus from 1 button to another, return false when the Activity reaches the end of the button list) Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] background drawable
I have created a background drawable for my widget. How can I specify the size of the background drawable so that it won't stretch of my widget? ?xml version=1.0 encoding=utf-8? layer-list xmlns:android=http://schemas.android.com/apk/res/android; item android:id=@+android:id/background android:drawable=@drawable/bkgd / /layer-list bkgd.png is a png file. Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Android source code to find out which drawable a widget should use for its background?
Hi, Can you please tell me where is the android code which picks the different drawable will be used as background when it has focus? For example, I have the following setup for my widget: ?xml version=1.0 encoding=utf-8? selector xmlns:android=http://schemas.android.com/apk/res/android; item android:state_pressed=true android:drawable=@drawable/header_list_pressed / item android:state_focused=true android:drawable=@drawable/header_list_focus / /selector Where is the android code which finds out which drawable it should used for the widget's background? I have looked at view.java, but I can't figure out which method is doing what drawable should be used. Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How can I create a custom composite widget in android
Hi, I have read the LabelView example in APIDemo which show how to create a custom widget. However, what if I want to create a custom widget which is a composite of existing android widget? For example, in my currently activity, I have this in my layout xml file which has 2 bottoms left, right aligned: RelativeLayout android:id=@+id/arow android:gravity=left android:layout_width=fill_parent android:layout_height=50px android:orientation=horizontal android:background=#00 android:layout_alignParentTop=true ImageView android:id=@+id/left android:layout_width=wrap_content android:layout_height=wrap_content android:layout_alignParentLeft=true android:layout_centerVertical=true android:src=@drawable/left / ImageView android:id=@+id/right android:layout_width=wrap_content android:layout_height=wrap_content android:layout_alignParentRight=true android:layout_centerVertical=true android:src=@drawable/right / /RelativeLayout My question is how can i create a custom widget which is a composite widget of 2 ImageView , with left, right aligned? I know my custom widget need to be inherited from view, but if i do that, I can't do 'setContentView()' in my custom widget class (since that is an Activity method). so how can I apply the above xml to my custom widget class? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How can I create a custom composite widget in android
On Wed, Feb 25, 2009 at 3:52 PM, Mark Murphy mmur...@commonsware.com wrote: Meryl Silverburgh wrote: I know my custom widget need to be inherited from view, but if i do that, I can't do 'setContentView()' in my custom widget class (since that is an Activity method). If you need to turn layout XML into a tree of View objects outside setting the activity's content view (e.g., custom rows in a ListView), you can use LayoutInflater. Thank you. But when i put the xml into a file like this: RelativeLayout android:id=@+id/carousel_row_layout android:gravity=left android:layout_width=fill_parent android:layout_height=50px android:orientation=horizontal android:background=#00 android:layout_alignParentTop=true /RelativeLayout ADT complains with 'ERROR Error parsing XML:unbound prefix? -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Question about using LayoutInflater
I have a question about using LayoutInflater. I have a class which inherits from 'View'. It calls LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (inflater != null) { inflater.inflate(R.layout.mycontent, null); } inflate returns with no exception. But then, when I do this: mRowLayout = (RelativeLayout)findViewById(R.id.row_layout); I get a null pointer for mRowLayout. Can you please tell me why? Or how to fix my problem? ?xml version=1.0 encoding=utf-8? view class=android.widget.RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android; android:id=@+id/carousel_film android:layout_width=fill_parent android:layout_height=fill_parent RelativeLayout android:id=@+id/row_layout android:layout_width=fill_parent ImageView android:id=@+id/left android:layout_width=wrap_content android:layout_height=wrap_content android:src=@drawable/left / /RelativeLayout /view --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Question about using LayoutInflater
Mark, Thank you for your help. On Wed, Feb 25, 2009 at 6:00 PM, Mark Murphy mmur...@commonsware.com wrote: Meryl Silverburgh wrote: I have a question about using LayoutInflater. I have a class which inherits from 'View'. It calls LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); Or, you can get your activity by calling getContext() in your View and casting it to an Activity. Then, call getLayoutInflater() on the Activity. Either way works. if (inflater != null) { inflater.inflate(R.layout.mycontent, null); } inflate() returns a View, the result of the inflation. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Available! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to customize background drawable for Gallery in android
Hi, I am trying to customize background drawable for Gallery widget in android. So I took the Gallery1.java in APIDemo and try changing the background drawable of Gallery. In Gallery1.java, I add: // Reference the Gallery view Gallery g = (Gallery) findViewById(R.id.gallery); g.setFocusable(true); g.setFocusableInTouchMode(true); g.setBackgroundResource(R.drawable.gallery_background_1); In the gallery_background_1.xml, I have selector xmlns:android=http://schemas.android.com/apk/res/android; item android:state_pressed=true android:drawable=@drawable/blue_box / item android:drawable=@drawable/red_box / /selector When I run in the emulator, I do see the red color as the background of the gallery. But I never see it changes to blue as I pressed the gallery. Can you please tell me what am I missing? Thank you for your help. Here is the red_box and blue_box drawable: blue_box.xml: shape xmlns:android=http://schemas.android.com/apk/res/android; solid android:color=#1eff/ padding android:left=1dp android:top=1dp android:right=1dp android:bottom=1dp / /shape red_box.xml: shape xmlns:android=http://schemas.android.com/apk/res/android; solid android:color=#1eff/ padding android:left=1dp android:top=1dp android:right=1dp android:bottom=1dp / /shape --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How can I scroll the item in a Gallery programmically?
Hi, I have looked at the Gallery widget api, http://code.google.com/android/reference/android/widget/Gallery.html But can you please tell me how can I scroll an item in the Gallery programmically? e.g. i want to write code to scroll the gallery by 1 item at a time. Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How can I scroll the item in a Gallery programmically?
I have looked at the Gallery.java source code, it has 2 functions which move the selected position: movePrevious() or moveNext(), however both are 'default' visibility. Can you please tell me how can I call those 2 method programmically? Thank you. On Mon, Feb 23, 2009 at 12:19 PM, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, I have looked at the Gallery widget api, http://code.google.com/android/reference/android/widget/Gallery.html But can you please tell me how can I scroll an item in the Gallery programmically? e.g. i want to write code to scroll the gallery by 1 item at a time. Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to customize Gallery Widget in android?
Hi, Can you please tell me how can I customize drawable (background image for disable mode, focus mode, etc) for Gallery Widget? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How can I get the child of a Widget
Hi, In my layout.xml, I have a child Widget under my custom widget MyWidget My question is in my java code of my parent widget (MyWidget), how can I get a reference to the child Widget (MyChildWidget)? com.mycompany.widget.MyWidget android:id=@android:id/widget android:layout_width=fill_parent android:layout_height=wrap_content LinearLayout android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent com.mycompany.widget.MyChildWidget id=@+id/childWidget android:layout_width=fill_parent android:layout_height=wrap_content android:gravity=bottom / /LinearLayout /com.mycompany.widget.MyTabWidget I have tried this, but I get a null pointer: MyChildWidget childWidget = (MyChildWidget) this.findViewById(R.id.childWidgete); if (childWidget != null) { } else { // always get here... } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Question about how android calling widget's constructor
Hi, Can you please help me understand how android consturcts widget? I have these 2 cases, com.mycompany.MyWidget android:id=@+id/mywidget_button style=@style/MyWidget com.mycompany.MyWidget android:id=@+id/mywidget_button My question is why they call the same constructors (I have print statement: public MyToggleWidget(Context context, AttributeSet attrSet) { super(context, attrStet, R.attr.buttonStyleMyWidget); } If so, How can I differentiate the case with a style attribute from the case without a style attribute. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Question about defining selector drawable
Hi, I am trying to setup a selector drawable in my asset file like this: * 2 different images for 'on'/'off' mode in rest mode (i.e. it does not has focus) * another 2 different images for 'on'/'off' mode in focus mode (i.e. it has the focus). In my case, the rest mode works, but the 'focus' mode does not. Can you please tell me what am I missing in the focus mode? Thank you. ?xml version=1.0 encoding=utf-8? selector xmlns:android=http://schemas.android.com/apk/res/android; !-- these 2 images works --- item android:state_checked=false android:drawable=@drawable/off / item android:state_checked=true android:drawable=@drawable/on / !-- these 2 images does not work -- item android:state_focused=true android:state_checked=false android:drawable=@drawable/off_focus / item android:state_focused=true android:state_checked=true android:drawable=@drawable/on_focus / /selector --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Question about defining selector drawable
Thank you. I tried this: item android:state_selected=true android:state_checked=false android:drawable=@drawable/off_focus / item android:state_selected=true android:state_checked=true android:drawable=@drawable/on_focus / But the image still does not switch when my widget has the focus. It still uses the 'orange rectangle boundary when it get the focus. I think that is the default. I just want to change it to 2 different images when it get the focus for my widget. Again, these works for my widget now: item android:state_checked=false android:drawable=@drawable/off / item android:state_checked=true android:drawable=@drawable/on / So I appreciate if you can help me out. Thank you. On Sun, Feb 15, 2009 at 12:32 AM, Romain Guy romain...@google.com wrote: use state_selected, not focused. On Sun, Feb 15, 2009 at 12:08 AM, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, I am trying to setup a selector drawable in my asset file like this: * 2 different images for 'on'/'off' mode in rest mode (i.e. it does not has focus) * another 2 different images for 'on'/'off' mode in focus mode (i.e. it has the focus). In my case, the rest mode works, but the 'focus' mode does not. Can you please tell me what am I missing in the focus mode? Thank you. ?xml version=1.0 encoding=utf-8? selector xmlns:android=http://schemas.android.com/apk/res/android; !-- these 2 images works --- item android:state_checked=false android:drawable=@drawable/off / item android:state_checked=true android:drawable=@drawable/on / !-- these 2 images does not work -- item android:state_focused=true android:state_checked=false android:drawable=@drawable/off_focus / item android:state_focused=true android:state_checked=true android:drawable=@drawable/on_focus / /selector -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Question about defining selector drawable
Hi, I am trying to setup a selector drawable in my asset file like this: * 2 different images for 'on'/'off' mode in rest mode (i.e. it does not has focus) * another 2 different images for 'on'/'off' mode in focus mode (i.e. it has the focus). In my case, the rest mode works, but the 'focus' mode does not. Can you please tell me what am I missing in the focus mode? Thank you. ?xml version=1.0 encoding=utf-8? selector xmlns:android=http://schemas.android.com/apk/res/android; !-- these 2 images works --- item android:state_checked=false android:drawable=@drawable/off / item android:state_checked=true android:drawable=@drawable/on / !-- these 2 images does not work -- item android:state_focused=true android:state_checked=false android:drawable=@drawable/off_focus / item android:state_focused=true android:state_checked=true android:drawable=@drawable/on_focus / /selector --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Please help me in defining the style of my custom widget in my theme.
Hi, I have tried everything thing I can thing of in defining the style of my widget in my theme. But I still can't get it to work. I have posted my questions to various forum/newgroup, I can't get my problem resolved. I appreciate if someone can help me. I am tying to define the style of MyWidget in my theme. I create a widget myself called 'MyWidget' and I want to define the style of MyWidget in my theme. And I have added this in my manifest file: application android:label=@string/app_name android:theme=@style/MyTheme This in my themes.xml file: resources style name=MyTheme item name=buttonStyleMyWidget@style/MyWidget/item /style /resources and this in my styles.xml file: ?xml version=1.0 encoding=utf-8? resources style name=MyWidget item name=android:background@drawable/btn_mywidget_bg/item /style /resources But android did not pick up the style of 'MyWidget' unless I specifically put 'style='@style/MyWidget' In other words, in my main.xml, if i specified my 'style' attribute, my background drawable was displayed correctly. test.MyWidget android:id=@+id/mywidget style=@style/MyWidget / but if I just do this: test.MyWidget android:id=@+id/mywidget / , the background drawable is not display correctly. Can you please tell me what am I missing? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How can I specify the default style of my widget
Thank you. I have added a 'themes.xml' file in my res/values directory. resources style name=MyTheme item name=buttonStyleMyWidget@style/MyWidget/item /style /resources But how can I apply that MyTheme throughout my android application? Thank you. On Thu, Feb 12, 2009 at 4:59 PM, birds fly birdsact...@gmail.com wrote: hi you can use Theme , The theme can include all style information. style name=string [parent=string] item name=string/item /style On Fri, Feb 13, 2009 at 8:16 AM, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, I create my own widget with its own drawable for background. So in my styles.xml file, I have this: resources style name=MyWidget item name=android:background@drawable/btn_mywidget_bg/item /style /resources In my main.xml, if i specified my 'style' attribute, my background drawable was displayed correctly. test.MyWidget android:id=@+id/mywidget style=@style/MyWidget / but if I just do this: test.MyWidget android:id=@+id/mywidget / , the background drawable is not display correctly. Can you please tell me how can I specify the default style of my widget so that I don't need to add style=@style/MyWidget everytime I use my widget? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How can I specify the default style of my widget
And I have added this in my manifest file: application android:label=@string/app_name android:theme=@style/MyTheme This in my themes.xml file: resources style name=MyTheme item name=buttonStyleMyWidget@style/MyWidget/item /style /resources and this in my styles.xml file: ?xml version=1.0 encoding=utf-8? resources style name=MyWidget item name=android:background@drawable/btn_mywidget_bg/item /style /resources Can you please tell me what am I missing? On Fri, Feb 13, 2009 at 2:38 PM, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Thank you. I have added a 'themes.xml' file in my res/values directory. resources style name=MyTheme item name=buttonStyleMyWidget@style/MyWidget/item /style /resources But how can I apply that MyTheme throughout my android application? Thank you. On Thu, Feb 12, 2009 at 4:59 PM, birds fly birdsact...@gmail.com wrote: hi you can use Theme , The theme can include all style information. style name=string [parent=string] item name=string/item /style On Fri, Feb 13, 2009 at 8:16 AM, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, I create my own widget with its own drawable for background. So in my styles.xml file, I have this: resources style name=MyWidget item name=android:background@drawable/btn_mywidget_bg/item /style /resources In my main.xml, if i specified my 'style' attribute, my background drawable was displayed correctly. test.MyWidget android:id=@+id/mywidget style=@style/MyWidget / but if I just do this: test.MyWidget android:id=@+id/mywidget / , the background drawable is not display correctly. Can you please tell me how can I specify the default style of my widget so that I don't need to add style=@style/MyWidget everytime I use my widget? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: TERRIBLE BUG #2 - the GC from HELL
Yeah. Thank you. On Thu, Feb 12, 2009 at 9:53 AM, Sundog sunns...@gmail.com wrote: Romain, Just a quick thank you to you and others, especially Dianne, who field such things. Most of us are very grateful for your hard work and patience. On Feb 12, 9:54 am, Romain Guy romain...@google.com wrote: Hi, First of all, please calm down, getting angry and cursing won't help. Then, you are not reading the logs correctly. While the GC should certainly not be active all the time, the logs show that the GC is active in *different processes.* All the GCs you see do not come from the same process and might not come from your application *at all.* If you see these lines after you exit your app, then the GC don't happen in your app. It's as simple as that. You can use DDMS or adb shell ps to see the pid of running processes and match them against the logs. This GC for instance occurred in the process of pid 757: 02-12 12:48:57.230: DEBUG/dalvikvm(757): GC freed 110 objects / 5128 bytes in 74m Note that this kind of activity is expected when the phone is syncing data from your Google account for instance. It could also be due to a 3rd party application or a bug in one of the standard apps. Without knowing what process cause the GC, there's not much we can do. WHAT THE HELL Is the device trying to send or receive *anything* w/o my consent??? You bought a T-Mobile G1, which is expected to be used on a T-Mobile network. In this case, the myFaves application is sending an SMS to the carrier to see whether you have the myFaves service enabled on your plan. On a T-Mobile network this costs you nothing, I don't know about other networks. It probably is a special kind of SMS used to carrier operations that costs you nothing. -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How can I specify the default style of my widget
Hi, I create my own widget with its own drawable for background. So in my styles.xml file, I have this: resources style name=MyWidget item name=android:background@drawable/btn_mywidget_bg/item /style /resources In my main.xml, if i specified my 'style' attribute, my background drawable was displayed correctly. test.MyWidget android:id=@+id/mywidget style=@style/MyWidget / but if I just do this: test.MyWidget android:id=@+id/mywidget / , the background drawable is not display correctly. Can you please tell me how can I specify the default style of my widget so that I don't need to add style=@style/MyWidget everytime I use my widget? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Need help in understanding android 's code
Hi, When I create a button, it has a grey round rectangle and an orange background when it has focus. Can you please tell me where is the code which draws that? I looked at the method of onDraw() of View and button, i dont' see that is drawing that. And in the TextView, I don't it is drawing an orange rectangle either. Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to customize android button's look and feel
Hi, Can you please tell me how can I customize android button's look and feel? e.g. by default, it uses a grey round rectangle as the border and it has 'orange' background when it has focus. Can you please tell me how can i config that in my application? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to customize android button's look and feel
I found the 'btn_default_selected.9.png' 'btn_default_press.9.png' images, but I am still not sure how the 'borders' are drawn. Thank you for any tip. On Wed, Feb 11, 2009 at 11:20 AM, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, Can you please tell me how can I customize android button's look and feel? e.g. by default, it uses a grey round rectangle as the border and it has 'orange' background when it has focus. Can you please tell me how can i config that in my application? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Question about Bottom left/right strip in the TabWidget
Hi, In the TabWidget source code, it has a mBottomLeftStrip and mBottomRightStrip attribute. Can you please tell me what are they for? I have an android example with Tab. When I run that in the emulator, I click the left/right of the tab widget, I don't see anything happened. Thank you for any pointers. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Cannot delete that URL exception
Thanks. But can you please tell me how can If I find the _ID from the phone number? On Mon, Feb 9, 2009 at 6:00 AM, Odessa Silverberg silverberg.ode...@googlemail.com wrote: I'm not 100% sure, but i think it's because you passed Contacts.Phones.CONTENT_URI instead of creating your own uri which has an id-segment appended. The ID is the unique _ID field you have in your phone table.If you know the _ID you can generate a uri (it's called URI not URL btw :P) with this line private void removeContact(Context context, String phone) { long _id = 2; // Just hardcoding it, in your aplication you have to get the ID programmatically) Uri deleteContactUri = Uri.withAppendedPath (Contacts.Phones.CONTENT_URI, String.valueOf(_id)); context.getContentResolver().delete(deleteContactUri, null, null); } On Feb 9, 3:19 am, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, I am getting the Cannot delete that URL exception(see below): java.lang.UnsupportedOperationException: Cannot delete that URL: content://contacts/phones at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:130) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:110) at android.content.ContentProviderProxy.delete(ContentProviderNative.java:362) at android.content.ContentResolver.delete(ContentResolver.java:386) Here is my code: private void removeContact(Context context, String phone) { context.getContentResolver().delete(Contacts.Phones.CONTENT_URI, Contacts.PhonesColumns.NUMBER+=?, new String[] {phone}); } Can you please tell me what am I missing? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Unit testing context.sendBoardcast function
Hi, I have the following test case which tests context.sendBoardcast() function: public void testInstallFavorite() { Context context = getContext(); IntentFilter filter = new IntentFilter(); filter.addAction(com.android.launcher.action.INSTALL_SHORTCUT); context.registerReceiver(new DummyBoardcastReceiver(), filter); Intent installShortcut = new Intent(com.android.launcher.action.INSTALL_SHORTCUT); context.sendBroadcast(installShortcut); // count is a dummy variable which increments by 1 when DummyBoardcastReceiver::onReceive() is called assertEquals(count, 1); } But the DummyBoardcastReceiver::onReceive() is never get called. Can you please tell me why? or if there is a better way to unit test the code? private int count = 0; class DummyBoardcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Intent shortCutIntent = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT); assertNotNull(shortCutIntent); count++; } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Cannot delete that URL exception
Hi, I am getting the Cannot delete that URL exception(see below): java.lang.UnsupportedOperationException: Cannot delete that URL: content://contacts/phones at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:130) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:110) at android.content.ContentProviderProxy.delete(ContentProviderNative.java:362) at android.content.ContentResolver.delete(ContentResolver.java:386) Here is my code: private void removeContact(Context context, String phone) { context.getContentResolver().delete(Contacts.Phones.CONTENT_URI, Contacts.PhonesColumns.NUMBER+=?, new String[] {phone}); } Can you please tell me what am I missing? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to programmically add a new contact in android
That line is after my first insert. On Fri, Feb 6, 2009 at 4:23 AM, MichaMicha micha.okker...@gmail.com wrote: values.clear(); doesn't look right, right? On 6 feb, 08:30, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, I am trying to programmically add a new contact in android. What I did is this: Uri uri = Contacts.People.CONTENT_URI; values.put(Contacts.PeopleColumns.NAME, mydummyuser1); Uri newuri = myActivity.getContentResolver().insert(uri, values); Uri phoneUri = Uri.withAppendedPath(newuri, Contacts.People.Phones.CONTENT_DIRECTORY); values.clear(); values.put(Contacts.PhonesColumns.ISPRIMARY, 1); values.put(Contacts.PhonesColumns.TYPE, Contacts.PhonesColumns.TYPE_CUSTOM); values.put(Contacts.PhonesColumns.LABEL, Other); String formattedPhone = PhoneNumberUtils.formatNumber(555666); values.put(Contacts.PhonesColumns.NUMBER, formattedPhone); Uri newPhoneUri = myActivity.getContentResolver().insert(phoneUri, values); But as soon as I kill and restart my emulator, the contact that I add is gone. Can you please tell me why? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to remove a contact with a specified phone number?
How to remove a contact with a specified phone number? I try this: String phone =1234567; context.getContentResolver().delete(Contacts.Phones.CONTENT_URI, phone, null); But I get an error with this: java.lang.UnsupportedOperationException: Cannot delete that URL: content://contacts/phones at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:130) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:110) at android.content.ContentProviderProxy.delete(ContentProviderNative.java:362) at android.content.ContentResolver.delete(ContentResolver.java:386) at com.mytest.TestUtil.removeContact(TestUtil.java:87) Thank you for any pointers. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] What is the difference between managedQuery() and getContentREsolver().query()
I have read: http://code.google.com/android/devel/data/contentproviders.html But I don't understand what is the difference between managedQuery() and getContentREsolver().query()? Seems to me both take a Uri and query parameters and then return a Cursor. I appreciate if anyone can tell me the difference. Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How can i find out what is the top 'view' of my activity?
Hi, Is it possible for me to find out what is the 'view' of my activity? e.g. if my activity pops up a 'dialog', can I get a reference of that dialog? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to programmically add a new contact in android
Hi, I am trying to programmically add a new contact in android. What I did is this: Uri uri = Contacts.People.CONTENT_URI; values.put(Contacts.PeopleColumns.NAME, mydummyuser1); Uri newuri = myActivity.getContentResolver().insert(uri, values); Uri phoneUri = Uri.withAppendedPath(newuri, Contacts.People.Phones.CONTENT_DIRECTORY); values.clear(); values.put(Contacts.PhonesColumns.ISPRIMARY, 1); values.put(Contacts.PhonesColumns.TYPE, Contacts.PhonesColumns.TYPE_CUSTOM); values.put(Contacts.PhonesColumns.LABEL, Other); String formattedPhone = PhoneNumberUtils.formatNumber(555666); values.put(Contacts.PhonesColumns.NUMBER, formattedPhone); Uri newPhoneUri = myActivity.getContentResolver().insert(phoneUri, values); But as soon as I kill and restart my emulator, the contact that I add is gone. Can you please tell me why? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to instrumentation clicking a button of dialog?
Hi, In my activity, I have code which create dialog like this with +ve and -ve button each has its own click action: protected Dialog onCreateDialog(int id) { switch (id) { case CONFIRM_DIALOG: // create my own dialog with positive and negative button... } } My question is how can I create instrumentation to emulate the click on that button? That onClick() implementation calls a private method of my activity. new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { aPrivateMethodOfMyActivity(); } Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] How to call callActivityOnRestoreInstanceState of Instrumentation
Hi, I have the following test code which calls callActivityOnRestoreInstanceState of Instrumentation class. mStartIntent = new Intent(Intent.ACTION_MAIN); Bundle bundle = new Bundle(); bundle.putBoolean(testProperty, false); MyActivity myActivity = startActivity(mStartIntent, null, null); getInstrumentation().callActivityOnStart(myActivity); getInstrumentation().callActivityOnRestoreInstanceState(myActivity, bundle); But when I run the unit test with instrumentation, i get this error: ndroid.util.AndroidRuntimeException: Acquiring SearchManager objects only valid in Activity Contexts. at android.app.ApplicationContext.getSearchManager(ApplicationContext.java:976) at android.app.ApplicationContext.getSystemService(ApplicationContext.java:861) at android.view.ContextThemeWrapper.getSystemService(ContextThemeWrapper.java:73) at android.app.Activity.getSystemService(Activity.java:3091) at android.app.Activity.performRestoreInstanceState(Activity.java:797) at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1171) at com.mycompany.TestMyActivity.testSaveRestoreInstanceState(TestMyActivity.java:79) Can you please tell me what am I missing in setting up my instrumentation? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: How to call callActivityOnRestoreInstanceState of Instrumentation
On Wed, Feb 4, 2009 at 6:43 PM, Andrew Stadler stad...@gmail.com wrote: Meryl- It's hard to say with only a partial snippet, but I'm guessing that you're using an InstrumentationTestCase or possibly an ActivityUnitTestCase. You'll be better served here using an ActivityInstrumentationTestCase, which will start your activity for you, and then you should be able to call into it normally. Andy, Thank you. Can you please tell me where I can find example of ActivityInstrumentationTestCase? The only thing I found is. And I am not sure why it does not have any 'assert' for unit testing... Thank you for any more pointers. /** * Make sure that the main launcher activity opens up properly, which will be * verified by {...@link ActivityInstrumentationTestCase#testActivityTestCaseSetUpProperly}. */ public class ApiDemosTest extends ActivityInstrumentationTestCaseApiDemos { public ApiDemosTest() { super(com.example.android.apis, ApiDemos.class); } } In either case, a clue that something is wrong is that you're calling both startActivity() *and* callActivityOnStart(), which cannot be right. --Andy On Wed, Feb 4, 2009 at 4:50 PM, Meryl Silverburgh silverburgh.me...@gmail.com wrote: Hi, I have the following test code which calls callActivityOnRestoreInstanceState of Instrumentation class. mStartIntent = new Intent(Intent.ACTION_MAIN); Bundle bundle = new Bundle(); bundle.putBoolean(testProperty, false); MyActivity myActivity = startActivity(mStartIntent, null, null); getInstrumentation().callActivityOnStart(myActivity); getInstrumentation().callActivityOnRestoreInstanceState(myActivity, bundle); But when I run the unit test with instrumentation, i get this error: ndroid.util.AndroidRuntimeException: Acquiring SearchManager objects only valid in Activity Contexts. at android.app.ApplicationContext.getSearchManager(ApplicationContext.java:976) at android.app.ApplicationContext.getSystemService(ApplicationContext.java:861) at android.view.ContextThemeWrapper.getSystemService(ContextThemeWrapper.java:73) at android.app.Activity.getSystemService(Activity.java:3091) at android.app.Activity.performRestoreInstanceState(Activity.java:797) at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1171) at com.mycompany.TestMyActivity.testSaveRestoreInstanceState(TestMyActivity.java:79) Can you please tell me what am I missing in setting up my instrumentation? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---