android

Server socket programming in Android 1.5, most power efficient way?

Hello people, I am doing a project where I have too develop an application that listens for incoming events by a service. The device that has to listen too events is an Android phone with Android SDK 1.5 on it. Currently the services that call events only implement communication trough UDP or TCP sockets. I can solve my problem by setti...

Android: Render a string in an imageview

Hi, is there a way to render a string resource (from strings.xml) in an ImageView? Thanks ...

Android id naming convention: lower case with underscore vs. camel case

Hi, I'm currently programming an application for the Android. Now what I found out is that you cannot place resource objects, say, an image in the drawable folder and name it like "myTestImage.jpg". This will give you a compiler error since camel case syntax is not allowed, so you'd have to rename it like "my_test_image.jpg". But what ...

how to keep icons in listview in android?

how to keep icons in listview in android? ...

how to keep icons in listview in android?

how to keep icons in listview in android? ...

creating trigger across different databases

Hi, Is there any way to create triggers on different databases? my requirement is like:- database: a1.db consist table: t1 database:a2.db consist table: t2 now i have to use trigger on t1 (whenever any delete and update operation) happens on t1 a value has to be inserted into t2. waiting for your feedback... ...

Android: possible to attach a file to email without writing to SD?

My application stores data locally in the native SQLite db, and I want to allow users to export this data by emailing themself a .csv file. In order to do this I'm generating the .csv from the database and writing it to the SD card, then attaching it to an email: StringBuilder csv = generateFile(); writeFile(csv.toString(),"file.csv"); ...

Moving an ImageView

Folks, I have an imageView that I am moving around on top of another imageview. It's kind of circle selector. Its working fine, except that when I click a button elsewhere in the activity, the imageview is moving back to where it starts. Here is the code for when I move it. int upperLeftCornerX = (int)(mLastXTouchSetOval - mClipOval...

Java "settings object", serialization/deserialization

(Code is for Android Actually, I need code to be portable between Android and Java SE.) I want to have a "settings" class with various game settings, like public int map_size; public String server_name; etc. The data needs to be accessed fairly frequently (so members, not a key-value map), and from time to time de/serialized in some...

ListView not responding to Click or KeyPress

Hi, I have a simple ListView in my layout.xml file. <ListView android:id="@+id/action_list" android:layout_width="fill_parent" android:layout_height="wrap_content" /> And in my javacode, I add a setOnItemClickListener() to my listview: listView.setOnItemClickListener(new OnItemClickListener() { public void onItem...

Revoking permissions for an android app?

Say, an app declared itself as <uses-permission android:name="android.permission.INTERNET" /> Is there a way for a user (or another app) to revoke that permission (w/o iptables of course)? ...

Android bindService / remote services - any basic examples?

As a newbie to Android development, I'm trying to do the basics and build a media player. It works fine in one activity, but I'm now moving the MediaPlayer stuff to a remote service so it can carry on after the activity is destroy. I've moved the necessary code to the service, left comments in the activity where I'll need to call service...

Not understanding Activity stack?

Hi, I'm having trouble with my activities when they go in the background. I have two activities, A and B. Only A can launch B (manifest copied below). This is what I do: Launch the app from the app drawer (activity A) There's a button on A to launch B, B now is displayed. Hit the Home key, my app is now in the background. Go to the ap...

Supplying an intent for a ContentProvider to start when used in a LiveFolder does not resolve activities properly

I have created a LiveFolder which displays a few lineitems and I am trying to supply my own intents to each individual line item to be started when they are selected. I am doing this by inserting them into the column "INTENT" of a MatrixCursor in my ContentProvider class. I created another application all together, and executed the fol...

How to set trigger on contacts database in Android

Hi, I have a requirement wherein I need a list of all the contacts that are edited/changed. As per the Android documentation, _SYNC_DIRTY will be set every time a contact is edited. But, there seems to be a bug in this, which makes this always set to 1 (no matter what), even is we explicitly set it to 0. So, I was wondering if I c...

Pause music player on a phone call and again resume it after phone call in android

Hello, I am using android.media.MediaPlayer object to play audio files in my app. Everything works fine but when a phone call comes while a song is playing the app does not pause the media player and you can hear the song during the phone call. Please tell me how to pause media player on a phone call and again resume it after call is en...

Android: How do I know if Activity.onStop() is being called because the user is going back to Home?

I need be able to tell if Activity.onStop() was called because my application is moving to a new activity, or if it was closed because the user pressed the "Home" key or hit the back button from the bottom of the activity stack. The reason is because I need to know when it is appropriate to shut off music that is playing in my applicati...

java.net.UnknownHostException

public static final String readURL(String url)throws Throwable { try { InputStream in = (InputStream) fetch(url); byte[] bArr = readBytes(in); return new String(bArr); } catch (Throwable e) { throw e; } } public static final Object fetch(String address) throws MalformedURLException,IOException { URL url = new URL(ad...

How to set/get profile data with XMPP using Smack

I am working on a XMPP client on Android, using the Smack library. The roster/messaging/presence stuff is running very well. However, I didn't find a way to store additional profile information (userpicture, the dogs name, ...). The only way I see from googling is using VCards. But it simply did not work. I tried the following: VCard...

Android: How do I make the background color of a ListView show up behind the selection?

I have a ListView powered by a custom adapter that dynamically changes the background color of each row based on its contents. The getView looks like this: @Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; Power power = powers.get(position); if(row == null) { row = ge...