android

Unable to use shared preference within class extends View

I am getting an error , when I try to access the shared preference from within class that extends View. The Error : "The method getSharedPreferences(String, int) is undefined for the type ViewforRed" , where ViewforRed is my class: Here is the sample code public class ViewforRed extends View { public final String PREFS_NAME...

NotFoundException and FileNotFoundException when running app on Android 1.5

I'm trying to backport an android 1.6+ application to android 1.5. Following the advice here... http://comments.gmane.org/gmane.comp.handhelds.android.devel/97051 http://groups.google.com/group/android-developers/browse_thread/thread/ff22f6e42a4a46d2/4201a20aaa23069d http://stackoverflow.com/questions/2923823/android-2-2-sdk-breaks-co...

Don't understand the constructor of my View

Hello! My code is working and so, but I don't understand one thing. I've started game programming and now works my whole SurfaceView and so on. I have draw a background so it all works. When I created this I followed a tutorial, so know I'm commenting on my own language. :) When I now started to comment some things; I can't get rid of t...

getCurrentPosition() equivalent for Audio recorder

In android media player has getCurrentPosition() which tell me how long that media has been played (in second). But why there is no equivalent for media recorder? How can I find out how long has elapsed when recoding an audio? ...

Stagefright media delay in 2.2 after setting data source?

My first post here. This website has been very useful for learning Android programming, thanks to everyone. I have a simple app that loads an MP3 stream and plays it. It works fine on 1.6 and 2.1 but on 2.2 it doesn't quite work right. It seems my service is having a problem starting, it's giving my an ANR and the dialog where I have to...

Custom titlebar background

Hi, I've created a custom titlebar for an Activity of my Android application. However, the background is blue. I would like it to be the gray gradient that toolbars generally are. How can I achieve this? Here is the XML of my toolbar. It places a checkbox on the left side and some text in the center. <?xml version="1.0" encoding="...

setSelectedChild not working for ExpandableListView

I have an ExpandableListActivity (for an RSS feed reader) which populates itself when the activity is created, that works fine. The groups are the item titles, and the children are a webview that contains the description. I also pass a parameter to it in the hope that I can automatically expand on of the groups to display the RSS descri...

How to bind to running android service?

I'm hoping this is more of an issue with code than anything else and I'm hoping that someone out there can help track down the issue. I have other code that starts the service with startService() and I can verify that the service is started as the debugger hits the onCreate() function of DecoderService. However, the bindService never b...

Why won't R update for a linked XML file?

I have two XML files located in res/xml/. One file is a normal XML file located in that directory called myfile.xml and I can access it normally as R.xml.myfile. Eclipse allows you to link files in from other locations. I have another XML file that is linked in from another drive. No matter what I do, i can not access this file by R.xml...

Multiple Layouts - Works in Emulator, Not on Device

I created two layouts - one for portrait, one for landscape. All else is the same. There are two layout folders in the project the second one (for landscape) was created using the layout-view in Eclipse and using the 'create' button for the layout after I designed it. One folder (the default, created for the project) is: res/layout. ...

How to skip an activity? android

i have a default activity that starts first (Activity A), and from there the user can go to another activity (Activity B). In B after some work the user sets a sharedpreference. the next time the app starts i want to check in A if sharedpreference is null to go to B. and i put this if just under public void onCreate(Bundle savedInstan...

Return to last Activity

In most Android apps, when you press the Home button to "minimize" the application and then open the application again, you will be taken to the screen you were last on in that Application. I've read the following: When launched via icon on the home screen, Android will always start the activity with the android.intent.action....

On changing imageview src based on sqlite string field

I've seen this question asked before but it seems that the answer may be outdated. I'm pulling a numeric value off of a spinner and storing it in a sqlite database as a string. I have an imageview placed into the row xml file. I'm sure creating some sort of adapter is involved. How do i change the imageview source based on the value o...

Android animation tween. Rotating star.

Hello everyone, I spent so much time looking into Android animation tween that I wanted to share this knowledge (and maybe others can provide feedback and improvements). I wanted to draw an animation for Android where the following sequence of animation would happen. Star would move to the center from outside of the screen. The star...

Android Maven build, with dependencies on library R fails

I am retro-fitting a Maven project around a set of Android projects (written using Eclipse). Some of the Android projects are libraries of common code and resources. Since the Android library projects have resources, they have their own R, which I reference from within the common library code. Following the instructions in the Maven: Com...

Why is my android alarm manager firing instantly?

I am following sample code for sending an update notification every 10'seconds. The code follows and it is in an "UpdateService" for an AppWidgetProvider. If I put a Thread.sleep(10*1000); I can see the expected behavior of my servicing loop. I obviously have something fundamentally wrong that is triggering immediately. It is suppose...

SQLite query throwing exception in Android

Im trying to get an object form my SQLite database in my Android application. I know that the contact is in the database because when I add it and try finding by ID, it returns the object. When I try finding by first and last name, though, it throws an exception and Im left with a null reference. Here is the query: cursor = mDb.query(D...

How Create a View Like the Default Android EditContact View?

Specifically, I'm curious about how they did the phone number entry part, where they can add additional phone numbers fields when the user clicks the little add button. I initially thought that was done with a ListView, and I got a ListView to work, but the ListView scrolls independently of the rest of the screen, which looks bad. So I...

What's the best source of Android FOSS?

Before I start to reinvent the axle ... what's the best source of Android FOSS? Is it the Android marketplace? There appear to be some projects on SourceForge ... anywhere else? ...

play video from stream on a android MID

Hi,all I want to play streaming-video on a android device(MID),but I can not see and hear anything,Although the data seem have stream into this device. I really do not have any idea what's wrong about my code,for it work normally on other device like HTC hero or xt800 and so on... Following is the log from logcat any suggestion will ...