android

How to declare default searchable activity

Hi, I am trying to implement search in my application. My application contain 4 activities and I want to add the search dialog only on 3 of them while only one of them (ProductsActivity) will be the default context. unfortunately while I activate the search I keep getting the following error: "Key android.app.default_searchable expect...

Android download file out of memory woes

I am trying to download a zip file that is just less than 22 mb on start. I changed the default BufferedInputStream after these exceptions, but still get an out of memory error. public void downloadFromUrl(String fileName) { //avoid unknown host exception try { InetAddress i = InetAddress ...

Which event is called when a user click on the disabled item in context menu?

Hello, I have button, which displays a Context menu. In the menu are few items (some of them are disabled - setEnabled(false)). Which event is called when a user click on the disabled item? It's not onContextItemSelected nor onContextMenuClosed. But the menu is closed after the click. Thanks for your help. ...

Android, read message body in external program

Hi, I have registered the appropriate intents in my manifest and my app pops up as a possible viewer when I click any email message in the message list. If I choose my app as the message reader the intent is registered in intent.getAction() in my app but I am lost from there as I cannot extract the message body no matter what I try. Th...

How to copy pixels from one bitmap to another shaped like a circle ?

I am using setPixel and getPixel functions but they are using matrices which is naturally rectangle.I am trying to copy pixels shaped like circle ! update : now i am using this but i hope there is something more efficient than this one : for(int i=0;i<eHeight ; i++) for(int j=0;j<eWidth ; j++) if( Math.pow((i-eHeigh...

Stopping and starting a Service based on application state

I have a Service which tracks the location of the user. Currently, the Service boots when the application starts and stops when the application terminates. Unfortunately, if users keep the application in the background, the Service never stops and drains battery. I would like the Service to stop when my application is not in the foreg...

expandablelistview animation

I would like to do an animation for child elements when I expand a group in an ExpandableListView. Is there a common way to do that without starting animations on child views manually? ...

Android: how to debug application on Nexus One

The desktop application emulator works fine. Settings > Applications > Development > USB debugging is checked. The "USB debugging connected" alert is displayed on the Nexus One when the USB cable is attached but I can't seem to get the debugger to run the code on it. Is there something else I need to do to get the debugger to work on the...

Android Browser orientationchange event keeps firing

Following is simple html, when viewed on android browser(nexus one) results into continuos orientationchange event chain when you change phone's orientation just once.<html><body> <script type="text/javascript"> window.addEventListener("orientationchange",function(){alert("test");},false); </script> </body></html>Can somebody please expl...

Can I test status bar notifications using Android's testing framework?

I have a class that sends a status bar notification in Android. I can't find a way to test whether the notification was sent or not, which makes it very hard to write any kind of useful unit test. Does anyone have a solution for this? ...

Eclipse Android: Could not open Selected VM debug port (8700)

I am getting an error when opening eclipse: "Could not open Selected VM debug port (8700). Make sure you do not have another instance of DDMS or of the eclipse plugin running. If it's being used by something else, choose a new port number in the preferences." - pretty sure DDMS is the Andoid debugger, and I am also pretty sure it is not ...

show dialog yes/No before leaving the app via Back button

If user repeatedly presses back button, I need a way to detect when they are on the very last activity of my task/app and show "Do you want to exit?" dialog befor they return to Home Screen or whatever previous app they had running. Its easy enough to hook onkeypressed(), but how do I figure out that this is a "last" activity in the tas...

GLSurfaceView textured rect as button clicks

I just want to ask a simple question related the GLSurfaceView and drawn objects on it. I am drawing a rect and bind a texture to it. It works great. Then, the textured rect I am drawing is on a GLSurfaceView. I am drawing a "button"-like object for which I should know whether the user clicked on the button or not. I imagined that like...

How to apply , converting image from colored to grayscale algorithm to android ?

I am trying to use one of these algorithms to convert a RGB image to grayscale : The lightness method averages the most prominent and least prominent colors: (max(R, G, B) + min(R, G, B)) / 2. The average method simply averages the values: (R + G + B) / 3. The formula for luminosity is 0.21 R + 0.71 G + 0.07 B. But i g...

Handling Activity Stack in Android Apps

Lets say I have three Activities in my App. 1) Signup Activity 2) AccountActivate Activity 3) Main Activity Order 1 -> 2 -> 3 (User Signs Up -> if Sign up is successful -> Enters PIN and activates account -> if activation successful -> lands in Main Activity Now here is the problem. Once I am in Main and the activation is complete, ...

howto use connectbot/ssh functionality in my own app

Hello everyone. First, I'm new to Java and Android Development so I hope you're patient with me :) My aim in my first app is to establish an ssh-connection to my linux machine running openssh and sending commands to it on the one hand and receiving stdout on the other hand. Since there is an app for doing all the ssh that absolutely b...

Targeting specific carriers in Android

I read here: http://www.androidguys.com/2009/10/11/developers-can-now-target-by-carrier-in-android-market/ that it can be done if you go to the Android Market, and go to your app, then go to Publishing Options -> Locations, but I don't see anything to select a specific carrier there, only specific countries. Is this something that Goog...

Music in my game disturbs accelerometer values. How to solve this?

Hi. I'm writing a game where the player tilt the phone to control a character. The problem is: the music(when playing loud) and sound effect(like gun shots) disturbs the accelerometer values. This result in weird character movement. Please give me some advice on how to solve this. Thank you in advance! ...

Android: UTF-8 encoded HTTP response to String

Hi I am trying to convert a UTF-8 data to String. The UTF-8 data is obtained by HTTP connection. My problem is the converted String does not display UTF-8 Characters properly. Here is my code {extra bits removed } URLConnection urlconn = url.openConnection(); httpConn = (HttpURLConnection) urlconn; httpConn.connect(); InputStream in= ...

Android: loading an alpha mask bitmap

I have a single-channel PNG file I'd like to use as an alpha mask for Porter-Duff drawing operations. If I load it without any options, the resulting Bitmap has an RGB_565 config, i.e. treated as grayscale. If I set the preferred config to ALPHA_8, it loads it as a grayscale ARGB_8888 instead. How can I convince Android to treat this ...