Android :: Widget With Custom Bitmaps

Oct 1, 2010

I am writing a clock widget that uses customised bitmaps (so the widget loads the bitmap from the sdcard) Just have a couple of questions regarding how updates work:

1. if i want to display seconds on the clock widget will the widget load the bitmaps off the disk every second or can they be cached somehow so it doesn't reload off the disk each time. or If it does reload a bitmap each second, would this use a lot of power?

2. If i load the customised number bitmaps into a static array and then pass them as bitmaps to the widget would this use less power than just loading off the SD card?

Android :: widget with custom bitmaps


Android :: Drawn Bitmaps Are Not Scrolling In Custom View

Nov 9, 2010

I am creating a CustomView with bigger image based on tutorial on and developers forum. It is scolling fine.I need exact pixel coordinates of my image.I am getting that also.now I want to draw some images upon scrolling image.I am able to draw images using onDraw().But images are not getting scrolled.Any idea how to resolve this?

View 4 Replies View Related

Android :: Custom Xml Widget

Apr 14, 2010

I have an XML file in my layout folder that has how i want my custom widget/view (not sure what correct terminology is here).but how do i make it so that i can programatically, add one or more to an activity

View 2 Replies View Related

Android :: Custom View In Widget

Nov 19, 2010

Can I use a custom view like com.examples.me.customview in the xml file of a app widget and can then draw in the onDraw of the custom view? Or do I have to draw into the drawing cache of an ImageView instead?

View 12 Replies View Related

Android :: Using Custom View In Widget

Aug 2, 2010

i made a extended a View, overwrote the 3 View Contructors and tried to insert it on my xml of a widget.is it possible to use custom views in Widgets?

View 1 Replies View Related

Android :: Using Custom Widget From One Project In Another

Oct 28, 2010

I'm attempting to use a custom Android vertical scrollbar widget that seems to work fine in its own example project, but I am having trouble trying to include it into my project. I've exported a .jar from it to use in my project, but it seems to be a minefield of problems, from duplicate resources, to my XML layouts not able to get at styles inside the library, and errors "inflating class" when reading my XML layout file.How should I go about using the widget from another project in my own?Quite new to Java development (know the language, but not much of the overarching project/package management), so if there's some good text regarding that it would be appreciated.

View 2 Replies View Related

Android :: Widget Host App With Custom View

Mar 11, 2010

I'm writing an app that will host widgets. The app has custom view (which probably is the source of issue).mView.addWidget() basically just remembers this AppWidgetHostView instance and then mView draws it directly onto canvas. Visually everything is fine.I can see the actual widget. But the issue is with reacting on UI events. Please advise what needs to be done in the parent view in order to correctly trigger handlers in the widgets like onClick().I used standard widgets which normally react on click events. None worked.I also created my own test widget with listener and onClick()is successfully triggered if the widget is added on Homescreen, but doesn't work in my app.mView correctly detects click event and I tried to call widget.perform Click there, which returns false meaning onClickListener is not registered in the widget. But according to source .would call updateAppWidget which would register its onClick listener.

View 1 Replies View Related

Android :: Custom Widget Reference In View XML

Dec 3, 2009

instead of referring the custom widget by a fully qualified class name, is it possible to map with a shorter name. Like it happens in ant custom tasks (though properties file).

View 4 Replies View Related

Android :: How To Add Button Widget To Custom ImageView?

Apr 25, 2009

I am trying to add a button to a custom imageview. I have created a custom view to display an image to the screen, now i wanted to add a custom button on this veiw and display a layout in onClick. The following is my custom view.

View 3 Replies View Related

Android :: Post Custom Widget Source?

Nov 12, 2009

I created a multiline textview widget which handles ellipsizing - is it appropriate to post it here in this forum for feedback, or is there an android site dedicated for custom widgets in the community?

View 4 Replies View Related

Android :: Custom Widget Using LinearLayout Not Getting OnDraw

Aug 13, 2010

I can add children just fine, but I'm never getting my custom onDraw() being called. dispatchDraw() gets called, but that seems to have a different canvas (the one that's within the padding. I need to draw on the whole layout area). Is there some flag that needs to get set to get onDraw() called for the layout?

View 1 Replies View Related

Android :: Popping Up Custom Dialog From Widget

Feb 8, 2010

I am developing a desktop widget.I would like to pop up a custom dialog when a remote view is clicked (much like the Facebook widget on Android when the user clicks in the update status field).I know how to use pending intents to launch an activity and have that currently hooked up.

View 2 Replies View Related

Android :: How Can I Create Custom Composite Widget?

Feb 25, 2009

I have read the LabelView example in APIDemo which show how to create a custom widget.However, what if I want to create a custom widget which is a composite of existing android widget?I know my custom widget need to be inherited from view, but if i do that, I can't do 'setContentView()' in my custom widget class (since that is an Activity method).so how can I apply the above xml to my custom widget class?

View 4 Replies View Related

Android :: How To Create Custom Button Widget

Jun 17, 2009

I would like to create a button with circular or rectangular background, text and an image below or above the text.I would like to create a CustomButton object with methods setText() and setImage() which would change the button text and image and place multiple CustomButtons into main layout.Does anyone know how to create a custom layout, place it into another layout(main) and modify its elements from the activity which is bound to main layout?

View 2 Replies View Related

Android :: Custom Widget Styles / How To Put Into Namespace?

Sep 21, 2009

In the ApiDemos, there is a view example called Gallery1 which declares a custom style in attrs.xml.I want to do the same thing for my widgets, but using a different namespace. However, as soon as I replace the android: namespace with something else,Unable to find attribute? Why does it look for an attribute I am about to declare? Isn't the point of this file to be able to name your own custom attributes?It's interesting to note that it works if you do not supply a custom namespace, but just an attribute name.

View 2 Replies View Related

Android :: Custom Widget Doesn't Update

May 11, 2010

I'm trying to make a widget to my app, but it doesnt update.I just need to change the textview text and open an activity when a press a button, but none of them works

View 1 Replies View Related

Android :: How Do I Define Attribute For Custom Widget?

May 11, 2010

you can see where he's defined a custom widget called ColorMixer.ColorMixer has an attribute named "initialColor" declared in attrs.xml.but getIdentifier never returns anything but zero.Is there something more I should be doing? I want to re-write this code to be completely independent of 'R'

View 1 Replies View Related

Android :: Unable To See Bitmaps At 0 0 Of Canvas

Jul 6, 2010

I have following example code:

Character c = CharacterFactory.getCharacter(CharacterEnum.SpecialCharacter); //factory has applicationContext reference to get bitmaps from R. ... Paint bitmapPaint = new Paint(); ... View::onDraw(Canvas canvas) ... canvas.drawBitmap(c.bitmap(), 0, 0, bitmapPaint);

For some reason (must be something simple) I do not see the bitmaps at the 0,0 of the canvas. Inspecting the bitmap and etc does not show anything obvious (nulls), I must have missed something. Is there something I should be paying particular attention to while drawing bitmaps?

View 5 Replies View Related

Android :: Compare Bitmaps In Canvas

Aug 18, 2010

I am using the above code for displaying bitmap.and i also move that bitmap.Now my qusetion is how i am compare bitmap with another bitmap. Please give me some suggestions.

View 2 Replies View Related

Android :: Load Bitmaps Into ImageViews

Oct 15, 2010

I want to load bitmaps into ImageViews in Android, but I don't want to use the R.drawable syntax because I have a lot of images with a standard naming convention so it's much easier to get the image with some logic. For example, all my images are named:

img1.png
img2.png
img3.png

So if a user selects a value, let's say x, I show "img" + x + ".png" in the ImageView. Looks like Bitmap.decodeFile is what I need, but I need to know the syntax of how to get to my drawables folder since that's where the images are. Or if there's perhaps a better way.

I realize I could do this with a switch statement instead of concatenating the image name but that would be a lot of lines since I have so many images.

View 3 Replies View Related

Android : Get Bitmaps Blurred Using Droid?

Sep 9, 2010

I am struggling to get Bitmaps blurred using Android.

I have seen a lot of information about using a simple kernel like

0 0 0 5 0 0 0
0 5 18 32 18 5 0
0 18 64 100 64 18 0
5 32 100 100 100 32 5
0 18 64 100 64 18 0
0 5 18 32 18 5 0
0 0 0 5 0 0 0


My problem is that I am really not sure how to multiply this with my Bitmap in an efficient way. Should I go through every pixel and image.getPixel(x, y)

while storing those values to a new array (so I don't have to get those values over and over again) and then go through the array and for each value add up the surrounding values multiplied by the corresponding field in the kernel divided by 1068 (in the case of the above kernel (= all entries summed up))?

Is there any better way to do this? Is there a simple solution for the borders?

Or is there even something available in the Android SDK I missed?

View 2 Replies View Related

Android :: Widget For Slide From Top Of Screen Without Custom Code?

Jun 11, 2009

I love the SlidingDrawer widget, but would love to be able to have it slide down from the top of the screen (like the notification bar) vs. just the bottom. Is this possible, or am I looking at copying the code to create a custom implementation

View 2 Replies View Related

Android :: Custom Widget - Attributes In The Layout Xml Files

Aug 6, 2010

I have defined custom views in the various layout .xml files. However, all the layouts are using the Linear Layout - put the content would vary.

I would like to create my own widget tag something like <com.mypackage.MyLinearLayout />, I would like to pass the layout as a param to the <com.mypackage.MyLinearLayout layout="@layout/simple.xml" />

How to define new attributes to the custom widgets ? Simply defining a getter/setter method would work or is there any other references.

View 2 Replies View Related

Android :: Drawing Focus Highlight In Custom Widget

Jul 6, 2009

I have made a custom widget, very similar to JTable in Swing. It is not editable, and all data is replaced at once, allowing easy checking for the widest item in each column & custom col sizing at replace time. It is a subclass of LinearLayout, filled with re-usable TableRow Objects, sub-classed directly from View.

TableRow is both Clickable, focusable, & focusable In Touch Mode. TableRow overrides onDraw(Canvas), calling super. It draws the first column in Black with Lt gray underneath. If the TableRow isFocused () , then a filled rectangle is drawn, before the rest of the cols (left or right justified based on data type), and borders. Where do I get the color, orange, to draw the filled rectangle indicating focus? android.R.drawable.list_selector_background seems to be a pointer, value 17301602, not an actual color. Placing any real Color in my code draws things fine. Is this 17301602 transparent or something? Am I doing this wrong, or do I just need to know how to fine the orange?

View 2 Replies View Related

Android :: Custom Border Frame For Gallery Widget

Nov 1, 2010

Is there a way to define/customize a border around the currently selected Gallery item? I know, i can create a Drawable and draw four lines into that but there must be a simpler way.

View 1 Replies View Related

Android :: Custom Clock Widget Service Work-around?

Dec 21, 2009

I was interested in developing a clock widget for the homescreen and upon reading Home Screen Widgets tutorial, I wondered if there is a pre-existing Service I could reference for updating the current time rather than re-inventing the wheel?I download the Retro Clock application on my android phone and noticed that when I click it, it pops up the Alarm Clock settings, but with the default Google Analog Clock widget, upon click does nothing.Is that because the Retro Clock widget implements the Alarm Clock service? If so, how can I go about referencing that service? Or do I have this all wrong and misunderstood?

View 4 Replies View Related

Android :: Downloading Images And Converting To Bitmaps

Jun 16, 2010

I am working on an application that downloads images from a url. The problem is that only some images are being correctly downloaded and others are not. First off, here is the problem code:

public Bitmap downloadImage(String url) {
HttpClient client = new DefaultHttpClient();
HttpResponse response = null;
try {.......................................

So what I have is a method that takes the url as a string argument and then downloads the image, converts the HttpResponse stream to a bitmap by means of the BitmapFactory.decodeStream method, and returns it. The problem is that when I am on a slow network connection (almost always 3G rather than Wi-Fi) some images are converted to null--not all of them, only some of them. Using a Wi-Fi connection works perfectly; all the images are downloaded and converted properly. Does anyone know why this is happening? Or better, how can I fix this? How would I even go about testing to determine the problem?

View 2 Replies View Related

Android :: Track Memory Consumption (Bitmaps)?

Mar 26, 2009

How can one track memory consumption in Android? The Android "Heap" view in Eclipse and java.lang.Runtime methods seem failing for my purpose. I tried to figure out how much memory my app consumes in order to make decisions for future directions. Most of the memory goes into Bitmap objects. Just to test memory consumption I created huge bitmaps in a Loop and logged the java.lang.Runtime memory values: created bitmap (610k free, 2371k total, 16384k max) created bitmap (615k free, 2371k total, 16384k max) created bitmap (615k free, 2371k total, 16384k max) created bitmap (615k free, 2371k total, 16384k max)

Nothing seems to hapen, but on the fifth Bitmap: java.lang.OutOfMemoryError: bitmap size exceeds VM budget at android.graphics.Bitmap.nativeCreate(Native Method) at android.graphics.Bitmap.createBitmap(Bitmap.java:343) at de.greenrobot.colorball.GameView.init(GameView.java:86)

This seems confusing at first. Is java.lang.Runtime the right place to check application memory stats in Android at all? Are Bitmaps allocated outside the app's heap? How can I track it?

View 4 Replies View Related

Android :: Allocating Bitmaps And Out Of Memory Error

Jun 16, 2010

I'm running into OutOfMemoryErrors when allocating bitmaps. This is not something I can reproduce with emulators, and has been reported by a few beta testers with the HTC Incredible. I'm not sure I can solve this directly, and my best hope is to follow best practices for bitmaps and memory thereof. But looking for those best practices based on groups archives left me with more questions than answers. If anyone has a chapter about this in their book, I will buy the book. Here are the things I've mulled over so far:

1. I have a bitmap for a drawing buffer. It is about 3-4 megabytes on some devices. This is the biggest bitmap I have, and without it, I wouldn't be able to much of anything useful in my app. I am assuming that it would not be useful to use inPurgeable if this is a bitmap that is drawn into. Is this true?

2. Next biggest in the hierarchy are some bitmaps that are about 22K bytes and 256K unpacked. Since I believe about 25 of these might be used at one time, I have a cache with a size of 25. I am careful to use BitmapFactory.Options.InPurgeable, so I believe that could make them take only 22K each, but I don't see that as guaranteed. Maybe they are taking 256K each, which would put me in the danger zone. As they are cycled out of the cache, I call bitmap.recycle(). I think this a good practice. Is it?

3. Next are some resources with icon size 32x32 pixels. There are about 50 that could be used or reused. If I use code like this:

Drawable s = mCtx.getResources().getDrawable(R.drawable.symbol_icon);
Where s is a local variable to rendering. Suppose I call this 37 times. Am I to assume that Android will do something smart like create only one bitmap for this resource even if it is used 37 times? Or am I to assume that Android will do something stupid like create 37 bitmaps and keep references in an obscure location that will prevent garbage collection? Do I need to get more access to these bitmaps and do something smart myself?

4. Finally are some other icons used for menus and ImageButtons. Most are declared in layout files - so I don't touch the bitmaps directly.

I'd like to make my memory usage more efficient, but don't want to spend time on things that will amount to shuffling chairs on the Titanic. And how do I best measure this usage? Interestingly enough, I've tried using the Allocation Tracker and it says I haven't allocated a single bitmap. In light of the above, I don't think that's right.

View 11 Replies View Related

Android :: OutOfMemory With 9M Free Heap Because Of Bitmaps!

Mar 3, 2010

Our app has some memory peaks, which let the heap grow to 13M. After the peak, there's 9M of free heap. Everything's fine until Bitmap objects come into play. Despite having 9M of free heap creating Bitmaps, which have only some 100k, now fail with a OutOfMemoryException!

My theory: Allocation fails if (Java) heap *size* plus external allocations (e.g. Bitmaps) exceed 16M, no matter that there is lots of free memory in the heap. The VM could shrink the heap, but actually does not. Would be quite a flaw in the VM.

Does anyone share this theory?

On the downside of this theory: I do not see anything appropriate (killing the process is probably not) an app developer could do to prevent those OutOfMemoryExceptions given that those memory peaks are legitimate and unavoidable.

View 18 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved