android

Android: How to check if a DB field is blank and, if so, add a value like "Unnamed Record"??

I am working off the Android Notepad Tutorial as a base. The problem is that when someone creates a record with a null name field, it shows up as a blank space in the listview and is unclickable, and therefore undeletable from the list. I would like to have the program check for a null "name" field and replace it with the string "Unnam...

Opposite of View.bringToFront() in Android

Hi, I was wondering if there is some opposite method of View.bringToFront()? When i call bringToFront() my whole screen get locked cause i have some problem with overriding the onMeasure() method(when i implement onMeasure, my custom View doesn't draw itself even it enters onDraw method) and my cutom View takes up the whole screen.... ...

Android: How to manually add a file to apk?

How do I manually add a file to an Android APK package? ...

What could cause the Android phone freeze?

I wrote an application used AlarmManager to set repeated alarm in every 24 hours. I also used SQLiteDatabase to store and retrieve data. I close the Cursor and database connection after I used them. Could you please help me to find out what could cause the phone freeze? ...

Android Is there way to know when i am releasing my finger from a gallery widget?

I want to call a function the moment i realease my finger from a Gallery.Is there a way to accomplish that? ...

How to use MediaController.MediaPlayerControl ?

I am trying to use MediaController.MediaPlayerControl in order to display a MediaController at the bottom of my Custom View but I can't get it to work. It's crashing at the ctrl.show(); with the following Exception whenever I try to load this view: E/AndroidRuntime( 3007): Caused by: android.view.WindowManager$BadTokenException: Unable ...

Drawable object where I can store points for faster paint?

I'm designing a custom view which is an X/Y Plot. It's a moving graph that scrolls to the left with time and new Y values are continuously coming in at 10 per second. I've been able to make it work with an array of integers where the array index is the X value and the integer value is the Y value, but this seems horribly inefficient (B...

How to setup a main menu layout in Android?

For the app that I'm making, I plan on having a main menu composed of 6 different icons, with 2 per line. This is very similar to the Twitter main menu layout seen here: So basically... how should I go about setting up the XML? LinearLayout, TableLayout? And then, what do I actually do to get the icons and text to be evenly spaced and ...

TextView inside LinearLayout stretches the LinearLayout and fill_parent fix causes weight flip

If I have 2 LinearLayouts split %50/%50 everything is fine. Weights are 1 and 1. As soon as I add a TextView inside the top LinearLayout, it stretches that layout. I use "wrap_content" as the documentation says I should when it comes to weights. As you can see the red and green should be split evenly and text on grey background should...

android how can imageview link to web page

is it possible to make an imageview link to a web page such that when user taps on the image, it takes them to a web page? ...

no such column: _id SQLite error Android.

I'm getting a no such column: _id error. YES there is a column "_id" in my journals table. I'm getting the error with this code: mDb.execSQL("UPDATE "+DATABASE_PLANTS_TABLE+" SET "+ KEY_PLANT_DAYS+ " = (SELECT COUNT(*) FROM "+DATABASE_PLANTS_TABLE+" WHERE " +DATABASE_JOURNAL_TABLE+"."+KEY_JROWID+" = "+DATA...

How to create simple paint program with zoom

Hello, I'm new to Android and Java programming and I've manage to create a simple paint program, but how do I add a zoom feature? Right now I'm just extending the View class and using the "onDraw()" method. Do I have to use a Drawable to be able to add zooming functionality? I'm not really understanding the differences between the two. ...

How to correctly set MediaPlayer audio stream type

Hi all, I'm trying to create a way to adjust volume settings for each of the different streams (media, notification, ringtone, etc) and have a way to preview the output sound level of each stream. I believe I have the correct implementation, but when I set the output stream type, there is no sound that plays. Here is the code that corr...

Android apk problem

Hi , When i create one apk from one machine and try to install into a device .it successfully get installed .But when i try to connect the same device to another machine and try to deploy same application from different machine.It doesnt allow me .I need to uninstall the application and then it works correctly .What is the issue ...

Android - Application (apk) Maximum size

Hello, I am going to install first application in my android phone, but having some doubts related to Android Memory (Maximum size of APK). So pls help me know and solve the problems: What is maximum size of the apk that can be supported by the android ? When we install any apk file in real phone, where does application installed (in...

How to access preferences in a static method

So I have a broadcast receiver that needs to notify a service that it has received a text message. The only way to do this (as far as I know) is a static method. But the method that is notified need access to the application's preferences. Every method I have tried says that it cannot be accessed from a static method. So how do I access...

android splash screen/ loading screen.

I have a splash screen/loading screen that has .setVisibility() to GONE right after the draw call of my large bitmap is completed. The problem is the splash screen takes a bit to popup which i believe is due to the main activity booting up and doing CPU intensive applications on first run. Is there a way to get my splash screen displayed...

Best Practice when Caching files in Android

Hello all, I currently have my app caching image files in the cache sub-directory for the application. The images are used in a ListView and stored in a HashMap of SoftReferences to Bitmaps. So my question is this, what is the best way to cache these image files without inflating the space my application uses AND remains responsive fro...

one handler running in this time click the gallery handler will stop next 3 sec will run handler how can implemented

hi i am gallery application i am using handler in rotating gallery images protec ted void onStart() { super.onStart(); isUpdateUI = true; mRedrawHandler.handleMessage(new Message()); } @Override protected void onPause() { super.onPause(); isUpdateUI = false; } cl...

Wants to play mp4 video from assets folder in android.

Hi to all, I want to play mp4 video which is available in my assets/raw folder. I am successfully playing mp4 video from my sd card but not able to get video from assets folder or from raw folder. ...