[android-developers] Android Notification

2012-11-14 Thread Darwin Pinheiro
I've got an application that needs to show a notification of certain events in a day, depending on the event. I know how to do it, if I need a service to stay running in the background, or it will run in the background getting these events on certain days. 2 questions are: 1 - to notify of

[android-developers] item tag requires a 'drawable' attribute

2012-03-29 Thread Pinheiro
I have this simple XML in the drawable folder: selector xmlns:android=http://schemas.android.com/apk/res/android; item android:drawable=@drawable/dark_pressed android:state_pressed=true / item android:drawable=@drawable/dark_focused android:state_focused=true

[android-developers] stroke bottom?

2012-03-21 Thread Pinheiro
Hi! I'm trying to create a shape with a border on 3 sides (top and sides, not at the bottom): shape xmlns:android=http://schemas.android.com/apk/res/android; solid android:color=#000 / stroke android:width=2dp android:color=#888 / corners android:topLeftRadius=2dip

[android-developers] Clickable elements on widget

2012-03-14 Thread Pinheiro
in advance! Pinheiro -- 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

[android-developers] TabWidget NullPointerException in pre-Froyo

2011-11-15 Thread Pinheiro
Hi! I've done a simple TabActivity that loads several Intents into the tabs. It works fine in Froyo or later but gives this error on older versions: E/AndroidRuntime( 1958): java.lang.NullPointerException E/AndroidRuntime( 1958):at android.widget.TabWidget.dispatchDraw(TabWidget.java:173)

[android-developers] Animated markers in MapView

2011-10-27 Thread Pinheiro
Hi! Anyone knows how to use animated markers in MapView? For instance, a man jumping up and down in a map. Preferably, the shadow would be updated as well. Thanks in advance! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this

[android-developers] Unknown option '--no-crunch' in latest AAPT

2011-10-19 Thread Pinheiro
Hi! I've changed a few resources in a app, tried to run it and got the build error: ERROR: Unknown option '--no-crunch' Android Asset Packaging Tool I think the problem is not with my project (Android 2.2) but with AAPT itself since I got this error right after upgrading the libraries

[android-developers] Re: Unknown option '--no-crunch' in latest AAPT

2011-10-19 Thread Pinheiro
Looks like you updated to the latest eclipse plugin but didn't update the SDK component. aapt (part of platform-tools) revision 8 is needed to use the latest ADT. You are right, that solved the problem, thanks! -- You received this message because you are subscribed to the Google Groups

[android-developers] Re: Unknown option '--no-crunch' in latest AAPT

2011-10-19 Thread Pinheiro
Looks like you updated to the latest eclipse plugin but didn't update the SDK component. aapt (part of platform-tools) revision 8 is needed to use the latest ADT. You are right, that solved the problem, thanks! -- You received this message because you are subscribed to the Google Groups

[android-developers] Waking the screen after PARTIAL_WAKE_LOCK

2011-10-10 Thread Pinheiro
I've done an app that must work in the background fetching messages from a web site that must never sleep. For that I'm using PARTIAL_WAKE_LOCK, let the screen turn off and wake it when there is a new message. Here's some code: -- public void onCreate(Bundle savedInstanceState) {

[android-developers] Re: Waking the screen after PARTIAL_WAKE_LOCK

2011-10-10 Thread Pinheiro
One more thing: FULL_WAKE_LOCK or FLAG_KEEP_SCREEN_ON should solve the problem but I don't want to use them because of effects on the battery. -- 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] Re: Waking the screen after PARTIAL_WAKE_LOCK

2011-10-10 Thread Pinheiro
Hi! Thanks for the answer. FULL_WAKE_LOCK or FLAG_KEEP_SCREEN_ON should solve the problem but I Huh? Your effects on the battery are already there with what you're Well, at least the screen is off and I don't have to make a screen saver (don't know if LCD burn-in is still a problem?) ;-)

[android-developers] Re: Waking the screen after PARTIAL_WAKE_LOCK

2011-10-10 Thread Pinheiro
Not if you are using PARTIAL_WAKE_LOCK. You need a FULL_WAKE_LOCK. As the documentation states for ACQUIRE_CAUSES_WAKEUP:  Thanks but that doesn't solve my problem, I really, really want to turn the screen off after some time of inactivity and turn it on only after a message arrives or the user

[android-developers] Re: Waking the screen after PARTIAL_WAKE_LOCK

2011-10-10 Thread Pinheiro
 Not if you are using PARTIAL_WAKE_LOCK. You need a FULL_WAKE_LOCK  Thanks but that doesn't solve my problem, I really, really want to turn the screen off after some time of inactivity and turn it on only after a message arrives or the user touches the screen or button. Update: PARTIAL_WAKE_LOCK

[android-developers] Re: Always-on GPS: widget or app?

2011-09-30 Thread Pinheiro
Just to clarify one thing: you don't want to use the requestLocationUpdates(). I suppose you meant: you don't want to call requestLocationUpdates() for continuous updates, right?In the BroadcastReceiver activity, I'll call the requestLocationUpdates() and then removeUpdate() as soon as there is a

[android-developers] Always-on GPS: widget or app?

2011-09-29 Thread Pinheiro
I need to make an app that transmits GPS information each 5 minutes (the information gathering can be switched on and off in the app). The question is: to ensure that the information is gathered should I call the requestLocationUpdates() on an regular app or should I use a widget running in the

[android-developers] Re: Always-on GPS: widget or app?

2011-09-29 Thread Pinheiro
That's exactly what I wanted to know, thanks a lot! -- 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] Prevent activity pause

2011-09-16 Thread Pinheiro
Hi! I have an unusual problem: I've made an app that will be shown at an exposition booth. What I need is a way to prevent the screen from going off, i.e., the activity will be run forever (no battery problem, it will always be powered). I've tried to shortcut OnPause() to return instantly and

[android-developers] Re: Prevent activity pause

2011-09-16 Thread Pinheiro
Many thanks for the fast reply, it works :) -- 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] Stripe Animation in XML

2011-09-11 Thread Pinheiro
Hi! I'm trying to do an slide animation but in 4 stripes: 0-25% of the new image slides from the right to the left, then 25-50% of the image an so on. From what I've read in the SDK this should work but doesn't: ?xml version=1.0 encoding=utf-8? set

[android-developers] ViewFlipper with arbitrary number of Views

2011-09-08 Thread Pinheiro
Hi! I'm developing a simple photo gallery application that pulls files from the Net and uses a ViewFlipper to change Views. Since I don't know how many Views the ViewFlipper will have, I have to add all the views in code and not in XML. My question is: are all the Views of the ViewFlipper loaded

[android-developers] Re: ViewFlipper with arbitrary number of Views

2011-09-08 Thread Pinheiro
Thanks for the fast reply, it confirms my fears :-| AdapterViewFlipper on Honeycomb. Opsssieee, no can do... the app has to be compatible with 2.2. -- 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] WebView with custom headers (in pre-Froyo)

2011-05-06 Thread Pinheiro
Hi! I made an app that loads URLs dinamically in a WebView. Since I need to add some custom headers I just call webview.loadUrl(url,extraheaders). The problem is that the extraheaders parameter only works in Froyo, not in previous versions. So, how to pass headers on previous versions? Anyone has

[android-developers] Re: Adding a contact without a READ_CONTACTS permission

2010-08-24 Thread Pinheiro
That only tells you about stuff you are doing.  Which can't be kept in sync with what is actually in the database, and doesn't prevent you from colliding with anything already in there. Duplicate contacts aren't that much of a nuisance, imho. They're easy to fix and prevent. Specially if you

[android-developers] Re: Adding a contact without a READ_CONTACTS permission

2010-08-23 Thread Pinheiro
all, it seems Google was more concerned about someone reading your contacts to get your private information than they were about a malicious program writing bogus values to your contacts (though I can see that as an attack vector too). Exactly, BOTH are attack vectors so it should be

[android-developers] Re: Adding a contact without a READ_CONTACTS permission

2010-08-23 Thread Pinheiro
Btw, if you are writing an application that is blindly stuffing contacts into the contact provider without looking at what is currently there...  I think this is fairly fundamentally flawed to start with. I beg to differ. If the application is well-made you'll get at least an warning that a

[android-developers] Re: Adding a contact without a READ_CONTACTS permission

2010-08-23 Thread Pinheiro
it would have to READ the contacts first. How would it possibly know it was a duplicate otherwise? Easy, use the SharedPreferences to store the contacts the user added. Of course, this could fail if the user deletes the contact but it's a minor problem. -- You received this message because

[android-developers] Re: Adding a contact without a READ_CONTACTS permission

2010-08-22 Thread Pinheiro
It is very hard to ensure that someone with write access can't also get data back from the provider, so generally no. It's a bit lame, imho. According to Google, developers should use the least permissions possible. But how can we do that if we have to use READ_CONTACTS to write contacts?

[android-developers] Adding a contact without a READ_CONTACTS permission

2010-08-21 Thread Pinheiro
I'm trying to add a contact inside an app but the only working code I've found requires READ_CONTACTS permission. Here's the code: ContentValues values = new ContentValues(); values.put(Contacts.People.NAME, contactName); Uri uri =

[android-developers] Detecting activity' fresh start

2010-08-09 Thread Pinheiro
Hi! How can we detect if an Activity is run for the 1st time? I mean, it's run just after the user clicked on the icon in the homescreen and not after some event like screen rotation? For instance: public class Incoming extends Activity { private boolean firstrun=true;

[android-developers] Re: Detecting activity' fresh start

2010-08-09 Thread Pinheiro
Thanks a lot, TreKing! -- 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

[android-developers] Emulating share dialog

2010-07-25 Thread Pinheiro
I'm creating an app that will use a dialog similar to the share dialog (intent.action.SEND) with my own options. Is there a built-in theme in the SDK I can use to emulate the look of this dialog? Note: I don't want to create an Intent, I just want to create a similar looking layout. -- You

[android-developers] Widget inside a pre-existing application

2010-06-28 Thread Pinheiro
I've created a complex application that uses SQLite and would like to give the user an option to install a very simple widget on the homescreen (just a number taken from the database). Do I have to create a new .apk just for the widget? I've tried to cut- and-paste the WordWidget example but it

[android-developers] Re: Widget inside a pre-existing application

2010-06-28 Thread Pinheiro
Thanks, YuviDroid! -- 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

[android-developers] Google Directions status?

2010-06-18 Thread Pinheiro
What's the current status for using Google Directions in Android apps? Will Google release a library to use it or programmers will have to do it the hard way using the API? Will the API limitation of 2500 queries/ day also apply for apps? Thanks in advance! -- You received this message because

[android-developers] Database folder

2010-06-14 Thread Pinheiro
After testing the various techniques to populate a large database (50.000 records, 700KB), I've decided to download a SQLite database directly from the Web to the phone (it takes just a few seconds, the alternatives took up to 3 minutes). My question is that since there isn't a method to get it,

[android-developers] Re: Database folder

2010-06-14 Thread Pinheiro
Thanks Mark! The problem is that that only works if the database already exists. I guess I could create a dummy database just to see where it is created but it's a nasty kludge. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this

[android-developers] Re: Database folder

2010-06-14 Thread Pinheiro
It worked! Thanks, Mark! The documentation lead me to believe that it would only work if the database is *already* created but that it's not true. -- 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] MapOverlay turns the phone unresponsive

2010-06-11 Thread Pinheiro
I'm trying to draw some points (around 200) in a MapOverlay and noticed that the application gets slow and the phone becomes unresponsive. Here's my code: MapOverlay mapOverlay = new MapOverlay(); ListOverlay listOfOverlays = mapa.getOverlays(); listOfOverlays.clear();

[android-developers] Re: MapOverlay turns the phone unresponsive

2010-06-11 Thread Pinheiro
Any reason you're not using an ItemizedOverlay? Afaik, ItemizedOverlay only supports one marker type, right? I want to be able to use several. Of course I could use several ItemizedOverlays, each with it's own marker, but I guess that will impact perfomance. -- You received this message

[android-developers] Re: MapOverlay turns the phone unresponsive

2010-06-11 Thread Pinheiro
Thanks, Mark! Strangely, I can't seem to make your code work. If I use: public MyItemOverlay() { super(null); ... the rest of your code... It crashes with NullPointer in: @Override public void draw(Canvas canvas, MapView mapView,boolean shadow) {

[android-developers] Re: MapOverlay turns the phone unresponsive

2010-06-11 Thread Pinheiro
Thanks BITS. Unfortunately the doc is not very helpful since it doesn't even give an hint on how to use different markers in the same ItemOverlay. -- 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] Re: MapOverlay turns the phone unresponsive

2010-06-11 Thread Pinheiro
Thanks, Mark! It seems to solve my problem :) -- 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] Re: missing Lists.newArrayList()

2010-05-29 Thread Pinheiro
Thanks, Dmitri. I've tried using _ID also but the results are the same. Also, sql parameters should always be passed using placeholders (question mark) and an array of arguments. Could you please give an example? -- You received this message because you are subscribed to the Google Groups

[android-developers] missing Lists.newArrayList()

2010-05-28 Thread Pinheiro
I was trying to delete a contact using the code in the docs: ArrayListContentProviderOperation ops = Lists.newArrayList(); ops.add(ContentProviderOperation.newDelete(Data.CONTENT_URI) .withSelection(Data._ID + =?, new String[] {String.valueOf(dataId)}) .build());

[android-developers] Re: missing Lists.newArrayList()

2010-05-28 Thread Pinheiro
Thanks Dmitri. Btw, do you know how to delete a contact without using a batch? This doesn't work, I don't know why: getContentResolver().delete(ContactsContract.Contacts.CONTENT_URI, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME+=+nameToDelete, null); -- You received this message because

[android-developers] ContactsContract and target version

2010-05-11 Thread Pinheiro
Hi! I'm creating an app that needs to create a contact. My 1st attempt was: ContentValues values = new ContentValues(); values.put(Contacts.People.NAME, Name); values.put(People.Phones.TYPE, People.Phones.TYPE_MOBILE); values.put(People.Phones.NUMBER, +1); Uri myUri =

[android-developers] Re: Scrollview doesn't like a complex child?

2010-04-29 Thread Pinheiro
Thanks for your help, Romain. What is the correct way to show a (non-scrollable) footer below a Scrollview? This doesn't work since the bottom of the content hides behind the footer: FrameLayout (height=wrap_content) Scrollview TextView - a very large text to scroll

[android-developers] Re: Scrollview doesn't like a complex child?

2010-04-29 Thread Pinheiro
Forgot to mention. This could be solved with a fixed footer height and putting layout_marginBottom in the scrollview but it's not a nice solution, imho. -- 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] Re: Scrollview doesn't like a complex child?

2010-04-29 Thread Pinheiro
Works! Thanks Treking and Romain. -- 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] Scrollview doesn't like a complex child?

2010-04-28 Thread Pinheiro
Hi! I've made a complex layout that has the following structure: ScrollView RelativeLayout RelativeLayout an image and several textviews /RelativeLayout several textviews /RelativeLayout /ScrollView Since

[android-developers] Re: Scrollview doesn't like a complex child?

2010-04-28 Thread Pinheiro
Opsie, it seems the problem is that the scrollview is inside a framelayout because I have navigation buttons at the bottom of the screen. Non-scrollable, of course. Seems like this is too complex for the SDK. Will have to figure out an alternative. -- You received this message because you are

[android-developers] ViewFlipper with just one View

2010-04-26 Thread Pinheiro
Hi! I'm planning on creating an app with a news page with image, title, content, etc. The flip animations used in most ViewFlipper applications are great but have one problem: only work with a ViewFlipper with a determinate number of view (in my case, I don't know how many news there are). The

[android-developers] Re: ViewFlipper with just one View

2010-04-26 Thread Pinheiro
Exactly what I thought. Thanks, Mark! -- 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] Subdirectories under Drawable

2010-04-23 Thread Pinheiro
Hi! I need to use a large number of small images in a project and tried to create directories under Drawable to put them but don't know how to open them. For instance, this doesn't work: aux=smallimage; int resID = getResources().getIdentifier(com.my.package:drawable/ icons/+aux,null,null); //

[android-developers] smallScreens: No resource identifier

2010-04-20 Thread Pinheiro
Hi! I don't know if this is a bug in Eclipse or something wrong in the SDK. I have a project with a Build Target set to 1.5 and want to support all screen sizes. So, as mentioned in the Dev Guide, I've put in manifest.xml: ... uses-sdk android:minSdkVersion=3 / ... supports-screens

[android-developers] Re: SlidingDrawer handle

2010-04-18 Thread Pinheiro
Thanks, Bob! Unfortunately, it seems Launcher's handle is not accessible (at least it's not in the SDK). Bummer, will have to reinvent the wheel and make my own :-( -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group,

[android-developers] SlidingDrawer handle

2010-04-17 Thread Pinheiro
Hi! Quick question: what is the drawable ID of the handle for the application's SlidingDrawer used in the home screen? Thanks in advance! -- 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] Passsing a Cursor to a Activity

2010-04-14 Thread Pinheiro
Hi! Since Intent.putextra doesn't accept Cursor, what is the alternative to pass a complex structure to a class? For instance: Cursor c; // assigned elsewhere ... Intent myIntent = new Intent(this, my.class); myIntent.putExtra(mycursor, c); // this won't work :-( startActivity(myIntent); ... in

[android-developers] Change item in Listview after clicking

2010-04-10 Thread Pinheiro
Hi! I've created a rather complex layout for listview rows where only the first line is visible (the rest use android:visibility=hidden). When an item is selected, I want all the invisible objects to appear (selected.setVisibility(1)) - checking first if I have to hide again the previous

[android-developers] Re: Change item in Listview after clicking

2010-04-10 Thread Pinheiro
Gotcha! Thanks, Mark! Unfortunately, it solves half the problem. When clicked, the hidden objects appear but the older selection doesn't disappear: private int selection=-1; ... public void onListItemClick(ListView parent, View v,int position, long id) { TextView tv; View

[android-developers] Two-level tab navigation

2010-04-09 Thread Pinheiro
Hi! I'm creating an app that has 2 levels of navigation: 1) Top level (options A B C) 2) Bottom level (option 1 2 3) Each of the top tabs (A,B,C) have different content in the bottom tabs (1,2,3) Using two levels of tabs is confusing and/or occupies a great deal of screen estate. Putting one of

[android-developers] Cannot cast from Bitmap to byte[]

2010-04-05 Thread Pinheiro
I'm trying to draw an image downloaded from the web but keep getting the error Cannot cast from Bitmap to byte[]. Here's the code snippet: BufferedInputStream bis = new BufferedInputStream(somethingdownloaded); DataInputStream dis = new DataInputStream(bis); Bitmap image;

[android-developers] Re: Cannot cast from Bitmap to byte[]

2010-04-05 Thread Pinheiro
Use BitmapFactory.decodeStream(). Got it, many 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] Re: Application already deployed. No need to reinstall.

2010-03-29 Thread Pinheiro
I'm having the same problem and found the same solution but it's very, very annoying. It seems like some file has a date somewhere in the future or it's just a big bug in Eclipse. Anyone found a easier/faster way to solve this? -- You received this message because you are subscribed to the