android

Toast in PreferenceActivity is shown late.

I want to show a Toast right after the user clicks on a CheckBoxPreference in my PreferenceActivity. myCheckBox.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { Toast.makeText(Prefs.this, "tes...

SoundPool sounds not changing

Hi, I have a soundpool object and several sounds, but once created I can't change the sounds playback in anyway, such as number of loops, volume, stopping, etc. Declaration code: public SoundPool sounds; public HashMap<Integer, Integer> soundmap = new HashMap<Integer, Integer>(); static final public int UFO=3; static final public int P...

Using reflection in android for backwards compatability

I was reading over at the android dev website about using reflections. But I'm really not grasping how to use it. I need this java file to run on a 1.5(SDK3) device but just ignore the new code and work fine on a 2.0(SDK5) and up phone. I have this Activity (posted below) and it's a simple webview. However, I want to have geolocation ena...

Round to 2 decimal places

Hi, I have the formular mkm=((((amountdrug/fluidvol)*1000)/60)*infrate)/ptwt; in my java code. The code works fine but returns to several decimal places. How do I limit to 2 or 3? Also can anyone recomend a book that teaches basic Android/java? Thanks Edit 04/09/10 Thanks to everyone who took the time to try to help with this proble...

Looking for a clear answer on how to reliably maintain a list of contacts in my application.

I've been reading for a couple hours now, trying to figure out how to maintain a reliable list of contacts in an Android application, but still cannot find one clear successful case. My situation is this: I let users create Groups in my application, and in each Group, the user can select, from their contact list on the phone, which use...

How to show a WebView with Theme.Dialog style in Android

I declared a WebView activity in the manifest like this: <activity android:name=".MyWebView" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.Dialog"> </activity> The WebView looks like this: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:...

Android: How to make scrollable table with frozen table headers ?

Hi. I wonder how I could make a scrollable table with static table header ? (with different elements in cells like buttons, images, etc.) I have already made some of this, but i dont know how to make columns in different tables match each other by width. <TableLayout> <TableRow> Table headers... </TableRow> <Scroll...

Testing with UI elements in Android view

I am attempting to test simple UI with the following test case, The main idea is to set in the test some of the UI text (to mimic user input) and then actively click an event. public class StackTestCase extends ActivityInstrumentationTestCase2<Stack> { private StackDemo mActivity; private EditText eaten; public StuckTestCase() { ...

Threads interrupted when new activity is started. Android.

I have a slightly strange thing happening in my code atm, which I don't understand... I would much appreciate any input anyone may have. So here's the issue: In my main Activity I fire a Service, using an Intent, when a button is pressed on screen. The Service instantiates 22 Runnable objects each of which read data constantly from 22 s...

Android: PreferenceActivity: Why is this 'simple' logic check on a stored preference value not evaluating?

Following an example from Professional Android 2 Application Development I set up a pref class as follows: //Preferences.java public class Preferences extends PreferenceActivity{ public static final String PREF_SPEED_UNIT ="PREF_SPEED_UNIT"; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(sa...

Does speech to text happens on device?

(I do not have any dev android phone and currently working on emulator only. As the emulator do not have voice input method, these silly question came up in my mind.) Does android process speech input on the device itsself (with limited computing power of 300-500MHz or 1 GHz) or it sends to Google Serves and gets text back? Does it w...

Adding items to data source doesn't appear in ListView

I am adding items to my data source and would like it to appear in my ListView. For some reason nothing is appearing: Adapter: private class STCompanyAdapter extends ArrayAdapter<STCompany> { private ArrayList<STCompany> items; public STCompanyAdapter(Context context, int textViewResourceId, ArrayList<...

Retrieve LogCat file from application

In my application, I want to enable an option for network debugging ONLY because it has a chance of error because of the network. So if it is enabled, then I want to be able to retrieve that log. Can I get the logcat from the device? Or do I have to store it in a flat file? ...

How to design a layout that looks good in portrait and landscape orientations?

I am finding that my layouts tend to look great in one orientation but if I change the phone's orientation, things are a mess. For example on one screen I have 6 large buttons that look great in portrait orientation but if the user changes phone orientation, those buttons get cut off in portrait. Do I need to code two layouts for every...

How to edit remote files on an Apache server with Android application.

I need my app to be able to go to a specified URL and access a file, then insert text at a specific line of said file. Is this at all possible? I greatly appreciate your help and responses, Thanks. ...

how to get the android phone model, version, sdk details?

Hi, how to get the android phone model, version, sdk details? ...

How to Scroll Down in the App Inventor Blocks Editor Window?

How can you scroll down in the Blocks Editor window? It lets me scroll down a little, but not to the end of my (lengthy) code. ...

Unable to start intent from application containing library

Hi: I want to start a service which is situated in a connected library project. All concerning classes are in the library. The service is called from an activity located in the library: Intent serviceIntent = new Intent(); serviceIntent.setAction("org.example.library.MY_ACTION"); startService(serviceIntent); In the manifest files -bo...

Not Accessing the Right URL?

My objective is to access one homepage, parse it for a link, and then access that link to parse for a title. This is what I have so far: try { articleURL = LoadArticleURL(homeurl); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { articleTitle = Loa...

Background process wont clear memory. Is it a good idea to kill my own process on Android?

Hi all, I have an app that has a widget. In the main app, I have an ad framework (cannot be edited due to licence) that is accumulatively leaking approx 1MB every time I exit the app. It appears one of its threads are running in the background (unnecessarily) that will keep its process and these threads will be created again when I laun...