android

Search an Array Android

I have a textbox and search button, now all I need is the code to implement searching an array. The array I have is called Facts_Array (consists of strings). Comment if you need any more information. ...

Using ActionChooser with Attachment for email and Facebook-App in Android

I trying to create a "publish" button for an image in my android app, that works with the Facebook App and Email. This is my code (imagePath is something like "/sdcard/myapp/image.jpg" Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.setType("image/jpeg"); sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+image...

android webservice to a php server (XML vs JSON and SOAP vs REST)

Hey guys, I am actually looking for some opinion on how to get this done. I have a php server with a mysql backend to authenticate users using android os. I came across the debate of having JSON vs XML to minimize the overhead and using REST vs SOAP. Can I get some tips on what is the best path to go about getting this done ? I know its...

Method Undefined for the Type in Android

I have an error stating something like: The method foo() is undefined for the type bar(){} Eclipse tells me that after entering this code: ((application_variables) this.getApplication()).setSomeVariable("foo"); I'm not sure if this is the problem, but I have it located under.... public void onItemClick(AdapterView<?> parent, Vi...

Switching View Midactivity

I have a listview that is the main part of my activity. When there are no objects in the listview, I want to replace it with a helpful message (a TextView). I simply call setContentView again if the list is unpopulated in onResume. However, this only works for the TextView. If I call setContentView(R.layout.mylayout), then I get a blank...

Question on Android Layout

Can I modify android.R.layout.simple_list_item_1? For eg., I want to change the text color of the textview inside the listview dynamically. For this, I need to get to the textview and change its color.. How can I do that? ...

Android thread problem, why ui still blocks when i have used a worker thread?

package com.commonsware.android.threads; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.View; import android.view.View.OnClickListener; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; public class HandlerDem...

Android - Get current track info at app startup

How can I get currently playing track info at app startup? http://blog.dexetra.com/2010/09/get-current-playing-track-info-from.html has nice and working example on how to get info when android media player does some action (track is changed, finished, started etc). But when I launch my app I need to get currently (in the background) pla...

Adnroid Listview with spinner and a checkbox

Hello guys I am a newbie to android development. I am trying to create a List which has a spinner, a edit text and a check box. The data for spinner and check box come from data base. I have the following files. NewTransac class which extends ListActivity private PayDbAdapter mDbHelper; private Spinner paySpinner; private CheckBox mC...

Boxing and UnBoxing on Android

Hello. I'm developing an Android application. I have the following interface: public interface IDBAdapter { public enum Table { ... } public int insertItem(Table table, Object item); public boolean removeItem(Table table, long rowIndex); public Cursor getAllItemsCursor(Table table); public Cursor setCu...

How can I detect Android phones and Android tablets differently using the user agent header?

For my site I need to be able to tell the difference between when an Android tablet visits and when an Android phone visits. It needs to be detected before the page is sent to the user so using JavaScript to check the screen res isn't an option. At the moment I use this to detect an android device: stripos($ua, 'android') Is there an...

Change format of date in DatePickerDialog?

Hello, Following the Android SDK tutorials I have implemented my first basic date picker dialog. It works fine but is there any way to change the format of the date shown? Example: The date picker dialog displays the date as "17 Oct 2010". I would it like to be displayed as "17 10 2010". Greetings, Robert ...

How to make startActivity method render new activity view in the tabwidget?

I have setup a tabwidget, and in one panel there is a button to trigger a new activity, I want to display the sub-activities just in the tab widget, but not to open a new window. How can I do that ...

How to display a temporary view on top of a SurfaceView?

I'm somewhat new to android programming and writing a game, with most of the game displayed in a SurfaceView, but when a user performs certain actions in the SurfaceView, I'd like to be able to slide up another view from the bottom to give the user some options, without completely covering the SurfaceView and still allowing the user to i...

how to show a set of images as slide show in android ?

how i can show a set of images as slide show in android? ...

SMS gateway on Android Phone

We uses a Bulk SMS provider for SMS alerts to optimize our logistics. There are alot of issues with bulk SMS providers and Government regulations. To over come this issue we are planning to use an Android phone to act as an SMS gateway. We want to build an application on the phone which checks a a URL on our site for SMS to be sent, onc...

Deserialization throws IllegalAccessException

I'm trying to deserialize an object but it doesn't work. Has anyone an idea how to handle it? public static List<Leistung> findAll(Context ctx) { List<Leistung> result = null; FileInputStream in = null; Object obj = null; File f = ctx.getFileStreamPath("file.obj"); if (f.exists()) { try { in = c...

Android 2.2 Data Backup: How to backup DefaultSharedPreferences?

I am implementing the new BackupAgentHelper from android 2.2. For it to work you need to supply the name of the SharedPreferences that you want to backup: public class MyPrefsBackupAgent extends BackupAgentHelper { // The name of the SharedPreferences file static final String PREFS = "user_preferences"; // A key to uniquely identify t...

options menu - removing focus from item

how do I remove focus from options menu item? I.e. when I open the menu for the first time, none of the items has focus. however, if I focus on one of them using track ball, and then close and re-open the menu the focus is still there. How do I get rid of it? I am clearing and recreating the menu in onPrepareOptionsMenu (as I have to ad...

Understand when user is speaking at the phone

(Android) Some days ago I saw a way to register a broadcast receiver to understand when the screen goes black or the inverse. Now i'd like to find a way to understand when the users is speaking at the phone but i don't find a broadcast for this case, so how can i understand if the user is at the phone? (Possibly without always running a...