android-widget

Android 4x2 widget

Hi all, Looking at the Facebook widget I realized its a 4x2 cell and this isn't one of the standard sizes. I have tried to re-create a widget of this size (either as 320x200 or 294x146 px) however the widget doesn't look good on all devices. The widget layout is : <?xml version="1.0" encoding="utf-8"?> <!-- Portrait --> <RelativeLayo...

Android - Get value from HashMap

I have tried to search on HashMap in Android, but getting problem: Consider this example: HashMap<String, String> meMap=new HashMap<String, String>(); meMap.put("Color1","Red"); meMap.put("Color2","Blue"); meMap.put("Color3","Green"); meMap.put("Color4","White"); now i want to iterate it and get the value of eac...

Custom view object using up full height of screen even when layout_height is set to wrap_content

I created an object that extends android.view.View, overriding draw() and have it displaying on the screen. To put you in the picture, it is a display of digits to represent a game score. It's displaying correctly horizontally, however, it is taking up the full height of the screen - pushing all other elements off the screen. I've put l...

resize the bitmap canvas

Hello, I am trying to draw rectangle on top of image and I am having trouble placing the art on the image. Only part of Rectangle shows up somewhere in bottom of screen. Here is what I am doing: sinewave is the image from res>drawable folder public void onDraw(Canvas canvas) { Bitmap myBitmap = BitmapFactory.decodeResource(ge...

How to display QuickContact card from widget

I have a widget that displays the picture of some of my contacts and I would like to display the QuickContact card when the user taps on one of the pictures. I know I should be using the method ContactsContract.QuickContact.showQuickContact(), but it requires a View or a Rect as one of the input parameters. My problem is that Widgets onl...

Widget onUpdate, onReceive

I initialize some arrays in an onUpdate() method and after that, using an intent and a button, I try to call onReceive() function which runs fine but cannot access arrays set in onUpdate() method. Why is that? Those array's are object variables and are declared public. Am I missing something? package net.aerosoftware.widgettest; import...

Android TabHost

Hi All, I want to make an Tab Activity. which consists of 3 tabs. but when i create an project with Android 2.2 and API 8 then in Main.XML its showing an null pointer exception. but when i change it to API 4 or 5 den it is showing the layout of tabs. and one more thing i want to clarify is when we create an project we need to specify B...

Draw view on Image within xml

Hello all, can you help me by sharing your knowledge on how to draw a small rectangle on top of image in android. I have main.xml and there are some widgets. right at top, there is a image and I would like to draw a rectangle on that Image and display both while app is running. Here is how my xml file looks like: <?xml version="1...

Update android widget on condition

Hi, I'm just starting with android development and have written an application to show details about the battery status. Now I wanted to put the whole thing into an widget - and here's the question: Do I really need a update service in the background to listen for ACTION_BATTERY_CHANGED intents? My first thought was to put just a <ac...

Rotate View Hierarchy 90 degrees

Hello, I am working on a subclass of FrameLayout that is supposed to rotate all of its children by 90 degrees. I am doing this to overcome the landscape-only camera limitation present in android 2.1 and below, by having the activity be in landscape, but placing my camera overlay into this framelayout overlay to cause it to appear as if ...

Two children for ScrollView?

I am trying to create a very simple application (part of my learning program), vertically oriented, with an EditText at the top that receives a URL, and two buttons side by side just below that say "Get Image" or "Get Text" depending on the URL typed in (.html vs. .png, for example). The resulting elements may be later scavanged for use ...

Android Tabhost Problem - .setIndicator

Hello, First let me clarify that i have already referred the SO question related to "Android - TAbhost". I have done googling about "Android Tabhost" but failed to find the solution. My problem is: If are having <3 tabs then it is fine. but Supporse if we are having 4 tabs with indicator title as TabHost1, TabHost2, TabHost3, TabHos...

Animation Framework usage scenarios

Hi, I wonder if any experienced Android developers could tell me if the animation framework is suitable for animating properties of custom Views implementing the onDraw() method or custom objects that draw onto a Canvas. Thanks! ...

onListItemClick() not working for ListView in Android

The following will not register the Toast upon clicking. In fact, it doesn't even seem to detect a click. The parent class that CustomListTitle extends is ListActivity, so everything should be set, but it's not working. No errors, just no registering a click. package com.mtp; import android.app.Activity; import android.app.ListActivity...

I can't get my Button widget to do anything.

Hello. I'm new at this android stuff and trying to teach myself the language and I'm running into a brick wall here. I'm trying to program a really simple widge that is just a button. When the button is pressed the phone goes to silent mode. Unfortunately, the onlky thing that I am able to program the button do is pop a toast message. ...

Creating ListView which contains Layout

Hi, I want to create a ListView which contains a RelativeLayout which contains an ImageView and another Layout (Linear). Linear Layout Contains some TextView. How can I create this ListView?? Thanks Deepak ...

Appwidget : Is there any ways to check whether the Appwidget is currently being displayed on Home screen?

Is there any ways to check whether the Appwidget is currently being displayed on Home screen or not? The scenario is like this, I have 4-5 app widgets on my homescreen. My Home screen has three workspaces and my widgets are distributed over these workspaces. Now my intention is to get the appwidget that is currently being displayed i...

How to center a title in a TextView with 2 lines?

I know how to center the text in the TextView and how to center the TextView inside its parent layout, but what I'm looking for is how to center a title (text centered but second line starting at the same point). What I'm looking for is this: | Centered | | right! | or this: | Center | Not this (text centered): | ...

imeOptions "actionNext" programmatically - how to jump to next field?

In layout XML it is possible to specify android:imeOptions="actionNext" which adds Next button in virtual keyboard and by clicking on it - focus jumps to the next field. How to do this programmatically - e.g. based on some event trigger focus to go to the next field? ...

Disable collapsing of ExpandableListView

The default behavior of ExpandableListView is to collapse a group when its header is clicked. Is it possible to prevent this from happening? I've tried: Setting OnTouchListener on the list. This interferes with scrolling. Setting an OnGroupClickListener on the list (in onCreate()). This works for all clicks after the first. Has a...