android

Best practice to parse a JSON object on the client in Java & Android

In my Android client I want to receive JSON objects from a server. By googling I found a lot of different possibilities how to best parse the InputStream from the Server, but most of them wrote their own parser. Isn't there a library which does this parsing for me? Or how should I best implement it by myself? ...

Cursor returns a count of -1, but items are present?

I am using an SQLite database to store and retreive my app data, and what to check for duplicate entries. I attempt to retrieve all entries where the titles match, as such: Cursor c = mDb.query(DatabaseHelper.GOALS_TABLE_NAME, new String[] { Goals.GOAL_ID, Goals.TITLE }, Goals.TITLE + "='" + t...

Need Android BarCode Scanner Sample Activity

Hi, I recently seen Barcode Scanner ZXing for Android. So, ZXing is basically searching products which are of google. I want a very Sample Android Activity which calls ZXing Barcode Scanner from that Activity. I know it can be called from intents, but I need a working Android Bar Code Scanner Activity for searching products. Thanks ...

Creating/Running Android Virtual Device through Eclipse with networked user profile

Our user profiles are stored on a networked share (\shared-server\clientdata$\username). When I create an AVD through the SDK and AVD manager everything seems to appear to work correctly. When I try to start it I get the following errors: emulator: ERROR: unknown virtual device name: 'test_avd' emulator: could not find virtual device ...

Is it possible to throw an intent for APPWIDGET_UPDATE programmatically?

Would like a button in my widget to fire the APPWIDGET_UPDATE intent on the widget class to force an update, but I dont see APPWIDGET_UPDATE as a static field in Intent. Is this possible, and how would one do this? Intent intent = new Intent(context, BaseWidgetProvider.class); intent.setAction({APPWIDGET_UPDATE INTENT HERE}) PendingInt...

Android tabhost issue...code included

I am getting the following error when I try to launch an activity containing a tabhost. 08-25 16:51:42.551: ERROR/AndroidRuntime(27863): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.paratransit/com.paratransit.jobDialog}: java.lang.RuntimeException: Could not create tab content because could no...

Recalculate ScrollView on different ViewFlipper views?

I have a ScrolLView that wraps a ViewFlipper. The content in the ViewFlipper is not of equal height, so my second screen has a very long scrollbar that goes on and on with blank content: <ScrollView android:id="@+id/outer_scroll" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout...

AudioTrack on Android SDK gets inaccurate as it goes

I'm trying to make a real-time audio application on android. As OnPlaybackPositionUpdateListener seems never working on any versions of android, I'm on a workaround using separate thread that keeps writing on a buffer of an AudioTrack instance. track.write() seems to be a blocking call and it doesn't insanely write data on the buffer. ...

getting rid of extra space in text switcher

Hello World, I have an activity that extends ViewFactory. The activity does nothing more than act as documentation for my app, with 5 different 'views'. Each view is placed inside a ScrollView in a TextSwitcher. The problem that I am facing is that if one of the five views has more text than the next view, there is empty scroll space. ...

Android MediaPlayer Streaming from a PHP Redirect does not work-out!

Hi, The company I work for is developing an Android App that plays a video file from a URL on web. The video URL is a parameter for a PHP script that encode it properly and redirects to the encoded video as shown below: header('Content-Type: video/'.$format); header('Location:'.$output_video); Where $output_video is the URL to the en...

Android SDK ExampleAppWidget does not respond to Time zone change

I am right now running ExampleAppWidget that comes with SDK. Now I could not get the timezone change to affect the widget. It seems the ExampleBroadcastReceiver never gets called when timezone is changed. Anybody was successful in running this widget? I can provide the sample code if needed. Thanks in advance. -Sang Shin javapassion...

Determining if a device is using HTC SenseUI

How can I tell if a device is using HTC's SenseUI? I thought about using android.os.Build information, but they seem inconsistent.. is there a more definitive way? I need to be able to tell if I can launch the calendar by using com.android.calendar or com.htc.calendar. I welcome any suggestions!! ...

Capturing LinearLayout onClick events with ImageButton inside it

I have an ImageButton and a TextView wrapped in a LinearLayout like this: <LinearLayout android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="20" android:gravity="center" android:clickable="true" android:id="@+id/action_showhide"> ...

What's the best way to do "application settings" in Android?

I'd like to store some application settings (like the URL of an API, and some settings for testing) for an Android app. I mostly work as a .net developer, so I'm used to using an app.config for this purpose. What's a good way to do it in Android? ...

Select items runs fine in Chrome et al but not on Android G-1 browser?

This little web page runs fine on my desktop but when selecting the area with a G-1 Android device (select box that says statewide..) the data refreshed with the requested data in the table but the text in the select box does not change,,, the other select boxes (month and year) work fine.. Fwiw the data is still rough and so is the gadg...

Great Android interview questions?

What interview questions would you ask to distinguish great Android developers from the masses? ...

IllegalStateException with ExpandableListActivity and SimpleCursorTreeAdapter

Using com.example.android.notepad and ExpandableList2.java from com.example.android.apis.view, I have written a simple application that contains a content provider serving two tables in an sqlite database and a display activity that uses my ExpandableListActivity subclass. I am using my own layouts for the ExpandableList, and the group a...

CursorIndexOutOfBoundsException caused by Uri

Here is my LogCat log: 08-25 22:35:27.989: ERROR/AndroidRuntime(327): Caused by: android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 3 Here is the onCreate(Bundle) method where I get the cursor: private static final String[] PROJECTION = { Formulas._ID, Formulas.TITLE, Formulas.FORMULA }; @Ove...

Android adb logcat time filter

Does anyone know how to filter out the logcat ('adb shell logcat') so that it only shows the log statements after current date and time ? Thanks in advance. ...

Android: How do I attach a temporary, generated image to an email?

I have a programmatically generated image that I want to send as an attachment via the ACTION_SEND and EXTRA_STREAM method. But how do i do this? My first attempt (writing to my context.getCacheDir() based file path) appeared to work in the Gmail preview (no image preview, but attached file name and icon was visible), but the attachmen...