[android-developers] Android Notification
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 a new event, you need a service or application running in the background already resolved. 2 - how do I check daily if today's date is equal to an event. -- 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] item tag requires a 'drawable' attribute
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:state_enabled=true android:state_window_focused=true / item android:drawable=@drawable/dark / /selector And I'm getting the error in Eclipse: Binary XML file line #2: item tag requires a 'drawable' attribute or child tag defining a drawable Anyone knows what the problem is? I've tried to clean the project and restarting Eclipse but nothing worked. 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@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] stroke bottom?
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:topRightRadius=2dip / /shape Unfortunately, I haven't found a way to hide the bottom stroke. Is it possible to do it in Android 2.2+? 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@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] Clickable elements on widget
Hi! Is there a way to have clickable elements inside a widget? (for instance, to change some text when an image is clicked) AFAIK, widgets only use setOnClickPendingIntent() that detects a click on all of the widget, it's not possible to set a method for a single element. Or is there? Thanks 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 For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] TabWidget NullPointerException in pre-Froyo
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) This happens even with an empty OnCreate method: public class MyTabHost extends TabActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mycustomtab); } mycustomtab.xml: --- ?xml version=1.0 encoding=utf-8? TabHost android:layout_width=fill_parent android:layout_height=fill_parent android:id=@android:id/tabhost xmlns:android=http://schemas.android.com/apk/res/android; LinearLayout android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent FrameLayout android:layout_width=fill_parent android:layout_height=wrap_content android:id=@android:id/ tabcontent android:layout_weight=1 / TabWidget android:layout_width=fill_parent android:layout_height=wrap_content android:id=@android:id/tabs android:layout_weight=0 android:layout_alignParentBottom=true android:layout_marginBottom=-5px / /LinearLayout /TabHost --- I did a quick search and found other developers with the same problem but it seems no-one has found a solution to this problem (possible bug in Android?). Can anyone help? 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@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] Animated markers in MapView
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 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] Unknown option '--no-crunch' in latest AAPT
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 (Eclipse-Help-Check for updates). Then again, it could be just a coincidence... Anyone knows how to get rid of this problem? 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@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: Unknown option '--no-crunch' in latest AAPT
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 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: Unknown option '--no-crunch' in latest AAPT
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 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] Waking the screen after PARTIAL_WAKE_LOCK
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) { pm = (PowerManager) getSystemService(Context.POWER_SERVICE); wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP screenOff); wl.acquire(); // on the URL reading method: while ((line = reader.readLine()) != null) { if (!pm.isScreenOn()) { // There is a message, turn the screen on pm.userActivity(SystemClock.uptimeMillis(), false); Log.i(TAG,Screen on); ... do stuff -- This has two problems: 1) The screen doesn't turn on, as expected (although the code is run, including the Log.i) 2) How to prevent the appearance of the default lock screen? That is, how can it jump directly to my app after the screens turns off and the users touches a button or the screen? I've tried to (re)acquire the wakelock to turn the screen on but that doesn't work. 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@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: Waking the screen after PARTIAL_WAKE_LOCK
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@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: Waking the screen after PARTIAL_WAKE_LOCK
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?) ;-) specifically told Android not to turn the screen on, by using PARTIAL_WAKE_LOCK. I want it to turn off automatically until a message is received or the user touches something. As I said, reading the docs PowerManager.ACQUIRE_CAUSES_WAKEUP and a new acquire() *should* solve the problem but doesn't. Poke around in KeyguardManager -- I think there's something in there for this. Thanks, will look into it. -- 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: Waking the screen after PARTIAL_WAKE_LOCK
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 touches the screen or button. I'm starting to think PARTIAL_WAKE_LOCK won't work and I'll have to use timers to turn screen off by releasing a FULL_WAKE_LOCK. I never thought turning the screen on and off would be so difficult. -- 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: Waking the screen after PARTIAL_WAKE_LOCK
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 and pm.userActivity() when a message is received is working :) -- 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: Always-on GPS: widget or app?
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 fix. Also, the new alarm will be created only after a fix so that there isn't a possibility of alarm conflict (one alarm is not done with the GPS and then there's a new one). -- 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] Always-on GPS: widget or app?
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 background? The problem with a regular app is that it will be paused if there's a low memory situation. That would stop the GPS updates, making the app useless. (Correct if I'm wrong) If I use a widget instead, I'm certain it will be started each 5 minutes and requestLocationUpdates() will be called (with a removeUpdate() every time there's a fix). But can I be certain the widget will stay in memory until there's a GPS fix? Or, if the GPS fix takes too long, there is also the risk that the widget will be paused before acquiring a fix? Comments by anyone with field experience on the subject will be most welcome, 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] Re: Always-on GPS: widget or app?
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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Prevent activity pause
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 not call super.onPause() but that doesn't work. Is there any way to accomplish this? 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@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: Prevent activity pause
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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Stripe Animation in XML
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 xmlns:android=http://schemas.android.com/apk/res/android; translate android:fromXDelta=100%p android:toXDelta=0 android:duration=300 fromYValue=0%p toYValue=25%p / translate android:fromXDelta=100%p android:toXDelta=0 android:duration=300 fromYValue=25%p toYValue=50%p / translate android:fromXDelta=100%p android:toXDelta=0 android:duration=300 fromYValue=50% toYValue=75%p / translate android:fromXDelta=100%p android:toXDelta=0 android:duration=300 fromYValue=75%p toYValue=100%p / /set Anyone knows what's the problem? 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@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] ViewFlipper with arbitrary number of Views
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 in RAM? If I use, fo instance, a gallery with 100 or even 1000 photos with 320x480, will I run the risk of running out of memory or is Android smart enough to and fetch and drop Views from memory as needed? The alternative is the use a ViewFlipper with just 3 views (current, previous and next) and load photos as needed but it is a cumbersome process. Nevertheless, if anyone has a code example, I will be very grateful. 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@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: ViewFlipper with arbitrary number of Views
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@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] WebView with custom headers (in pre-Froyo)
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 been able to do this in WebView? 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@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: Adding a contact without a READ_CONTACTS permission
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 consider the other option is adding another permission, going against Google's own best practices that we should use the least permissions possible. What is it that you are actually trying to do here? Consider, por instance, a database of contacts of sports clubs. Put them in a map and let the user choose to add a contact for the local club by adding a button. The app stores the addition and warns the user if he tries again to add the same contact. This is NOT blindly stuffing a contact, as you said, it is a normal response to a user action. If writing a contact is and will be impossible without the READ_CONTACT Google should at least assume READ_CONTACT after adding WRITE_CONTACT in the manifest.xml. -- 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: Adding a contact without a READ_CONTACTS permission
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 possible to read w/o writing and vice-versa. Having said that, it's potentially more harmful to read contacts than to write them. The later could be easily fixed afterwards but the former could be big problem - think of a program that sends all of your contacts to a web site. -- 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: Adding a contact without a READ_CONTACTS permission
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 contact was already added. For me, this is way better than requiring an app. to have permission to read when all it wants is to write contacts. -- 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: Adding a contact without a READ_CONTACTS permission
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 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: Adding a contact without a READ_CONTACTS permission
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? Personally, I get suspicious when an app wants to read my contacts. editor with your data to allow the user to be involved with adding it, using SHOW_OR_ADD_CONTACT:http://developer.android.com/reference/android/provider/ContactsContr... Thanks, that is a good alternative. -- 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] Adding a contact without a READ_CONTACTS permission
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 = Contacts.People.createPersonInMyContactsGroup(getContentResolver(),values); Uri newContact = Uri.withAppendedPath(uri,People.Phones.CONTENT_DIRECTORY); values.clear(); values.put(People.Phones.TYPE,People.Phones.TYPE_WORK); values.put(People.Phones.NUMBER,workPhone); getContentResolver().insert(newContact, values); Since READ_CONTACTS could freak people out, is there any other way to insert a contact that requires only the WRITE_CONTACTS permission? 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@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] Detecting activity' fresh start
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; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (firstrun) { // This is always run firstrun=false; ... do some heavy work (import a database from the web, etc) } The variable firstrun is always true. I've tried to change the firstrun value in onResume but it's called after and not before onCreate. Is there a simple way to do this or will I have to resort to capture screen orientation using onConfigurationChange? 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@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: Detecting activity' fresh start
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 more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Emulating share dialog
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 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] Widget inside a pre-existing application
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 takes over the application (does nothing when started) and after installing the widget any click on it gives an exception View not attached to window manager. If I have to create a new .apk just for the widget, will it be able to access directly the databases from my main application? 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@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: Widget inside a pre-existing application
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 more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Google Directions status?
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 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] Database folder
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, the folder where databases are stored is always getBaseContext().getFilesDir().../databases ? Is this a valid assumption for all Android versions? 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@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: Database folder
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 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: Database folder
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@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] MapOverlay turns the phone unresponsive
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(); listOfOverlays.add(mapOverlay); ... class MapOverlay extends com.google.android.maps.Overlay { Cursor c; Bitmap bmp; private MapOverlay() { ...initialize Bitmap and then Cursor with around 200 points taken from a database... } @Override public boolean draw(Canvas canvas, MapView mapView,boolean shadow, long when) { super.draw(canvas, mapView, shadow); for (int f=0;fc.getcount();f++) { c.moveToPosition(f); Point pt=new Point(); mapView.getProjection().toPixels(new GeoPoint(c.getInt(0),c.getInt(1)),pt); canvas.drawBitmap(bmp, pt.x,pt.y-16, null); Log.i(TAG,Drawing point +f); } ... After adding the Log.i message I found the problem, the loop is run endlessly (note that the phone is quiet and there's nothing happening in the background): I/XP (10507): Drawing point 0 I/XP (10507): Drawing point 1 ... I/XP (10507): Drawing point 199 I/XP (10507): Drawing point 0 I/XP (10507): Drawing point 1 ... I/XP (10507): Drawing point 199 Is this a normal behaviour, a bug in the OS or am I doing something wrong? -- 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: MapOverlay turns the phone unresponsive
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 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: MapOverlay turns the phone unresponsive
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) { super.draw(canvas, mapView, shadow); } But it works somewhat if we change the constructor to: public MyItemOverlay(Drawable defaultMarker) { super(boundCenterBottom(defaultMarker)); Unfortunately, it only shows the defaultMarker, despite the use of the CustomItem with other Drawables. Maybe this feature is deprecated? Or the behaviour of ItemOverlay's super() has changed? -- 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: MapOverlay turns the phone unresponsive
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@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: MapOverlay turns the phone unresponsive
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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: missing Lists.newArrayList()
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 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] missing Lists.newArrayList()
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()); getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops); But Eclipse doesn't how to find Lists. What import statement do I need? Also, is there a more direct way to delete a contact? 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@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: missing Lists.newArrayList()
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 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] ContactsContract and target version
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 = getContentResolver().insert(People.CONTENT_URI,values); This creates an exception: column NUMBER is invalid (huh?) It seems People.Phones.NUMBER is deprecated so I tried to use ContactsContract. Unfornately ContactsContract and RawContacts are not resolved (using Eclipse) unless... I change the project target to 7. Since I need the app to run on target 3 (1.5), could please someone tell me how to add a contact - that works on always versions? 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@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: Scrollview doesn't like a complex child?
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 /Scrollview TextView -- footer (layout_gravity=bottom) /FrameLayout RelativeLayout with a footer with layout_alignParentBottom=true gives the same result. -- 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: Scrollview doesn't like a complex child?
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@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: Scrollview doesn't like a complex child?
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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Scrollview doesn't like a complex child?
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 Scrollview only supports one child, I've created a RelativeLayout to scroll several Views. Unfortunately, this doesn't work (no scrolling). Are there limitations to the kind of children used in Scrollview or am I doing anything wrong? 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@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: Scrollview doesn't like a complex child?
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 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] ViewFlipper with just one View
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 only solution I found is to duplicate the View, prepare the contents off-screen then call ViewFlipper's showNext() when the Next button is pressed. This is a cumbersome and wasteful. Is there any other way to do this? 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@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: ViewFlipper with just one View
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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Subdirectories under Drawable
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); // Not OK But if I put the smallimage file in drawable, it works: int resID = getResources().getIdentifier(com.my.package:drawable/+aux,null,null); // OK Also tried to put the images in their own folder under /res but Eclipse refuses to Run with the error invalid resource directory name Is this a limitation of the SDK (using a target of 1.5) or am I doing something wrong? 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@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] smallScreens: No resource identifier
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:smallScreens=true android:normalScreens=true android:largeScreens=true / Eclipse gives 3 no resource identifier for attribute --- in package Android, one for each screen size. Is this a known bug or am I doing something wrong? 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@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: SlidingDrawer handle
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, 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] SlidingDrawer handle
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@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] Passsing a Cursor to a Activity
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 my.java: public my my extends Activity { ... If the cursor is very complex, it will be a pain to mention each and every item using putExtra (and then again in the receiving Activity). 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@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 To unsubscribe, reply using remove me as the subject.
[android-developers] Change item in Listview after clicking
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 selection. Here's the (simplified) code: private TextView selected=null; ... public void onListItemClick(ListView parent, View v,int position, long id) { if (selected!=null) { selected.setVisibility(0); } selected = (TextView) findViewById(R.id.text2); // text2 is an invisible object that I want to show selected.setVisibility(1); } The problem is that this only retrieves the invisible items in the first Listview row. What's the way to access ListView rows and change 'em? 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@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 To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Change item in Listview after clicking
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 linha; if (selection!=-1) { linha=(View) parent.getChildAt(selection); tv = (TextView) linha.findViewById(R.id.text2); tv.setVisibility(0); linha.postInvalidate(); } linha=parent.getChildAt(position); tv = (TextView) linha.findViewById(R.id.text2); tv.setVisibility(1); selection=position; ... Anyway, it seems I'll have to rethink my list since objects defined as invisible in the layout nevertheless occupy screen space (!). I'll have to create dinamically in my Java class. -- 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 To unsubscribe, reply using remove me as the subject.
[android-developers] Two-level tab navigation
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 levels in the Menu could be counter- intuitive for some. What is the best way to solve this dilemma? This is not a programming question but I'm sure many developers faced this 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Cannot cast from Bitmap to byte[]
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; dis.read((byte[]) image); // Error: cannot cast What am I doing wrong? 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@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 To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Cannot cast from Bitmap to byte[]
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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe, reply using remove me as the subject.
[android-developers] Re: Application already deployed. No need to reinstall.
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 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.