android-widget

Android: How to create a custom camera preview widget?

Hi, I am trying to develop a custom widget for camera preview. I would like to fill the screen with camera preview and draw some buttons over it. I have tried to create a custom widget the following way: import java.io.IOException; import android.content.Context; import android.hardware.Camera; import android.view.SurfaceHolder; impo...

Checkbox Tree

Does anyone know if/how to get a checkbox tree widget in Android? ...

Is there a working sample for the Android 1.5 VideoView/MediaPlayer class?

Hi folks, I'm new to Android dev. There's a very pretty state diagram of the MediaPlayer, but I can't for the life of me figure out how to actually use this class to play a video. There's a view samples around the 'net, but they seem to be for previous versions of the SDK. I've also checked the official samples, but with no luck. ...

How to make an Android SlidingDrawer slide out from the left?

I'm using a slidingDrawer in my application that has its handler placed at the bottom when in portrait mode. When the user switches to landscape mode (widescreen) I would like to have the handler located on the left. When I change the orientation from vertical to horizontal, the handler is placed on the right. I have defined my layout ...

How to overlay an icon image on top of an exisiting view

Hi, If I have a reference to a view, how can I overlay an icon image on top of an exisiting view? In the screenshot below: http://android.kanokgems.com/sms-unread-count It overlay an icon at the top right corner of the dialer icon. How can I do that? Thank you. ...

android onclickuplistener for an imageview button?

Hey all. I'm trying to use an imageview as a button, and I want to be able to change the image whenever the button's pressed. I have an OnClickListener set, but what do I have to do about when the user's finger is no longer down, over the button? How do I revert to the original image? ...

Problem in horizontal scroll in android

hello... i am using a table layout in a screen. i need to have both horizontal and vertical scrolls. By default i am able to get vertical scroll in the view but horizontal scroll is not working. i am using android SDK 1.5 r3 i hv already tried android:scrollbars = "horizontal". i hv read on some forums that in cupcake update horizonta...

Use external fonts in android

hello.. i want to use external fonts in my app. i have tried adding new fonts using asset managers but it did not work. Typeface face; face = Typeface.createFromAsset(getAssets(), "font.otf"); textview.setTypeface(face); but it did not show the text... plz help.. ...

Getting Android SDK WebView and TabWidget to play nice

I’m taking the HelloTabWidget Android example and trying two things: Moving the tabs to the bottom vs. the top (if that’s even desirable from an Android UI POV) Making each tab show a particular WebView in the space above I’ve got this for a layout (high level): <TabHost> <LinearLayout> <FrameLayout> <WebView/> <W...

Creating Custom ImageView

I create a custom image view by extending ImageView that just draws some text on the screen, however I don't see anything painted in the Emulator Screen, but the log messages and the printlns get printed in the log console. Am I not doing something? This is my activity public class HelloAndroidActivity extends Activity { /** Called...

set transparent background of an imageview in android

hello... i am using a web view in which i am adding a image view..now i want to set the background of this image view transparent.i hv tried setting mImageview.setBackgroundResource(R.color.trans); [where trans => < color name="trans">#00000000 < / color >] plz help.... thanks in advance... ...

Aborting ViewGroup if a condition is not met ?

My custom ViewGroup expects a certain number of strings for an array specified in arrays.xml. I want the app to stop if that condition is not met. What is the best practice for this? Should I just throw an IllegalStateException from the ViewGroup constructor ? public MyViewGroup( Context context, AttributeSet attrs ) { super( contex...

Android - Tabs, MapView, activities within tabs

Hi folks, We're in the process of writing an app that has 4 tabs: Map, People, Places, Events. The People, Places, and Events in the App show up as Icons on the map. By default the People, Places, and Events tabs each show a listview, custom rendered, displaying all the People, Places, and Events respectively. Now, right now each o...

How to get width and height of a Webview in android

Hello.... I want to determine the width and the height of the webview .i have already tried using webView.getWidth(); webView.getHeight(); but the log always show them 0. any help will be appreciated.. thanks.... ...

Can't get ellipsis to work on Android

Hi, I have a TextView. I want it to ellipsize if longer than its available width. This does not work unless the input string has no spaces... can anyone provide an example of this working? I've tried different combinations of: singleLine="true" maxLines="1" scrollHorizontally="false" none of these have any effect. Again, if I supply...

Get soft keypad to stop modifying my LinearLayout on display?

Hi, In my android application, I have an EditText. When I click in this field, the soft keyboard appears, expanding from the bottom of the screen. It seems to actually modify my layout, pushing contents upwards. When I dismiss the keypad, it retracts, and I see my layout re-expand to take up the space it previously occupied. Is there a...

Highlight layout after delay?

Hi, I've created my own compound widget, something just like this: <LinearLayout> <TextView /> <Button /> </LinearLayout> I'm putting 15 of these in a ScrollView. I want it to behave similar to a ListView (I cannot use a ListView directly for this task). I need the each widget to highlight when pressed. I've gotten this to work,...

How to make a nice looking ListView filter on Android

I want a nice looking filter for my ListView in Android. How can I do this? ...

Problem while implement location listener in android appwidget

Hi, I am working on a Widget which will get the Current GPS location and pass this value to remote PHP page to get the Information and display it in the Widget. This is what I am trying to do. I am facing problem while implementing Location Listener for appWidget. It is not updating with the Current Location and It is showing the initi...

Android: How to fire onListItemClick in Listactivity with buttons in list?

I have a simple ListActivity that uses a custom ListAdapter to generate the views in the list. Normally the ListAdapter would just fill the views with TextViews, but now I want to put a button there as well. It is my understanding and experience however that putting a focusable view in the list item prevents the firing of onListItemCli...