android

How to get Android Local Service instance

Hello all, I'm starting a service in my application using startService. I do not want to use bindService as I want to handle the service life time myself. How can I get an instance to the service started if I do not use bindService? I want to be able to get a handler I've created in the service class to post messages from the activity...

Stretch video to full screen in a SurfaceView extension

I have created a widget that is an extension of SurfaceView (very similar to VideoView) and I am working on a feature to stretch the video fully across the device screen when certain action is taken. I've looked at onMeasure function of VideoView and re-wrote it this way: @Override protected void onMeasure(int widthMeasureSpec, int heig...

Does the "Supporting Multiple Screens" document contradict itself?

In the Supporting Multiple Screens document in the Android Dev Guide, some example screen configurations are given. One of them states that the small-ldpi designation is given to QVGA (240x320) screens with a physical size of 2.6"-3.0". According to this DPI calculator, a 2.8" QVGA display equates to 143 dpi. However, further down the...

Android WebView not respecting scaling percentage...

I have a WebView which I'm trying to have scale to a certain percent on loading the page. The iPhone version of this software uses the HTML meta-tag: <meta name="viewport" content="width=320, initial-scale=0.95, maximum-scale=2.0, user-scalable=1"> Since Android's WebView doesn't seem to respect that tag I hard-coded the percent using...

how to replace the \n in java?

hi folks, I have working in facebook for my app in android. it have to use the string to pass as a url. But my description value has lot of spaces and line breaks. i have to rectify while passing that value as url without spaces. but it will posted on the facebook wall with the spaces. Is it possible?Any Idea. ...

How can I create photo effects in Android?

I'd like to make an Android app that lets a user apply cool effects to photos taken with the camera. There are already a few out there, I know, but I'd like to try my own hand at one. I have been googling and stack-overflowing, but so far I've mostly found some references to published papers or books. I am ordering this one from Amazon...

Using local files, Android.

Hey Everyone, I am trying to overlay route data in KML files on a MapView. The following code works great: Intent mapIntent = new Intent(Intent.ACTION_VIEW); Uri uri1 = Uri.parse("geo:0,0?q=http://code.google.com/apis/kml/ documentation/KML_Samples.kml"); mapIntent.setData(uri1); startActivity(Intent.createChooser(mapIntent, "Test"));...

Android : showDialog not displayer inside onActivityResult after take photo

Hello, When i'm in onActivityResult and i try to show a custom progress dialog, The dialog is not show, but the function is called, but nothing is displayed If i put this dialog in Oncreate it's working i see the dialogbox, Is it possible to show a custom dialog on return of Intent.ACTION_GET_CONTENT / MediaStore.ACTION_IMAGE_CAPTURE T...

IllegalArgumentException when trying to run an OpenGL ES 2.0 application

When I add the following line to my GLSurfaceView class I get an IllegalArgumentException from some random place. I don't know where the problem is because it doesn't give a stack trace. setEGLContextClientVersion(2); What else do I need to do to get an OpenGL ES 2.0 application to work? NB: I'm trying to run the application on the e...

TextView underline phone number and hyperlink

I've written an app which contains a large textview for displaying notes. Is it possible to have the textview highlight any phone numbers or hyperlinks without underlining the entire view? ...

Android: Set a random image using setImageResource

I need a help with setting a random image using setImageResource method. In the drawable folder, I have a jpeg file named photo0.jpg, photo1.jpg...photo99.jpg. And the following code works: int p = R.drawable.photo1; image.setImageResource(p); The above will display photo1.jpg but I want to show a random image. I tried the following b...

I'm new one in Android and HELP :)

Hello everyone , I'd started for about a mouth and I have some problems now :( 1. I create a TabActivity and it has three Activity(tab1,tab2,tab3).I wanna realize that if I press a button in tab1,then TextView in tab2 can be changed. I've tried Intent and Bundle , but that didn't work and force close . Maybe because of the TabActivity...

Is it possible to have a SeekBar's thumb image extend outside the bar?

I have set negative paddings on my custom seekbar so that the round thumb image can go outside the bar, but the thumb isn't rendered out there, is there anyway to force the thumb to be drawn outside those bounds? Sorry guys, I'm new to Android development, and have been tasked with fixing an existing application. The problem is that we ...

Android 2.0 contact groups manipulation

I would manipulate the contact groups in Android 2.O. My code is following: To get a list of group (with id and title): final String[] GROUP_PROJECTION = new String[] { ContactsContract.Groups._ID, ContactsContract.Groups.TITLE }; Cursor cursor = ctx.managedQuery(ContactsContract.Groups.CONTENT_URI, GROUP_PROJECTION, null, null, Contac...

How to check if vibration happened, in logcat?

I searched in the web but i couldn find a single article dealing in a straight forward way on how to find the vibrate on/off logs in logcat. If anybody who is aware of the procedure, please enlighten me. Once again i need it specifically to check if my app triggers vibrator or not... ...

How to send a JSON object over Request with Android?

Hi, I want to send the following JSON text {"Email":"[email protected]","Password":"123456"} to a web service and read the response. I know to how to read JSON. The problem is that the above jason object must be sent in a variable name jason. How can i do this from android? Like creating a request object setting content headers etc. ...

Getting a nicely formatted timestamp without lots of overhead?

In my app I have a textView which contains real-time messages from my app, as things happen, messages get printed to this text box. Each message is time-stamped with HH:MM:SS. Up to now, I had also been chasing what seemed to be a memory leak, but as it turns out, it's just my time-stamp formatting method (see below), It apparently pro...

generating function arguments in java

I'm very new to java and am working on my first Android app. I am using the webview demo as a template. I am trying to generate a random integer between 1 and 12 and then call a certain javascript function based on the result. Here's what I have: int number = 1 + (int)(Math.random() * ((12 - 1) + 1)); number = (int) Math.floor(number); ...

Any "trick" to use some keys to launch an application?

Hello, I am currently developing an free application (TaskOS ) that allow users to have multitasking and switch easily between applications on their mobile ( like alt+tab in Windows ) That work pretty well and user can launch my application by a long press on the "search" button" by adding this line in the manifest: <action an...

Android: can I programatically extend wifi range?

I realize that it would probably require boosting antenna power and thus reduce battery life but, if I am prepared to accept that, can I programatically extend wifi range? I don't find anything at http://developer.android.com/reference/android/net/wifi/WifiManager.html ...