android

Android Persistent ContentObserver

Are content observers persistent in Android? If I create a content observer in an activity, will that observer continue to run until I remove the observer. Basically I am creating a service for SMS, where on receive and on send I post the SMS out to a web service, so I can check my messages with out having my phone. If the content ...

Managing media using the Android MediaStore

I manage media (images, sound) of my app directly, reading and saving to the SD card. Should I be using the MediaStore instead? I'm not quite sure what the MediaStore is for, and the javadoc is not very helpful. When should an app use the MediaStore? A brief overview of the pros and cons of the MediaStore will be much appreciated. ...

Why isn't multi-touch working for my imagebuttons?

I'm using imagebuttons that play sounds using SoundPool. Here is example code of one of the imagebuttons: ImageButton Button1 = (ImageButton)findViewById(R.id.sound); Button1.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.AC...

Static Data Structures on Embedded Devices (Android in particular)

I've started working on some Android applications and have a question regarding how people normally deal with situations where you have a static data set and have an application where that data is needed in memory as one of the standard java collections or as an array. In my current specific issue i have a spreadsheet with some pre-calc...

Android - Simulate Home click

I know calling finish() in activity will produce same result as if user clicked on Back button; is there a similar thing for Home button? (would like to automatically show Home screen after certain action). EDIT: Also, I would appreciate same thing for Menu & Search buttons. Thanks! ...

Android: How can i print a variable on eclipse console

I wanted to print the value of a variable on the console for my debugging purpose but system.out.println doesnt work. Please help ...

Linear Layout Issue at Runtime

Hi all, I am trying to build a layout dynamically which display some text and image for the most part, but has a series of buttons placed next to each other in the bottom. I have a linear layout that carries the text, another linear layout that carries the image. And yet another linear layout that carries the buttons that get created ...

How to use a ListView and a ViewFlipper to navigate user in an Android app?

I want to set up some menu-like navigator for my app. There is a listView in the main page and it contains two items, click each one will show its child view with ViewFlipper, and if user clicked the back button, he will return to the homepage again. The question is how to make it, I can only use ViewFlipper to flip to next screen or ...

Android - Images from Assets folder in a GridView

Hi, I have been working on creating a Grid View of images, with images being present in the Assets folder. http://stackoverflow.com/questions/1933015/opening-an-image-file-inside-the-assets-folder link helped me with using the bitmap to read it. The code am currently having is: public View getView(final int position, View convertVie...

how local service can invoke a sync method on it's main activity?

Hi, ive configured local service under some app. i wanna know how could i invoke methods on the activity, through the service in a synchronous way for example: the service invoke a method inthe activity and waiting for for result(synchronous) from it. (the method exists in the activity) thanks. ...

Android internet connectivity check problem

Hello, I'm new to Android development and working on an Android application that requires the phone to be connected to the internet, through either Wifi, EDGE or 3G. This is the code that I'm using to check whether an internet connection is available public static boolean isConnected() { ConnectivityManager cm = (ConnectivityManag...

KSoap2 list handling - is this the correct way?

Hello, ksoap-newbie here I have a basic soap service running on glassfish, that returns List<String> like this <?xml version="1.0" encoding="UTF-8"?> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"&gt; <S:Body> <ns2:getNamesResponse xmlns:ns2="http://namespace/"&gt; <return>Name1</return> ...

Android "application stopped unexpectedly" - google Hello MapView Tutoria

Hi, I'm trying the Hello MapView Tutorial at the moment. Whe I launch the program in the emulator, I get a huge number of errors (none of the exceptions seems to be related with lines in my code). The emulator window tells the program "stopped unexpectedly". Can anybody tell me which is the key line in the error output? What do I have to...

Click two buttons at the same time in Android

I have two buttons that both have onTouchListeners and perform an action when pressed down. Why do they not work if you try to click both at the same time? I'm building for Android 1.6. I don't have a real device to test on, and you can't test clicking two things at the same time in the emulator. Thanks for any help. ...

Android : HTTP Post Issue

HttpClient client = new DefaultHttpClient(); String data = "valid SOAP REquest"; HttpPost httpPost = new HttpPost("valid url"); Log.d("inside", "created http post"); try { ByteArrayInputStream baos = new ByteArrayInputStream(data.getBytes()); Log.d("inside", "firing request..."); ...

Android: Playing sound when button clicked?

Hi all, I'm trying to play a sound file when a button is clicked but keeps getting an error. The error is "The method create(Context, int) in the type MediaPlayer is not applicable for the arguments (new View.OnClickListener(){}, int)" Here's my code: @Override public void onClick(View v) { // TODO Auto-generated method stub But...

Speed up compilation with mockito on Android

I am currently developing an android app in eclipse using: One project for the app One project for the tests (Instrumentation and Pojo tests) In the test project, I am importing the mockito library for standard POJO testing. However, when I import the library, the compilation time skyrockets from 1 second to about 30 seconds in eclip...

Android : List View or SPinner

Team, I would like to know how to display a List View or SPinner using key and value pairs in Android platform. For example take Contacts Contact has id, First Name, LastName, i would like to display First Name and Last Name in the list view or in the spinner, id1, lastname1, firstname1 id2, lastname2, firstname2 id3, lastname3, fir...

App will not launch from drawer after phone is removed from car dock

I am creating a replacement Car Home app for Android 2.0+ devices. The app needs to launch when the phone is inserted into the car dock, as well as terminate when it is removed from the dock. It also needs to be able to be launched from the app drawer. I'm having a problem right now where once the phone is inserted and removed from the...

Issue with android tablayout switch tab

I am a new android developer, just tried something with Android Tablayout. There are two tabs and one tab has a GridView and the other one has a DatePicker. I created an activity and layout for each tab. The problem is that when I switch to the gridView, the background is not refreshed, and the images are just drawn over the DatePicke...