android

How can I tell if the search string returned from SearchManager is a result of a VoiceSearch?

In my searchable.xml, I have: android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" I get the search string returned SearchManager like so: if (Intent.ACTION_SEARCH.equals(action)) { searchString = intent.getStringExtra(SearchManager.QUERY); } Is there any way to get from the intent whether the search string came from ...

Android: Serializable Intent

I have an object that has (among other things) a list of Intents. I want to pass this object as an extra to an Intent. However, the Intent class is not serializable, it is just "Parcelable". I assume that Parcelable is the android version of Serializable, but I'd rather not have to write my own serialization code for my class, and P...

Getting the default font size of a multiline TextView in Android

I want to have a font-size preference in percentage relative to the default font-size, so I need to get the default font-size for a TextView. How do I get the default font-size of a TextView? ...

Convert decimal feet to feet and inches?

How would I go about converting a measurement from, for example, 12.5 feet to 12ft 6in? How would I created that second number which reads only the decimal place when multiplying by 12? right now I have double Measurement01 using other variables and some math to get me the feet in decimals. I send that to a textview with farf.setText(Me...

getIntExtra always returns the default value

I am trying to pass an integer between activities using an intent. The source activity makes the calls info.id is the selected item from a ListView. Intent intent = new Intent(myActivity.this, newClass.class); intent.putExtra("selectedItem", info.id); ...

Exception for an unentered value?

In my calculation app, which takes a few inputs and uses them in a fixed formula to produce multiple outputs, the application crashes if I try to run it without putting a value into every input. I know how to catch exceptions, but I don't know the name of the exception that would be thrown by this kind of error. Can anyone help me out o...

Regarding android Development

Hi guys, I am doing an application in which I have to display the numbers on TextView randomly and automatically with the help of Timer. I am able to get the random Numbers in the log without repeating, but I am not able to print the same on device please help me... Regards, Akki Source: //RandomNumber.java public class RandomNumber...

Google Map Deployement Or Publishing Problem in Android?

dear friends, i created google map test application on two difference computers A, B i created two MD5 finger prints on both and obtained two different keys from google for Computer A and B. Key of Computer A does not show google map on Computer B and vise versa. Key of computer A only shows google map on Computer a only and same ca...

Does onTouchEvent() has to extends from MapView??

I want to catch any onTouchEvent() on the mapview. After search lots of questions&answers, I found only when I write my own MapView(MyMapView)and define onTouchEvent, then use this MyMapView in main activity. Is it the only way?? ...

Max thread number for one application ?

Hi guys. I wanna know about max thread number for one application. You know Thread.activeCount() returns the number of active Threads in the running Thread's group and its subgroups. If I can know the max number of threads to create in current activity, I can limit active threads. I am using thread for http connection and catching H...

About owner drawn (custom widget)

I'm considering to develop owner drawn EditText widget. So, what do you think I should read or refer, firstly? Or, could you give me some good examples of both owner drawn widget or custom widget? ...

Alert shown in onActivityResult

I am trying to show custom alert from onActivityResult. I need to inflate it, so am getting context with getApplicationContext() and everything is fine until I execute alertDialog.show() - then it fails with: Unable to add window -- token null is not for an application Do you know why I cannot do it? (it happens on 1.6 and 2.0 - I ...

Get window inner width and height of android built in webbrowser at all zoom levels

hi, I am trying by using javascript to get the window width and height of the build in webbrowser but can't find the right method, currently it seems the DOM doesn't know about the zoom level changes. Thanks ...

How to send an object from one Android Activity to another with Intent.putExtra?

Dear friends, Can anyone guide me as to how I can pass an object of a custom type from one Activity to another with the putExtra() method of Intent??? Any help would be appreciated. ...

Efficiently filter an ArrayList in Java/Android

Hi, I'm developing an Android app (Android 1.6), but this is probably a more general Java question. I have an ArrayList of about 10,000 objects the objects contain 3 strings (firstName, middleName, lastName). The user is presented with a "search box" on android where they can search for a particular "object" by typing in part of the n...

Saving and restoring non-Parcelable UI state for a dumb widget

I have a "dumb" custom Android widget (as in View, not a home screen widget) that I need to have retain some state during screen rotations. This PlayerWidget is essentially a media player UI with some buttons (back, forward, play/pause) and a progress bar. It exposes the important bits of UI via getters. There are a few separate Activ...

Android: Move whole layout upwards

I have a LinearLayout, when user selects my AutoCompleteTextView(ACTW) I want to move the whole layout upwards, so that the ACTW is at the top and there is space between the ACTW and software keyboard for suggestions. 1) How to do this? 2) How to make this animated (but this is not necessary)? ...

How to get location (on screen) of row in listview

I have implemented some gesture detection code so that I can detect when a row in my listview (which is situated in a FrameLayout) has been swiped. public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCIT...

android hourglass

How can I programmatically display an hourglass in an Android application ? ...

Android Widget Text Background

I have an app with a widget but I am having some difficulty with the layout of the widget. The basic idea if the widget should look like an icon and have a little text tag under it like any other icon on the desktop. I found one example which uses an android:background for the TextView and uses a drawable XML: <shape xmlns:android="ht...