android

Adding a child view at particular location in parent view.

I need to draw a child view containing a rectangle and button on top of the content view at particular location on the parent (content view). How can I do this? Did not find an explicit way to set origin of child view? Thanks. ...

Screen orientation landscape back to portrait not working

Hello, I've racked my brain for hours over this issue. I have created a main.xml and designed one for the res/layout-land (landscape) format and another one for portrait in res/layout. When I rotate the emulator (ctrl-F11), my app rotates properly to landscape using the correct main.xml, but a subsequent rotation back to portrait just...

Android's RelativeLayout Unit Test setup

i'm trying to write an unit test for my Android's RelativeLayout. Currently, my testcode setup is as follow: public class SampleRelativeLayoutTest extends AndroidTestCase { private ViewGroup testView; private ImageView icon; private TextView title; @Override protected void setUp() throws Exception { super.setUp(); // inflat...

How do I define and standardize units in my 3D app?

I'm starting to design my object graph for an OpenGL ES 1.1 app on Android. What's advisable when it comes to actually drawing my triangles and controlling their size? Should I store all the vertices in units relative to each other and then multiply them by a value I pass during a draw(GL10 gl)? Would this approach have any impact whe...

What's this error messages mean?

03-20 11:41:28.103: ERROR/vold(550): Error opening switch name path '/sys/class/switch/test2' (No such file or directory) 03-20 11:41:28.103: ERROR/vold(550): Error bootstrapping switch '/sys/class/switch/test2' (m) 03-20 11:41:28.103: ERROR/vold(550): Error opening switch name path '/sys/class/switch/test' (No such file or directory) ...

How to get contacts in order of their upcoming birthdays?

I have code to read contact details and to read birthdays. But how do I get a list of contacts in order of their upcoming birthday? For a single contact identified by id, I get details and birthday like this: Cursor c = null; try { Uri uri = ContentUris.withAppendedId( ContactsContract.Contacts.CONTENT_URI, id); c = ctx.ge...

Custom view in ListView disappears while scrolling in Android

Hi. I wrote a simple custom view for rows in ListView. It works fine, but when I try to scroll the list, I see only white rows without content. And when scrolling is over, rows continue to show again. This is how I draw a custom view: @Override protected void onDraw(Canvas canvas) { if(poster != null) { canvas...

How to change current Theme at runtime in Android

I've created a PreferenceActivity that allows the user to choose the theme he wants to apply to the entire application. When the users selects a theme, this code is executed: if (...) { getApplication().setTheme(R.style.BlackTheme); } else { getApplication().setTheme(R.style.LightTheme); } But, despite I've checked with the d...

how to implement chating applicaiton in android

i am developing one chat form in my apps displying the chats i was taken linear laout but i need to refresh that chat msg every 5 seconds for that i am using timer.while dynamically adding it is showing getting values from db and add to layout but in gui i am not able to get those messages for that what i have to do. is there any way for...

Is it possible to set an android icon from a drawable in a separate jar?

I want to set a menu option icon for a drawable that is in another jar inside an xml file. <item android:id="@+id/my_location" android:title="My Location" android:icon="@+drawable/my_location"> Instead of drawable/my_location have something like com.somelib.R.drawable.someDrawable. I can set this in onCreateOptionsMenu bu...

Pause and resume thread drawing to SurfaceView

I am developing a chess game for Android (http://androidchess.appspot.com), using SurfaceView for the chessboard. I have a drawing Thread, that draws the chessboard in a loop. The problem is that when there are no active animations (this is more that 90% of time), it makes no sense to waste CPU and battery for drawing. How should I solve...

Timer appears to be pausing when screen becomes inactive

So I have a very simple android activity that starts a timer when you hit a button. Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { doStuff(); } }, 15 * 60 * 1000); So this worked reasonably well for me when I was testing but as it turns out when the screen becomes inactive ...

Custom Android build how-to?

I want to make a custom build of Android for a custom application. Is there a guide somewhere? Anybody have any tips? ...

Portability among mobile platforms

Do any libraries or other development resources exist that can help reduce the effort involved in porting applications between various mobile platforms? In particular, I am interested in supporting iPhone, Android, and Windows Mobile. Some areas of concern include UI, client-server communication, and hardware support (e.g., camera, GPS...

R.id cannot be resolved

So I copied this tutorial example thing right from Google's android site and I ma getting an error that R.id cannot be resolved. Here is my Java file package com.TestApp.HelloWebView; import android.app.Activity; import android.os.Bundle; import android.webkit.WebView; public class HelloWebView extends Activity { WebView mWebVie...

Android: manifest targetSdkVersion change resulted in: icon not visible, widget no longer works, and cannot access data

I recently upgraded my Android app to support multiple resolutions. Previously, my Android.manifest file had a line: To support multiple density and resolution devices, I changed this to: <supports-screens android:smallScreens="false" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" /> <uses-sdk...

Android sound starter project for Eclipse

Is there an example Hello Sound project for Android that will show how to create beep sounds of a variable tone and duration? ...

How can I avoid garbage collection delays in Java games? (Best Practices)

I'm performance tuning interactive games in Java for the Android platform. Once in a while there is a hiccup in drawing and interaction for garbage collection. Usually it's less than one tenth of a second, but sometimes it can be as large as 200ms on very slow devices. I am using the ddms profiler (part of the Android SDK) to search o...

Does anyone know how to create a message bubble with 2 buttons appears on top of an overlayitem for map application using android 2.1?

I currently have implemented an overlayitem that shows an icon for geopoint on a map application in Android. When the icon is clicked, it brings up an AlertDialog from the onTap method below. I have the following questions: Does anyone know how to display a map message bubble directly above the icon overlayitem with 2 callout buttons o...

Can't bind to Service

Hi I have an aidl file defined as follows: package com.erbedo.callalert; interface RemoteCallAlert { void notifyCallEnded(); } The service is: package com.erbedo.callalert; public class CallAlert extends Service { Filter callListener; private final RemoteCallAlert.Stub mBinder = new RemoteCallAlert.Stub() { ...