HTC Hero Stocks Widget Scrolling Ticker functionality

by Jared » Thu, 26 Nov 2009 01:03:41 GMT


Sponsored Links
 I have an HTC Hero from Sprint in the US and was curious about the how
the Stocks HTC widget scrolls text like a ticker. It is only the 4x1
sized widget that scrolls quotes. As far as I know, homescreen widgets
can only use RemoteViews for the layout, which is limited to the
following layouts and widgets (from
 http://developer.android.com/guide/topics/appwidgets/index.html #CreatingLayout):

    * AbsoluteLayout
    * FrameLayout
    * LinearLayout
    * RelativeLayout
    * AnalogClock
    * Button
    * Chronometer
    * ImageButton
    * ImageView
    * ProgressBar
    * TextView
      Descendants of these classes are not supported.

I know that this could be done in an app with android.widget.scroller,
but that can't be used in a homescreen widget. Would this
functionality be specific to the Sense UI homescreen capabilities? I
guess, my main question is if this can be replicated for a standard
Android widget and if so how.

--



HTC Hero Stocks Widget Scrolling Ticker functionality

by Mark Murphy » Thu, 26 Nov 2009 01:14:56 GMT


 


Look at the android:marquee attribute on TextView, and see if that fits
your needs.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Warescription: Three Android Books, Plus Updates, $35/Year

--


Sponsored Links


HTC Hero Stocks Widget Scrolling Ticker functionality

by Jared » Thu, 03 Dec 2009 05:53:02 GMT


 I have this already in my xml layout:

<TextView
        android:id="@+id/left_text_box_0"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:focusable="true"
        android:singleLine="true"
        android:ellipsize="marquee"
        android:marqueeRepeatLimit="marquee_forever"
/>

This marquee works if I scroll up with the trackball on my widget to
focus on the text. The only thing that I need to do now is find out
how to set the focus programatically in the code. For an Activity or
View, this can be done by using TextView.setSelected(true). For a
RemoteView though, you can't use findViewById to get the TextView
layout reference (For example: R.id.left_text_box0). Do you know a way
to do this for a RemoteView?

Here is another post describing the same thing I'm looking for:



HTC Hero Stocks Widget Scrolling Ticker functionality

by prashanth » Fri, 04 Dec 2009 01:12:08 GMT


  took ages for me to find a solution for this though it was hidden
somewhere in internet..
anyways the solution is to add the tag <requestFocus/> in your
textview:)

Eg:

<TextView
android:id="@+id/left_text_box_0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="true"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever">
<requestFocus/>
</TextView>


On Dec 2, 9:52pm, Jared <jaredstock...@gmail.com> wrote:

--



Other Threads

1. createSurface fails with out-of-memory exception

I'm creating a screen with about 120 TextViews in a grid pattern -
about 3 screens worth. The TextViews are arranged in TableRows inside
a TableLayout inside a ScrollView. I'm not using a GridView because it
doesn't scroll correctly for my application.

In the Allocation Tracker I can see that my onCreate takes about 46K
of memory, which seems modest. However, I'm getting an out-of-memory
exception from inside the Android framework in the createSurface
method.

I'm trying to figure out how to diagnose the memory usage of
createSurface to see which of my Views is chewing up all the memory.
Maybe it's a programming error on my part or maybe it's a bug in the
Android framework. I just can't tell.

The exception causes the application to be killed, which aborts the
Allocation Tracker so I can't really see what's going on inside
createSurface.

I'm thinking maybe I should override createSurface and surround the
call to the super with a catch block. Then I can stop it in the
de{*filter*} before the process is killed. Can anyone think of a more
clever approach? Has anyone else diagnosed createSurface memory
problems? Is there a reference document that describes how it works?

-- 

2. Using Allocation Tracker in DDMS

I have an Activity that is running out of memory in CreateSurface. The
logcat looks like this:

10-04 17:55:52.574: ERROR/SurfaceFlinger(1086): createSurface()
failed, generateId = -12
10-04 17:55:52.574: WARN/WindowManager(1086): OutOfResourcesException
creating surface
10-04 17:55:52.574: INFO/WindowManager(1086): Out of memory for
surface!  Looking for leaks...
10-04 17:55:52.574: WARN/WindowManager(1086): No leaked surfaces;
killing applicatons!
10-04 17:55:52.574: WARN/ActivityManager(1086): Killing processes Free
memory at adjustment 0

I'm trying to use DDMS to figure out what's going on but when the
application gets killed DDMS aborts the Allocation Tracker.

Is there a way to cause the application to do a core dump and is there
a tool for analyzing dumps?

I have SDK version 8, which does not allow simultaneous use of DDMS
and the Eclipse de{*filter*} so I need to get creative.

-- 

3. Programmatically switching GPS on/off (how do they do it??)

4. Changing the width of an ImageView

5. how do I force sendDownUpKeyEvents(MEkeyEventCode) to complete

6. USB Video on an OMAP based board

7. Porting to FPGA (Newbie)