android

Basic android error (Beginner)

Sudoko Android requires .class compatibility set to 5.0. Please fix project properties. What this error mean? Please let me know if i need to paste some code.. ...

Making element draggable with Android WebView (ideally, just with Javascript) ?

I'm building an app with a build target of 1.5 . I have a variable, WebView browser, that is calling loadUrl to load a static HTML page from my assets folder. In that HTML page, the following JavaScript is defined: var supportsTouch = ('createTouch' in document); ... var w = $('wrapper'); w[supportsTouch ? 'touchmove' : 'onmousem...

Android setContentView operation

I've read that it's important to call setContentView() early in an activity since it builds the view objects that may be manipulated by subsequent code in onCreate(). In terms of lifecycle, does the view get drawn to screen as soon as setContentView() is called, or does it allow the onCreate() function to build/populate the information ...

Communication PC <-> Android Device

Hi, I would like to create a program wich communicates between pc and an android mobile connected to USB via tcp/ip. Is this possible? How can I get the IP-address to a connected mobile from PC or the other way around? Any help appreciated ...

Creating a list of integers in XML for android.

I would like to create a list of Integers in the /res folder of an android project. However, I want those integers to point resources in /res/raw. So for example, I would like something like this: <?xml version="1.0" encoding="utf-8"?> <resources> <integer-array name="built_in_sounds"> <item>@raw/sound</item> ...

PendingIntent in Widget + TaskKiller

Hi, I've developed an Application (called Instant Buttons) and the app has a widget feature. This widget uses PendingIntent for the onClick of the widget. My PendingIntent code is something like this: Intent active = new Intent(context, InstantWidget.class); active.setAction(String.valueOf(appWidgetId)); active.putExtra("b...

How to launch activity from android home screen widget

Hi all, I am desperately trying to get my head wrapped around how to implement home screen widgets. Right now, I (finally) was able to get a button on my widget respond to a button press setting up an intent filter in the manifest. However, I cannot for the life of me figure out how to launch an activity when the button is pressed. B...

Problem with Refreshing data in ExpandableListView

Hi! My problem is when I want to refresh data in ExpandableListView while being in that current activity. I create adapter and when I want to add new data to list I call again constructor of that adapter(it is my private variable) with all new data....and then I call onContentChanged() method to redraw my list. But what happens is that ...

Android Drawable question.

Hey Everyone, I am trying to create a drawable in code and change the color based on some criteria. I can get it to work but it doesn't want to let me set the padding on the view. Any help would be appreciated. <?xml version="1.0" encoding="utf-8"?> <ImageView android:id="@+id/icon" android:layout_width="50px" android:...

How to make android app's background image repeat.

I have set a background image in my app, but the background image is small and I want it to be repeated and filled in the whole screen. What should I do <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:ba...

[Android] For-Loop Performance Oddity

I just noticed something concerning for-loop performance that seems to fly in the face of the recommendations given by the Google Android team. Look at the following code: package com.jackcholt; import android.app.Activity; import android.os.Bundle; import android.util.Log; public class Main extends Activity { @Override publi...

Activity: from home screen launch or back from the stack

How can I determine if my main/launcher activity has been invoked from the home screen or by backing up the activity stack? I display a splash screen and would only like to show it when a user has arrived there from the home screen. ...

Android Bottombar with two buttons having different backgrounds and a common background for two buttons

Hi, I have a linear layout in my main.xml which has a listview. Now I want to create a bottom bar below listview. Bottombar has a background image and two buttons with their individual background images. I want to put these two buttons on common background image. I have read that this can be achieved using FrameLayout. But since I a...

Difficulty porting raw PCM output code from Java to Android AudioTrack API.

I'm attempting to port an application that plays chiptunes (NSF, SPC, etc) music files from Java SE to Android. The Android API seems to lack the javax multimedia classes that this application uses to output raw PCM audio. The closest analog I've found in the API is AudioTrack and so I've been wrestling with that. However, when I try to...

What's the best-practice way to update an Adapter's underlying data?

I'm running into an IllegalStateException updating an underlying List to an Adapter (might be an ArrayAdapter or an extension of BaseAdapter, I don't remember). I do not have or remember the text of the exception at the moment, but it says something to the effect of the List's content changing without the Adapter having been notified of ...

Strange options menu behavior in Android TabActivity

I have a TabActivity with four tabs (each is its own Activity). Each tab defines its own onCreateOptionsMenu (and in some cases, onPrepareOptionsMenu). When each tab is loaded, an AsyncTask is kicked off to retrieve the data needed to populate that tab's list. If I switch between tabs very quickly (while they're still loading) and then ...

How to send GPS data from android to a website?

Hi I'm new to Android and web service development! currently I'm working in developing Android program that will send longitude and latitude information to asp.net website (to show the location change the website map) the questions are - how to send this data to the website (the best practice)! - any suggestions for a suitable framewor...

How Android retrieves info of the Stacked Activities which are killed when memory goes low.

I was reading on how Activities communicate and how the calls stack up on top of each other. But at any instant when the OS(or dalvik) is low on resources, it can choose to kill Paused or Stopped Activities. In this scenario, how do we restore previous state of the activity(in which it was before getting killed) when we reach the same ac...

How to detect if an Android device has been touched\moved

Is it possible to know if the phone has been touched\moved (lifting it for example), using some Events? How would you code it? ...

Single intent to let user take picture OR pick image from gallery in Android

I'm developing an app for Android 2.1 upwards. I want to enable my users to select a profile picture within my app (I'm not using the contacts framework). The ideal solution would be to fire an intent that enables the user to select an image from the gallery, but if an appropriate image is not available then use the camera to take a p...