[android-developers] Digest for android-developers@googlegroups.com - 4 Messages in 3 Topics

Comments: (1)

Group: http://groups.google.com/group/android-developers/topics

    "droidin.net" <droid@hireadroid.com> Apr 30 11:16PM -0700 ^
     
    Anybody? Hints? Thoughts?
     

     

    Eric <eric@alum.mit.edu> Apr 30 09:27PM -0700 ^
     
    In the Google I/O 2010 - The world of ListView talk shown here:
     
    http://www.youtube.com/watch?v=wDBM6wVEO70&t=17m38s
     
    a 'ViewHolder' paradigm is suggested to cache views and avoid the
    findViewById lookup. Could the same thing be achieved by using the
    setTag(id, Object) method on View, and simply use the View's tag map
    to store the reference by resource ID? I think this would work, but
    would it introduce any memory leak (or other) problems?
     
     
    public static final View getCachedViewByTagId(View parentView, int
    viewToFindId) {
    Object object = parentView.getTag(viewToFindId);
     
    if(object == null) {
    object = parentView.findViewById(viewToFindId);
     
    if(object != null) {
    parentView.setTag(viewToFindId, object);
    }
    }
     
    return (View)object;
    }

     

    Romain Guy <romainguy@android.com> Apr 30 09:48PM -0700 ^
     
    You could, but setTag(int, Object) forces you to use unique ids throughout
    your app.
     
     
    --
    Romain Guy
    Android framework engineer
    romainguy@android.com
     
    Note: please don't send private questions to me, as I don't have time to
    provide private support. All such questions should be posted on public
    forums, where I and others can see and answer them

     

    Eric <eric@alum.mit.edu> Apr 30 09:19PM -0700 ^
     
    > If you are doing *very* frequent updates (several times per second for
    > instance, with let's say a progress bar or some sort of animation) you
    > should indeed modify the Views directly.
     
    OK.
     
     
    > not displayed. That said you can easily just not invoke
    > notifyDatasetChanged() if you are updating cells that are not between
    > getFirstVisiblePosition() and getFirstVisiblePositon() + getChildCount().
     
     
    My main point is that there is already a model-view-controller style
    Adaptor in place to handle the mediation between the data and the
    view, and so I would rather not have to update the View(s) directly
    myself. I would rather just write my Adaptor accordingly, and have
    the data-side tell it when there are fresh changes to display, and
    then have the ListView decide if/when it should act on those changes
    (hence the notifyDatasetChangedAtIndexes()).

     

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Digest for android-developers@googlegroups.com - 25 Messages in 12 Topics

Comments: (0)

Group: http://groups.google.com/group/android-developers/topics

    Eric <eric@alum.mit.edu> Apr 30 06:38PM -0700 ^
     
    > the possibility that some items in the set may have been removed, added, or
    > moved around, so it needs to build a new set of list item views and try to
    > keep them positioned as well as possible to match the previous data set.
     
    But that's exactly the situation I have. My entire data set changes
    from second to second. My app displays a list of financial trading
    markets in real time, showing bids and offers that change. I never
    know from one second to the next how many items the list will have,
    because the market orders come (new order), go (traded or cancelled
    order), and change (modified order price, etc). The data set I'm
    viewing is not a static size. I don't think there's any other way for
    me to display this data other than to tell the ListView its data set
    has changed. I would have to write my own 'list view' replacement if
    I needed to optimize this. However, contrary to what you may think,
    the performance is more than acceptable. This paradigm has been in
    use on the iPhone for 2 years, and it performs extremely well. The
    Android 'port' of the app, thus far, performs almost as well as the
    iPhone.
     
    The reason I posted the original question was to ask why my touch
    events would be 'swallowed' or 'lost'. Do you see my relatively
    frequent calls to ArrayAdapter.notifyDatasetChanged() causing the
    Touch Events to get 'lost'? If so, I would be highly confused if that
    were the case. All of my drawing, and all of the touch events, are
    happening on a single main/UI thread, so I don't understand how, or
    why, the Touch Events would get lost. Even though the data is
    streaming in on an background thread, i coalesce the changes in the
    background thread until the UI can 'pop' the data off and redraw.
    There is no thread starvation going on because the data thread
    notifies the UI thread only one time, and then the UI thread schedules
    a handoff to grab the data from the background thread when it is next
    available. And the update mechanism then continues from there for the
    next cycle. I would hope that the Touch Events would not get 'lost'
    in all of this, but from my testing it appears some of them might be,
    and I'd like to understand why.

     

    Eric <eric@alum.mit.edu> Apr 30 07:36PM -0700 ^
     
    By the way, this Google I/O video on ListView seems to indicate it is
    perfectly acceptable, and in fact required, that you call
    notifyDatasetChanged() when anything in your dataset changes (either
    individual cell content, or data set size). Nothing in this video
    says you should be iterating through your list view cell Views
    manually and updating them yourself (rather than call
    notifyDatasetChanged()). In fact, this video says never manually
    access the Views in your ListView!
     
    http://www.youtube.com/watch?v=wDBM6wVEO70&t=17m38s

     

    Streets Of Boston <flyingdutchie@gmail.com> Apr 30 08:05PM -0700 ^
     
    Yes, you're right about that. Calling notifyDataSetChanged on the adapter is
    the best way to go and you should use it in 99% of cases. However, in some
    cases rules should be broken. :)
    A call to notifyDataSetChanged redraws all the children in the ListView and
    is relatively expensive and you get the side effects you notice in your
    example (touch issues).
    In this case, another solution may be necessary, where visible list-items
    (child-views of the ListView) or their children update *themselves*.
    You could do this by tagging list-item views (contentView-s) by calling
    setTag an do a getTag on all the ListView's child-views to be able to find
    them back when they need updating.

     

    lbendlin <lutz@bendlin.us> Apr 30 08:13PM -0700 ^
     
    i think this should say "redraws all the *visible* children in the listview"

     

    Eric <eric@alum.mit.edu> Apr 30 08:27PM -0700 ^
     
    On Apr 30, 11:05 pm, Streets Of Boston <flyingdutc...@gmail.com>
    wrote:
    > You could do this by tagging list-item views (contentView-s) by calling
    > setTag an do a getTag on all the ListView's child-views to be able to find
    > them back when they need updating.
     
    I continue to disagree with this. First of all, the ListView should
    only be redrawing what is visible on the screen. That is why the
    Adaptor has a getView(int position...) method, so that the ListView
    can be smart about which views it needs to redraw. Second of all, the
    children VIEWS should not be responsible for updating themselves when
    the underlying data changes. This is precisely why the ListView's
    Adaptor has a notifyDatasetChanged! So that you can give a hint do
    the ListView that the data has changed, and so that it can ask for the
    Views it needs to update. the getView() method on Adaptor also has a
    "View convertView" arg so that it can pass the getView() method a
    recycled view to update. At the very worst, Adaptor needs to be
    updated to have a "notifyDatasetChangedAtIndex(int[] indexes)" method
    so that the ListView can be even smarter about which row(s) to
    redisplay (instead of redisplaying the visible rows as it currently
    does). In any case, I just don't see why my VIEW code should be smart
    about updating itself when the underlying data changes; in other words
    isn't that what the Adaptor is supposed to do for me?

     

    Dianne Hackborn <hackbod@android.com> Apr 30 11:29PM -0400 ^
     
    I'm not sure what more to say except that this isn't how
    notifyDataSetChanged() is supposed to be used. It is for relatively
    infrequent, significant changes to the underlying data. The typical case is
    when a new query has been done in a database and the adapter is being
    switched to show the data of the new cursor.
     
    I understand that there is apparently some API on iOS that sounds similar
    and is what you use, but for what you want to do this is not appropriate on
    Android. iOS != Android.
     
     
    --
    Dianne Hackborn
    Android framework engineer
    hackbod@android.com
     
    Note: please don't send private questions to me, as I don't have time to
    provide private support, and so won't reply to such e-mails. All such
    questions should be posted on public forums, where I and others can see and
    answer them.

     

    Eric <eric@alum.mit.edu> Apr 30 08:30PM -0700 ^
     
    On Apr 30, 11:05 pm, Streets Of Boston <flyingdutc...@gmail.com>
    wrote:
    > A call to notifyDataSetChanged redraws all the children in the ListView and
    > is relatively expensive and you get the side effects you notice in your
    > example (touch issues).
     
    Nobody has yet explained to me how calling notifyDatasetChanged()
    relatively frequently would cause "touch issues". I am calling
    notifyDatasetChanged() from the main/UI thread. The touches are
    coming in and being processed from the main/UI thread. No touches
    should be lost. Period. When the main/UI thread is busy handling a
    touch, it should do just that; handle the touch. Nothing else in my
    code could possibly be interfering with this because my code is also
    running on the main thread. My data processing code is running in a
    background thread, but that does nothing worse than notify the main
    thread in a variable that it may elect to pop data off the data thread
    if it wants to on a later event loop.

     

    Eric <eric@alum.mit.edu> Apr 30 08:35PM -0700 ^
     
    > infrequent, significant changes to the underlying data.  The typical case is
    > when a new query has been done in a database and the adapter is being
    > switched to show the data of the new cursor.
     
    Let me simplify this. Do you know of a Google example code you could
    point me to that shows a ListView with many items updating itself,
    without calling notifyDatasetChanged()? Where the items in the list
    are updating in real time?
     
    How is my View code supposed to know which list items are visible?
    Why should I be responsible for updating the cells if they aren't even
    on the screen? I'd need a pointer to all of the ListView subviews.
    Why isn't there simply a method on Adapter named,
    notifyDatasetChangedAtIndexes(int[] indexes), so that the ListView can
    be smart about merging the changes that I tell it about, with only the
    cells that are currently visible?

     

    Romain Guy <romainguy@android.com> Apr 30 08:39PM -0700 ^
     
    Figuring out which items are visible is pretty easy, you can use
    ListView.getFirstVisiblePosition() to know what section of your adapter is
    visible (getFirstVisiblePosition() + getChildCount() - 1 gives you the last
    visible position.)
     
     
    --
    Romain Guy
    Android framework engineer
    romainguy@android.com
     
    Note: please don't send private questions to me, as I don't have time to
    provide private support. All such questions should be posted on public
    forums, where I and others can see and answer them

     

    Eric <eric@alum.mit.edu> Apr 30 08:56PM -0700 ^
     
    > ListView.getFirstVisiblePosition() to know what section of your adapter is
    > visible (getFirstVisiblePosition() + getChildCount() - 1 gives you the last
    > visible position.)
     
    Ok. So are you also agreeing that I should NOT be calling
    Adapter.notifyDatasetChanged() to have the ListView automatically
    refresh itself? And I should be updating the data in the cells myself
    behind the scenes when individual data changes (but the overall
    dataset count remains the same as before)? If so, this is complete
    news to me. This completely defeats the purpose of having an Adaptor,
    and breaks the MVC paradigm. The only thing I should have to do in my
    code is tell the Adaptor that my dataset has changed, and the view
    should redraw accordingly. Adaptor should have a
    notifyDatasetChangedAtIndexes(int[] indexes) at the very least, rather
    than force the developer to update the cells manually. I guess I'm
    surprised Google is indicating the need for manual updates of data in
    the cells.

     

    Romain Guy <romainguy@android.com> Apr 30 09:01PM -0700 ^
     
    notifyDatasetChanged() is used to force ListView to invoke Adapter.getView()
    again, which may be expensive, depending on what you do in it. ListView does
    have many optimizations to make notifyDatasetChanged() calls as efficient as
    possible though.
     
    If you are doing *very* frequent updates (several times per second for
    instance, with let's say a progress bar or some sort of animation) you
    should indeed modify the Views directly.
     
    Adaptor should have a
    > notifyDatasetChangedAtIndexes(int[] indexes) at the very least, rather
    > than force the developer to update the cells manually.
     
     
    It doesn't really matter, it wouldn't be more efficient to update cells that
    are already on screen. It would only matter when you update cells that are
    not displayed. That said you can easily just not invoke
    notifyDatasetChanged() if you are updating cells that are not between
    getFirstVisiblePosition() and getFirstVisiblePositon() + getChildCount().
     
    --
    Romain Guy
    Android framework engineer
    romainguy@android.com
     
    Note: please don't send private questions to me, as I don't have time to
    provide private support. All such questions should be posted on public
    forums, where I and others can see and answer them

     

    a a <harvey.acer@gmail.com> May 01 09:29AM +0800 ^
     
    thank you, i have solve it
     

     

    Streets Of Boston <flyingdutchie@gmail.com> Apr 30 04:04PM -0700 ^
     
    The new contents of FragmentActivity.java are in my earlier post.

    The AFragmentActivity.java is a copy of the original FragmentActivity.java
    with these additional changes:
     
    - public class AFragmentActivity extends Activity *implements
    FragmentActivity*
    - Then fix the compiler errors from the change above (i.e. implement
    missing methods that are defined by the FragmentActivity). This is pretty
    trivial.
     
    The AFragmentMapActivity is a copy of the AFragmentActivity with these
    additional changes:
     
    - public abstract class AFragmentMapActivity extends *Map*Activity
    implements FragmentActivity
     
    Then you'll find that other source files in the compatibility have some
    compiler errors. These are trivial to fix. Mostly adding (Context) or
    (Activity) casts and calling '.getFragments()' instead of '.mFragments' and
    such.

    Here is a usage example:
    *public class Main extends AFragmentMapActivity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    }*
    * @Override
    protected boolean isRouteDisplayed() {
    return false;
    }
    }*

    *public class MapFragment extends Fragment {
    private View fragmentView;
    private MapView mapView;*
    *
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
    Bundle savedInstanceState) {
    fragmentView = inflater.inflate(R.layout.map, container, false);
    mapView = (MapView)fragmentView.findViewById(R.id.mapview);

    return fragmentView;
    }*
    *}*
     
    And the layout main.xml has a <fragment> in there that refers to *
    MapFragment*.
    *
     
    *

     


    -
    -

     

    Stefan at WPF <stefan.at.wpf@googlemail.com> May 01 12:38AM +0200 ^
     
    Hello,
    when browsing the Android SDK documentation, e.g.
    http://developer.android.com/reference/android/preference/PreferenceActivity.html,
    then this documentation is for the latest Android version (Android 3.0 r1 at
    the time of writing this).
     
    As I am developing for Android 2.2 it is very confusing for me to read the
    Android 3.0 documentation, e.g. it claims for addPreferencesFromResource(int
    preferencesResId):
     
    This method is deprecated. This function is not relevant for a modern
    fragment-based PreferenceActivity.
     
    Well, for Android 3.0 it might be, but seen from Android 2.2 it is probably
    not. So where can I find a documentation written from an Android 2.2
    perspective / the documentation written at the time of Android 2.2? On e.g.
    MSDN you can easily switch between the different documentation versions for
    e.g. .NET 3.5 and .NET 4.0, how about the Android documentation?
     
    Please note, that using the API Level Filter is not enough, even with API
    Level 1 (the lowest API Level where nothing can be deprecated) it claims
    that addPreferencesFromResource(int preferencesResId) is deprecated - the
    filter acts in a too simple way, just filtering out APIs with newer API
    Levels than the one specified for filtering.
     
    Thank you very much :-)

     

    B Lyon <bradflyon@gmail.com> Apr 30 06:49PM -0400 ^
     
    I think there's a little option on the page to filter by api level in
    the kind of upper right
     
    On Sat, Apr 30, 2011 at 6:38 PM, Stefan at WPF

     

    Nicholas Johnson <metthejohnson@gmail.com> Apr 30 03:56PM -0700 ^
     
    AFAIK, you can't, unless you saved the Android 2.2 SDK when you downloaded
    it (you might also find someone on the net who has it).
     
    However, of all my apps that I have, 3 are developed for Android 1.6 and one
    is developed for Android 1.5. I don't have too much of a problem reading the
    SDK. I wouldn't let the "deprecated" get you down too much. Because, in
    fact, the method is deprecated but is still good and works fine.

     

    TreKing <trekingapp@gmail.com> Apr 30 05:06PM -0500 ^
     

    > Hi can any one give me some code to use Preferences from my
    > settings.xml Preference file in a BroadcastRecevier?
     
     
    You can get preference settings from a Context, just like anywhere else in
    your code.
     
    -------------------------------------------------------------------------------------------------
    TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
    transit tracking app for Android-powered devices

     

    #13point7 <arjungadhia@gmail.com> Apr 30 02:14PM -0700 ^
     
    It is fine to do that, but the Release version has a different signature. So
    if they have the Development apk installed, then they have no choice but to
    uninstall that to install the Market apk. This is only the case when going
    from Development -> Market...any subsequent updates will be fine and data
    will be retained.

     

    Derek Winstead <derekwinstead1@gmail.com> Apr 30 02:55PM -0700 ^
     
    I checked out this:
    http://developer.android.com/guide/publishing/app-signing.html#releasemode
     
    I created a keytool as the example shows. I have now Right Click Project ->
    Export and put in the new keystore and alias on the export. I need to first
    write down everything on my phones version. Then uninstall and reinstall the
    new .apk created. Then I will make random changes to the app and do another
    export and install and see what happens.
     
    Thanks everyone for the help so far in getting me in the right direction.

     

    Scythe <scythe213@gmail.com> Apr 30 11:31AM -0700 ^
     
    In my app I have a about a dozen of different Activities. These
    Activities are connected (can call each other with startActivity()) in
    such a way, that the user can theoretically keep running in circles -
    always jumping to the next Activity, never going back. Also, I really
    need to maintain a proper Activity history: if the user presses the
    back button, the app returns to the previous Activity, with the
    previous content.
     
    Question: Suppose the user's using the app for an extended amount of
    time, going in circles between Activites as mentioned above, resulting
    an ever-growing ActivityStack. Every Activity saves some state on
    onSaveInstanceState() too.
     
    - Is this a problem? (I'm afraid it is, I guess it's a memory leak to
    have tens of thousands of Activity records on the stack, especially if
    these save their state).
    - Is there a way to limit the size of the default Android
    ActivityStack's size? (size limit is X, we delete the oldest record if
    it gets filled up)
     
    Any suggestions / alternative solutions are welcome.

     

 Topic: System.exit
    Bob Kerns <rwk@acm.org> Apr 30 11:17AM -0700 ^
     
    Perhaps you yourself are getting in the way when you offer offense in this
    way? I for one am glad that Dianne does not work at the sort of company you
    describe, and there's really no way to take your remarks addressing her job
    security but as a personal attack. I'm not sure why you're doing this; it
    seems out of character for you.
     
    I am probably one of the few people on the list who'd find your SylloGizmo
    references interesting, and I did not find it relevant. Hence, in effect,
    commercial SPAM. (I know that was not your intent).
     
    If you found Dianne's answer inadequate, just answer it yourself.
     
    Like this:
     
    No, it's not OK to call System.exit().
     
    I further argue that any discussion of hypothetical exceptions are not what
    the OP needs. If you're asking the question, you don't have nearly enough
    understanding of the issues to even evaluate them. For example, whether
    System.exit() cleans up the activity stack (it doesn't, as has been pointed
    out) is not something someone who is asking this question understands at
    this point.

     

    Streets Of Boston <flyingdutchie@gmail.com> Apr 30 02:25PM -0700 ^
     
    I figure that multiple smaller images work better than the '1 large image'
    example you have, since DalvikVM won't need to allocate one large contiguous
    chunk of memory.
    I won't worry about it too much. Don't start solving a problem that may not
    exists in your actual app :-)

     

    Pedro Duque <pmduque@gmail.com> Apr 30 07:07PM +0100 ^
     
    Hi,
     
    I'm doing a widget that needs to be update on screen_on or on
    user_present. As I'm not hable to register a BroadcastReceiver inside
    the widget I'm doing it in a Service that is triggered by the widget
    like this:
     
    Widget.java:
        @Override
        public void onEnabled(Context context) {
            super.onEnabled(context);
            context.startService(new Intent(context,
    WidgetService.class).setAction(WidgetService.ACTION_WIDGET_START));
        }
     
    WidgetService.java:
        @Override
        public void onStart(Intent intent, int startId) {
            super.onStart(intent, startId);
     
            String action = intent.getAction();
            Log.d(LOG_APP,"WidgetService onStart: "+action);
     
     
            if (ACTION_WIDGET_STOP.equals(action)) {
                this.unregisterReceiver(mReceiver);
                stopSelf();
                return;
            } else if (ACTION_WIDGET_START.equals(action)) {
                // register receiver that handles screen on and screen off logic
                IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
                this.registerReceiver(mReceiver, filter);
                return;
            }
     
    The problem is that when I try to register the receiver I get the
    error that the service has leaked IntentReceiver because it was
    already registered. Ive checked and no duplicate registration was done
    in my code.
     
    Do you have any idea what I'm overlooking?
     
    Thanks,
    PMD

     

    groob <krzysztof.grobelny@gmail.com> Apr 30 11:09AM -0700 ^
     
    Hello, Nikolay!
     
    Thanks for your answer.
     
    I think it is not the code I should blame here.
    When I'm launching on my device Admob's examples (BannerEssentials,
    Banner-Details) I get exactly the same result.
    Also bannrers in other applications I downloaded from the market look
    equal.
    This makes me more think of my device and applications installed on it
    being guilty of the problem.
    Unfortunately I have no other Android phone available at the moment
    and emulators are displaying correctly red Admob test banner.
     
    It looks to me like AdSense's HTML code is, after being received,
    somehow wrapped (interpretted?) by some app installed on my device and
    thus not fitting the default 320x50px space.
     
    Your advice on changing Admob console settings doesn't help either -
    once AdSense disabled, no ads are received. I think Google want to
    teach me a lesson that fill rate will decrease indeed without
    AdSense. ;)
     
    Best,
    groob.
     

     

    Kostya Vasilyev <kmansoft@gmail.com> Apr 30 10:01PM +0400 ^
     
    I believe the message means this:
     
    <TabHost android:id="*@+id/tabhost*"
     
    should be changed to:
     
    <TabHost android:id="*@android:id/tabhost*"
     
    In other words, referencing the id value defined by Android, rather than
    assigning a new id value in your application.
     
    Same with
     
    <FrameLayout android:id="*@+id/tabcontent*"
     
     
    -- Kostya
     
    30.04.2011 21:50, plutonianandroid ?????:
     
    --
    Kostya Vasilyev -- http://kmansoft.wordpress.com

     

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Digest for android-developers@googlegroups.com - 25 Messages in 12 Topics

Comments: (0)

Group: http://groups.google.com/group/android-developers/topics

    Derek Winstead <derekwinstead1@gmail.com> Apr 30 01:16PM -0700 ^
     
    I have been developing an app I want to share with friends and family for
    beta testing before I publish it to the android market. Problem is, since
    I've already had them install a previous version of the app, that when I
    send them the new .apk to install the installer wants the already installed
    app to be uninstalled first before the new version can be installed or
    updated.
     
    Is this something I'm doing wrong in my program? I want the SQLite DB to
    always be intact and never loose data which is what happens when someone has
    to reinstall/update the app.
     
    Please help! Thanks so much.
     
    Derek

     

    Dianne Hackborn <hackbod@android.com> Apr 30 04:22PM -0400 ^
     
    I assume you have changed the cert. If this is the cause, no there is
    nothing you can do about it. The cert is the identity of the author; two
    apps with different certs are fundamentally different apps and can't be
    installed on top of each other.
     
     
    --
    Dianne Hackborn
    Android framework engineer
    hackbod@android.com
     
    Note: please don't send private questions to me, as I don't have time to
    provide private support, and so won't reply to such e-mails. All such
    questions should be posted on public forums, where I and others can see and
    answer them.

     

    Derek Winstead <derekwinstead1@gmail.com> Apr 30 01:28PM -0700 ^
     
    Where do I change the cert? That doesn't sound like something I've done
    (knowingly).
     
    When doing my development on the ADV with eclipse I make my changes and
    rerun the program. It reinstalls everything but I don't loose data. Only
    when I try to push it to a real phone does it want an uninstall.

     

    JP <joachim.pfeiffer@gmail.com> Apr 30 01:33PM -0700 ^
     
    The development and release .apk files are signed with different
    certificates.
    In other words, when you hand out an .apk that was created when you
    ran an Eclipse build, you are distributing an .apk that's signed with
    a cert different than the .apk which you generate for release (which
    you run through zipalign and signing with the release key).
     
     

     

    Derek Winstead <derekwinstead1@gmail.com> Apr 30 01:53PM -0700 ^
     
    Ok, so when I right click my project and Run As -> Android Application it
    installs on the VM but also creates the .apk file in the bin folder and that
    is what I'm coping and sending to friends. Is this incorrect to do?
     
    I'm still a novice with Android.

     

    Dianne Hackborn <hackbod@android.com> Apr 30 04:17PM -0400 ^
     
    It doesn't. Don't do that. Allowing the user to keep cycling through
    activities is fundamentally flawed. Having an application that has more
    than a handful of activities on the stack is not correct, both for the way
    the system works and the user experience it causes.
     
     
    --
    Dianne Hackborn
    Android framework engineer
    hackbod@android.com
     
    Note: please don't send private questions to me, as I don't have time to
    provide private support, and so won't reply to such e-mails. All such
    questions should be posted on public forums, where I and others can see and
    answer them.

     

    Kumar Bibek <coomar.101@gmail.com> May 01 12:06AM +0530 ^
     
    You will perhaps run into stack overflows or oom. Android will try to kill
    some of your activities though when it finds necessary

     

 Topic: System.exit
    Bob Kerns <rwk@acm.org> Apr 30 11:17AM -0700 ^
     
    Perhaps you yourself are getting in the way when you offer offense in this
    way? I for one am glad that Dianne does not work at the sort of company you
    describe, and there's really no way to take your remarks addressing her job
    security but as a personal attack. I'm not sure why you're doing this; it
    seems out of character for you.
     
    I am probably one of the few people on the list who'd find your SylloGizmo
    references interesting, and I did not find it relevant. Hence, in effect,
    commercial SPAM. (I know that was not your intent).
     
    If you found Dianne's answer inadequate, just answer it yourself.
     
    Like this:
     
    No, it's not OK to call System.exit().
     
    I further argue that any discussion of hypothetical exceptions are not what
    the OP needs. If you're asking the question, you don't have nearly enough
    understanding of the issues to even evaluate them. For example, whether
    System.exit() cleans up the activity stack (it doesn't, as has been pointed
    out) is not something someone who is asking this question understands at
    this point.

     

    Bob Kerns <rwk@acm.org> Apr 30 11:18AM -0700 ^
     
    Perhaps you yourself are getting in the way when you offer offense in this
    way? I for one am glad that Dianne does not work at the sort of company you
    describe, and there's really no way to take your remarks addressing her job
    security but as a personal attack. I'm not sure why you're doing this; it
    seems out of character for you.
     
    I am probably one of the few people on the list who'd find your SylloGizmo
    references interesting, and I did not find it relevant. Hence, in effect,
    commercial SPAM. (I know that was not your intent).
     
    If you found Dianne's answer inadequate, just answer it yourself.
     
    Like this:
     
    No, it's not OK to call System.exit().
     
    I further argue that any discussion of hypothetical exceptions are not what
    the OP needs. If you're asking the question, you don't have nearly enough
    understanding of the issues to even evaluate them. For example, whether
    System.exit() cleans up the activity stack (it doesn't, as has been pointed
    out) is not something someone who is asking this question understands at
    this point.

     

    plutonianandroid <ajwoods237@gmail.com> Apr 30 11:10AM -0700 ^
     
    Wow so simple, thanks a lot Kostya, struggled with that for so long.
     

     

    plutonianandroid <ajwoods237@gmail.com> Apr 30 10:50AM -0700 ^
     
    I get this error from LogCat and can't understand why, driving me
    crazy: 04-30 13:21:26.388: ERROR/AndroidRuntime(12408): Caused by:
    java.lang.RuntimeException: Your content must have a TabHost whose id
    attribute is 'android.R.id.tabhost'
     
    import android.app.TabActivity;
    import android.content.res.Resources;
    import android.os.Bundle;
    import android.widget.TabHost;
     
    public class GreenhouseAppTabWidget extends TabActivity {
     
     
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Resources res = getResources();
    TabHost tabHost=(TabHost)findViewById(R.id.tabhost);
    tabHost.setup();
    TabHost.TabSpec spec; // Reusable TabSpec for each tab
     
    // Initialize a TabSpec for each tab and add it to the TabHost
    spec = tabHost.newTabSpec("tag").setIndicator("Tag",
    res.getDrawable(R.drawable.ic_menu_wizard))
    .setContent(R.id.tagView);
     
    tabHost.addTab(spec);
     
    spec = tabHost.newTabSpec("scan").setIndicator("Scan",
    res.getDrawable(R.drawable.ic_menu_barcode))
    .setContent(R.id.scanView);
    tabHost.addTab(spec);
     
    spec = tabHost.newTabSpec("data").setIndicator("Data",
    res.getDrawable(R.drawable.ic_menu_piechart))
    .setContent(R.id.dataformView);
    tabHost.addTab(spec);
     
    tabHost.setCurrentTab(0);
    }
    }
    main.xml looks like this:
     
    <?xml version="1.0" encoding="utf-8"?>
    <TabHost android:id="@+id/tabhost" xmlns:android="http://
    schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TabWidget android:id="@+id/tabs"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"/>
    <FrameLayout android:id="@+id/tabcontent"
    android:padding="5dp" android:layout_height="fill_parent"
    android:layout_width="fill_parent">
     
    <LinearLayout android:id="@+id/tagView"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="fill_parent" android:orientation="vertical"
    android:layout_width="fill_parent">
    <TextView android:id="@+id/tagIDTextView" android:text="@string/
    tagid_lbl" android:layout_height="wrap_content"
    android:layout_width="wrap_content"></TextView>
    <EditText android:text="EditText"
    android:layout_height="wrap_content" android:id="@+id/upcEditText"
    android:layout_width="wrap_content" android:editable="false"></
    EditText>
    <Button android:onClick="startScan"
    android:layout_height="wrap_content" android:text="@string/
    tagid_btn_lbl" android:id="@+id/tagIDButton"
    android:layout_width="wrap_content"></Button>
    <TextView android:id="@+id/gpsTextView" android:text="@string/
    gps_txt" android:layout_height="wrap_content"
    android:layout_width="wrap_content"></TextView>
    <EditText android:text="EditText"
    android:layout_height="wrap_content" android:id="@+id/gpsEditText"
    android:layout_width="fill_parent" android:editable="false"></
    EditText>
    <Button android:layout_height="wrap_content"
    android:text="@string/gps_btn_lbl" android:id="@+id/gpsButton"
    android:layout_width="wrap_content"></Button>
    <ImageView android:layout_width="wrap_content" android:id="@+id/
    imageView1" android:layout_height="wrap_content"
    android:src="@drawable/icon"></ImageView>
    <Button android:onClick="collectData"
    android:layout_height="wrap_content" android:text="@string/
    collect_btn_lbl" android:id="@+id/button1"
    android:layout_width="wrap_content"></Button>
    </LinearLayout>
     
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
    android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/scanView" android:orientation="vertical">
    <TextView android:layout_height="wrap_content"
    android:layout_width="wrap_content" android:text="@string/
    scan_btn_txt"
    android:id="@+id/scanTextView"></TextView>
    <Button android:layout_height="wrap_content"
    android:layout_width="wrap_content" android:text="@string/
    scan_btn_lbl"
    android:id="@+id/scanButton"></Button>
    </LinearLayout>
     
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
    android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/dataformView" android:orientation="vertical">
    <Button android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="@string/
    pic_btn_lbl"
    android:id="@+id/photoButton"></Button>
    <TextView android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:id="@+id/
    pic_btn_lbl"
    android:text="@string/notes_txt"></TextView>
    <EditText android:text="EditText" android:id="@+id/notesEditText"
    android:layout_height="200dip"
    android:layout_width="wrap_content"></EditText>
    <Button android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:id="@+id/button1"
    android:text="@string/save_data"></Button>
    </LinearLayout>
    </FrameLayout>
     
    </TabHost>

     

    Bob Kerns <rwk@acm.org> Apr 30 10:57AM -0700 ^
     
    Better solution: All services should be defined via interface, with nary an
    implementation class to be seen. Specifying an implementation class, as the
    current spec does, does not add value -- it removes it.
     
    Workaround: Define your own interface class, and your own method that calls
    getSystemService, and wraps the return value in an instance if your
    interface, which delegates to the system one. Then, to generate a mock one,
    generate a mock of your interface. Don't use the system's implementation
    class in your code, but rather your interface, and you're fine.
     
    This is easy. What's hard is doing this N times for all the places this
    simple design rule is not followed in the system, where N is extremely
    large. But you can at least automate your wrapper object implementations
    using the java Proxy mechanism and reflection, for everything but
    performance-critical objects.

     

    plutonianandroid <ajwoods237@gmail.com> Apr 30 12:33PM -0700 ^
     
    I am having a layout problem. My tab content is displayed directly
    over the tabs instead of underneath the tabs.
     
    <?xml version="1.0" encoding="utf-8"?>
    <TabHost android:id="@android:id/tabhost" xmlns:android="http://
    schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TabWidget android:id="@android:id/tabs"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:orientation="vertical"/>
    <FrameLayout android:id="@android:id/tabcontent"
    android:padding="5dp" android:layout_height="fill_parent"
    android:layout_width="fill_parent">
     
    <LinearLayout android:id="@+id/tagView"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="fill_parent" android:orientation="vertical"
    android:layout_width="fill_parent">
    <TextView android:id="@+id/tagIDTextView" android:text="@string/
    tagid_lbl" android:layout_height="wrap_content"
    android:layout_width="wrap_content"></TextView>
    <EditText android:text="EditText"
    android:layout_height="wrap_content" android:id="@+id/upcEditText"
    android:layout_width="wrap_content" android:editable="false"></
    EditText>
    <Button android:onClick="startScan"
    android:layout_height="wrap_content" android:text="@string/
    tagid_btn_lbl" android:id="@+id/tagIDButton"
    android:layout_width="wrap_content"></Button>
    <TextView android:id="@+id/gpsTextView" android:text="@string/
    gps_txt" android:layout_height="wrap_content"
    android:layout_width="wrap_content"></TextView>
    <EditText android:text="EditText"
    android:layout_height="wrap_content" android:id="@+id/gpsEditText"
    android:layout_width="fill_parent" android:editable="false"></
    EditText>
    <Button android:layout_height="wrap_content"
    android:text="@string/gps_btn_lbl" android:id="@+id/gpsButton"
    android:layout_width="wrap_content"></Button>
    <ImageView android:layout_width="wrap_content" android:id="@+id/
    imageView1" android:layout_height="wrap_content"
    android:src="@drawable/icon"></ImageView>
    <Button android:onClick="collectData"
    android:layout_height="wrap_content" android:text="@string/
    collect_btn_lbl" android:id="@+id/button1"
    android:layout_width="wrap_content"></Button>
    </LinearLayout>
     
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
    android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/scanView" android:orientation="vertical">
    <TextView android:layout_height="wrap_content"
    android:layout_width="wrap_content" android:text="@string/
    scan_btn_txt"
    android:id="@+id/scanTextView"></TextView>
    <Button android:layout_height="wrap_content"
    android:layout_width="wrap_content" android:text="@string/
    scan_btn_lbl"
    android:id="@+id/scanButton"></Button>
    </LinearLayout>
     
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
    android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/dataformView" android:orientation="vertical">
    <Button android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="@string/
    pic_btn_lbl"
    android:id="@+id/photoButton"></Button>
    <TextView android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:id="@+id/
    pic_btn_lbl"
    android:text="@string/notes_txt"></TextView>
    <EditText android:text="EditText" android:id="@+id/notesEditText"
    android:layout_height="200dip"
    android:layout_width="wrap_content"></EditText>
    <Button android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:id="@+id/button1"
    android:text="@string/save_data"></Button>
    </LinearLayout>
    </FrameLayout>
    </TabHost>
     
     
    package com.alkemajwoods.greenhouseapp;
     
    import android.app.TabActivity;
    import android.content.res.Resources;
    import android.os.Bundle;
    import android.widget.TabHost;
     
     
    public class GreenhouseAppTabWidget extends TabActivity {
     
     
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Resources res = getResources();
    TabHost tabHost = getTabHost();
    TabHost.TabSpec spec; // Reusable TabSpec for each tab
     
    // Initialize a TabSpec for each tab and add it to the TabHost
    spec = tabHost.newTabSpec("tag").setIndicator("Tag",
    res.getDrawable(R.drawable.ic_menu_wizard))
    .setContent(R.id.tagView);
     
    tabHost.addTab(spec);
     
    spec = tabHost.newTabSpec("scan").setIndicator("Scan",
    res.getDrawable(R.drawable.ic_menu_barcode))
    .setContent(R.id.scanView);
    tabHost.addTab(spec);
     
    spec = tabHost.newTabSpec("data").setIndicator("Data",
    res.getDrawable(R.drawable.ic_menu_piechart))
    .setContent(R.id.dataformView);
    tabHost.addTab(spec);
     
    tabHost.setCurrentTab(0);
    }
    }

     

    Alaeddine Ghribi <alaeddineghribi@gmail.com> Apr 30 12:04PM -0700 ^
     
    I have a problem, the image is not showing even when deleting
    "visibility" ?
    Have i a problem with the XML file ?
    Thank you.
     

     

    Kostya Vasilyev <kmansoft@gmail.com> Apr 30 11:06PM +0400 ^
     
    30.04.2011 23:04, Alaeddine Ghribi пишет:
    > I have a problem, the image is not showing even when deleting
    > "visibility" ?
    > Have i a problem with the XML file ?
     
    Yes.
     
    The view that's above the ImageView is set to fill_parent height, so it
    takes the entire height of the screen, leaving no room for the image view.
     
     
    --
    Kostya Vasilyev -- http://kmansoft.wordpress.com

     

    Alaeddine Ghribi <alaeddineghribi@gmail.com> Apr 30 08:56PM +0100 ^
     
    Excatly that's the problem, i didn't notice it, i just copied it from my
    previous project :P !
    However, i want to set the image to show after a period, i've maked this:
     
    public void onRegistrationDone(String localProfileUri, long expiryTime) {
    updateStatus("Registered to server.");
    Log.d("SUCCEED","Registration DONE");
    final ImageView iconView = (ImageView)
    findViewById(R.id.connected);
    iconView.setVisibility(1);
    iconView.postDelayed(new Runnable() {
    public void run() {
    iconView.setVisibility(0);
    }
    }, 5000);
     
    But it's always showen.
    Any idea how to fix that problem ?
     
    Thank you.
    2011/4/30 Kostya Vasilyev <kmansoft@gmail.com>
     

     

    Kostya Vasilyev <kmansoft@gmail.com> Apr 30 11:59PM +0400 ^
     
    As was already pointed out by Dianne, View.setVisibility() uses
    constants, like View.GONE and View.VISIBLE - not arbitrary values like 0
    or 1.
     
    -- Kostya
     
    30.04.2011 23:56, Alaeddine Ghribi пишет:
     
    --
    Kostya Vasilyev -- http://kmansoft.wordpress.com

     

    Dianne Hackborn <hackbod@android.com> Apr 30 04:15PM -0400 ^
     
    No do iconView.setVisibility(View.VISIBLE). Don't just make up numbers.
     
    On Sat, Apr 30, 2011 at 4:11 PM, Alaeddine Ghribi <alaeddineghribi@gmail.com
     
    --
    Dianne Hackborn
    Android framework engineer
    hackbod@android.com
     
    Note: please don't send private questions to me, as I don't have time to
    provide private support, and so won't reply to such e-mails. All such
    questions should be posted on public forums, where I and others can see and
    answer them.

     

    MarcoAndroid <marcodus@gmail.com> Apr 30 01:05PM -0700 ^
     
    Hi there,
     
    In the Additional Notes section here:
    http://www.devdiv.com/android/docs/guide/topics/fundamentals/bound-services.html#Binding
    it says: "You should always trap DeadObjectException exceptions, which
    are thrown when the connection has broken. This is the only exception
    thrown by remote methods."
     
    1) Does that mean that for all calls of the client to the service's
    methods you need to try/catch the DeadObjectException? Even
    getService() in onServiceConnected() can throw it?
     
    2) If my service only uses a local binder (LocalBinder in the example
    from the above link), so it is private to my own application and runs
    in the same process as the client, can I then still get
    DeadObjectException? I wonder because I see with this type of binding
    that the service does *not* appear in the services overview of a
    device or emulator, which makes sense to me because it is "tightly"
    connected to the activity that bound to it. That to me means you (nor
    the Android runtime) can end the service on its own, so never a chance
    on DeadObjectException... True?
     
    Thanks!
    Marco

     

    Dianne Hackborn <hackbod@android.com> Apr 30 04:14PM -0400 ^
     

    > 1) Does that mean that for all calls of the client to the service's
    > methods you need to try/catch the DeadObjectException? Even
    > getService() in onServiceConnected() can throw it?
     
    You need to catch them wherever they can be thrown. You actually don't need
    to worry about this, because this is a checked exception so if you forget to
    check it somewhere you will get a compile time error.
     
     
    > connected to the activity that bound to it. That to me means you (nor
    > the Android runtime) can end the service on its own, so never a chance
    > on DeadObjectException... True?
     
    No you can't get it, because it is in the same process, so if the service's
    process goes away then your client code's process has gone away as well and
    never could have gotten a result.
     
    However because the interface generated by aidl can be used with a remote
    object, at compile time there is no way to know whether or not this will be
    the case, so the interface methods must declare they throw RemoteException
    and you thus must handle if if calling those methods.
     
    One way to get around this is when implementing those methods in the service
    do not declare them as throwing RemoteException and on the client side cast
    the interface to this implementation class. Now the compiler knows that a
    call to the method will never throw that exception.
     
    Or just catch the exception and do nothing, or print a quick log, or
    whatever.
     
    --
    Dianne Hackborn
    Android framework engineer
    hackbod@android.com
     
    Note: please don't send private questions to me, as I don't have time to
    provide private support, and so won't reply to such e-mails. All such
    questions should be posted on public forums, where I and others can see and
    answer them.

     

    groob <krzysztof.grobelny@gmail.com> Apr 30 12:25PM -0700 ^
     
    I know where's the problem - my network operator in Poland (Era, from
    T-Mobile) adds a service called 'Compressor mini' (which is in fact
    Opera Mini feature), that is to limit data transfer.
    Unfortunately it adds as well this toolbars.
     
    Don't even ask - I'm pissed as hell on them, especially they disagree
    to turn it off.
     
     

     

    Akshay Goel <xpectronum@gmail.com> Apr 30 09:57AM -0700 ^
     
    Thanks Dianne. I will have to remove singleTask then.
     

     

    Greg Brown <gk_brown@verizon.net> Apr 30 12:40PM -0400 ^
     
    I actually don't want them in my .apk file at all. I have been trying to figure out how to filter them out but I haven't found a way to do so.
     
    Greg
     
    On Apr 30, 2011, at 10:50 AM, Dianne Hackborn wrote:

     

    argongold <argongold10@gmail.com> Apr 29 11:29PM -0700 ^
     
    Hi,
     
    I have a customized list which is extended from AbsSpinner class. It
    has 7 items only as background images. I want to implement a touch
    state hgihlight feature. Such as when a user touch any specific list
    images then its corresponding (image a different) is replaced for few
    Milli-Seconds before changing back to original one.
     
     
    Please note for each list item background, I have its corresponding
    highlight image. which means if I have 7 background images then I have
    7 highlight images too.
     
    Thanks in advance,
     
    Regards,
    argongold

     

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Digest for android-developers@googlegroups.com - 25 Messages in 11 Topics

Comments: (0)

Group: http://groups.google.com/group/android-developers/topics

    Boozel <boozelclark@gmail.com> Apr 30 09:11AM -0700 ^
     
    Hi can any one give me some code to use Preferences from my
    settings.xml Preference file in a BroadcastRecevier?
    Thank you

     

    Alaeddine Ghribi <alaeddineghribi@gmail.com> Apr 30 07:47AM -0700 ^
     
    Hello,
    I want to change the UI(if possible just add an image to the UI) when
    i'm well connected to the server(i'm developping a SIP application) by
    adding an imaged "Connected" .
    In fact, i've made this but i have a FC:
    public void onRegistrationDone(String localProfileUri, long
    expiryTime) {
    updateStatus("Registered to server.");
    Log.d("SUCCEED","Registration DONE");
    setContentView(R.layout.connected);
    }
     
    connected is an XMl file that has a textview(with same id as the
    main.xml) and the image that i want to add.
    How can i do this?
     
    Thank you very much.

     

    Marcin Orlowski <webnet.android@gmail.com> Apr 30 05:04PM +0200 ^
     
    What about just having you all UI elements in one view but simply hide/show
    some you want to be visible conditionaly by using setVisibility() on them?
    Looks like you do not need anything more complicated anyway.
     
    Regards,
    Marcin Orlowski
     
    *Tray Agenda <http://bit.ly/trayagenda>* - keep you daily schedule handy...
    *Date In Tray* <http://bit.ly/dateintraypro> - current date at glance...
    WebnetMobile on *Facebook <http://webnetmobile.com/fb/>* and
    *Twitter<http://webnetmobile.com/twitter/>
    *

     

    Alaeddine Ghribi <alaeddineghribi@gmail.com> Apr 30 08:35AM -0700 ^
     
    I've made this:
    public void onRegistrationDone(String localProfileUri, long
    expiryTime) {
    updateStatus("Registered to server.");
    Log.d("SUCCEED","Registration DONE");
     
    ImageView iconView = (ImageView)
    findViewById(R.id.connected);
    iconView.setVisibility(1);
     
    }
    But the image diesn't shows!
    Here is also my XML file:
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
    android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
     
    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/sipLabel"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    />
    <ImageView android:id="@+id/connected" android:src="@drawable/
    connected" android:layout_below="@id/sipLabel"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:layout_weight="0.35"
    android:gravity="center"
    android:visibility="invisible" />
    </LinearLayout>
     
    What could be the problem?
    Thank you very much.
     
     

     

    Alaeddine Ghribi <alaeddineghribi@gmail.com> Apr 30 04:11PM +0100 ^
     
    Very good idea. So i add the image in the XMl file and i set its visiblity
    to 0, then when i'm connected to the server i set its visibilty(in java
    code) to 1 . But, how can i set it in Java ?
     
    Thank you for you help.
     
    2011/4/30 Marcin Orlowski <webnet.android@gmail.com>
     

     

    Dianne Hackborn <hackbod@android.com> Apr 30 11:14AM -0400 ^
     
    setContentView() completely replaces your current UI with a new one. If you
    just want to make an image shown, you need to modify the current UI -- for
    example have an ImageView containing the image which you change between
    View.INVISIBLE and View.VISIBLE.
    On Apr 30, 2011 10:48 AM, "Alaeddine Ghribi" <alaeddineghribi@gmail.com>
    wrote:

     

    Dianne Hackborn <hackbod@android.com> Apr 30 12:06PM -0400 ^
     
    First thing is to actually use one of the correct constants in
    View.setVisibility() -- such as View.VISIBLE.
     
    On Sat, Apr 30, 2011 at 11:35 AM, Alaeddine Ghribi <
     
    --
    Dianne Hackborn
    Android framework engineer
    hackbod@android.com
     
    Note: please don't send private questions to me, as I don't have time to
    provide private support, and so won't reply to such e-mails. All such
    questions should be posted on public forums, where I and others can see and
    answer them.

     

    a a <harvey.acer@gmail.com> Apr 30 09:51PM +0800 ^
     
    wrong answer, sorry...
     

     

    a a <harvey.acer@gmail.com> Apr 30 09:55PM +0800 ^
     
    get the text rect, then return the rect height, this is text height.
     

     

    Paul Turchenko <paul.turchenko@gmail.com> Apr 30 08:56AM -0700 ^
     
    decent()-acent()
     

     

    "Igor Nesralla Ribeiro" <nesralla@gmail.com> Apr 30 11:42AM -0300 ^
     
    Hi Marcin,
     

     
    Sorry...my English…
     
    Well….my real problem is : only my application tag in manifest disappeared
    and i don't know if when I change the app description in design view or when
    I export to apk file…
     

     
    That's it…
     

     
    Thanks
     
    Igor
     

     

     
    From: android-developers@googlegroups.com
    [mailto:android-developers@googlegroups.com] On Behalf Of Marcin Orlowski
    Sent: sábado, 30 de abril de 2011 10:05
    To: android-developers@googlegroups.com
    Subject: Re: [android-developers] problem after generate a .apk file
     

     
    On 30 April 2011 13:47, Igor Nesralla Ribeiro <nesralla@gmail.com> wrote:
     
    Hi,
     
    I make a app on eclipse , win 7 ....after this I go on menu export and run
    it....i export apk file and its seems to be ok for me....i published it on
    the market...and finish(
    https://market.android.com/details?id=com.riosistemas.butecos
    <https://market.android.com/details?id=com.riosistemas.butecos&feature=searc
    h> &feature=search
    _result )....But the problem goes after this process.... when I open my
    project again in eclipse to make some changes....all my manifest file was
    change(my application information was disappear)...
     
     
    Exporting APK does not change Manifest file.

     
    and I can debug on my phone too....
     
     
    To debug on the phone you simply set debuggable to true and upload?
     

     
    What I'm do wrong ? I have to create another project and rewrite all
    manifest file ? anybody help me !?
     
     
    Unless others get better reading your post, you may rephrase your post.
    I am not fully understand what's really is really not working right.
     
    --
    You received this message because you are subscribed to the Google
    Groups "Android Developers" group.
    To post to this group, send email to android-developers@googlegroups.com
    To unsubscribe from this group, send email to
    android-developers+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/android-developers?hl=en

     

    Marcin Orlowski <webnet.android@gmail.com> Apr 30 05:01PM +0200 ^
     

    > Well….my real problem is : only my application tag in manifest disappeared
    > and i don't know if when I change the app description in design view or when
    > I export to apk file…
     
    Unless you manage to trigger any sort of rarely exposed bug, it's mostly not
    related to exporting your app. I assume you changed this that way or
    another. If not, then describe step-by-step what you do to make this happen.
    Please check if it really happens all the time.
     
    Regards,
    Marcin Orlowski
     
    *Tray Agenda <http://bit.ly/trayagenda>* - keep you daily schedule handy...
    *Date In Tray* <http://bit.ly/dateintraypro> - current date at glance...
    WebnetMobile on *Facebook <http://webnetmobile.com/fb/>* and
    *Twitter<http://webnetmobile.com/twitter/>
    *

     

    Dianne Hackborn <hackbod@android.com> Apr 30 09:58AM -0400 ^
     
    Sorry, this information is not available if your task has has multiple
    activities in it.
    > root / secondary activities are brought to focus by long clicking Home
    > (Recent Apps). So I started using
    > FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY<
    http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
    > my code but saw that it was never set in getFlags(). Then I did more
    > investigation and I found all these observation below.
     
    > Can you let me know how to know for any activity(other than root activity)
    *on
     
    >> Why do you care? You are looking at log statements. The log from the
    >> activity manager happens to be the Intent printed at some point in its
    >> processing. There is nothing defined in the API that some log print in
    the
    >> the application.
     
    >> The activity manager is printing the intent that is handed to it when the
    >> request to start the activity happens. It will add in flags that should
    be
    >> set for the launch at that point as defined by the API.
     
    >> Did you even look at what these flags are?
     
    >> 0x10000000:
     
    http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NEW_TASK
     
    >> 0x00100000:
     
    http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
     
    >> 0x00200000:
     
    http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
    >> bits set so to save space nothing is printed about the flag.
     
    >> This all seems to be working perfectly fine to me,
     
    >> On Sat, Apr 30, 2011 at 12:10 AM, Manohar Mahapatra <
    androiduzer@gmail.com
     
    >>> Hi,
     
    >>> I am seeing some issues in the way the following API( *getFlags()*) of
    >>> the Intent class works . I see that the Activity Manager starts a
    Activity
    >>> with some value of flag set in the Intent but when I print the Intent
    object
    >>> in the root Activity ,
     
    >>> the flag value in the Intent object is not same as what Activity Manager
    >>> launched the intent with for some scenarios. Second issue Any other
    Activity
    >>> launched by the root activity has no info of the flag in the intent
     
    >>> "int getFlags<
    http://developer.android.com/reference/android/content/Intent.html#getFlags%28%29
     
    >>> *protected* *void* onResume() {
     
    >>> *super*.onResume();
     
    >>> Log.*d*("SecondActivity", "MainActivity SecondActivity
    "+getIntent().toString());
     
    >>> First time launch , both the flags in ActivityManager and my
    >>> app(MainActivity) are same
     
    >>> 04-30 03:14:05.132: INFO/ActivityManager(71): Starting activity: Intent
    {
    >>> act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] *
    >>> flg=0x10000000* cmp=com.example.flag/.MainActivity }
     
    >>> 04-30 03:14:05.372: INFO/ActivityManager(71): Start proc
    com.example.flag
    >>> for activity com.example.flag/.MainActivity: pid=235 uid=10032
    gids={1015}
     
    >>> 04-30 03:14:10.722: DEBUG/MainActivity(235): MainActivity
    getIntent().toString()::Intent
    >>> { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
    *
    >>> com.example.flag/.MainActivity: 5970 ms (total 5970 ms)
     
    >>> Then I press Home button , then I do a Long press Home to launch
    >>> MainActivity from the Recent Apps, I get this log and I see now *they
    are
    >>> not same.*
     
    >>> 04-30 03:15:03.353: INFO/ActivityManager(71): Starting activity: Intent
    {
    >>> act=android.intent.action.MAIN cat=[android.intent.category.HOME]
    >>> flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher }
     
    >>> 04-30 03:15:15.562: INFO/ActivityManager(71): Starting activity: Intent
    {
    >>> act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] *
    >>> flg=0x10100000* cmp=com.example.flag/.MainActivity }
     
    >>> 04-30 03:15:15.652: DEBUG/MainActivity(235): MainActivity
    getIntent().toString()::Intent
    >>> { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
    *
    >>> flg=0x10000000* cmp=com.example.flag/.MainActivity }
     
    >>> Then I Press back on the MainActivity , bringing me to Android Home and
    >>> from the Home Page Icon List, again I launch the Main Activity, this
    time
    >>> the flags are same again
     
    >>> 04-30 03:16:10.412: INFO/ActivityManager(71): Starting activity: Intent
    {
    >>> act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] *
    >>> flg=0x10200000* cmp=com.example.flag/.MainActivity }
     
    >>> 04-30 03:16:10.722: DEBUG/MainActivity(235): MainActivity
    getIntent().toString()::Intent
    >>> { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
    *
    >>> com.example.flag/.MainActivity: 465 ms (total 465 ms)
     
    >>> Then I press Home button , then I do a Long press Home to launch
    >>> MainActivity from the Recent Apps, I get this log and I see now *they
    are
    >>> not same.*
     
    >>> 04-30 03:16:21.883: INFO/ActivityManager(71): Starting activity: Intent
    {
    >>> act=android.intent.action.MAIN cat=[android.intent.category.HOME]
    >>> flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher }
     
    >>> 04-30 03:16:30.293: INFO/ActivityManager(71): Starting activity: Intent
    {
    >>> act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] *
    >>> flg=0x10100000* cmp=com.example.flag/.MainActivity }
     
    >>> 04-30 03:16:30.382: DEBUG/MainActivity(235): MainActivity
    getIntent().toString()::Intent
    >>> { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
    *
    >>> flg=0x10200000* cmp=com.example.flag/.MainActivity }
     
    >>> Then I launch SecondActivity from the Main Activity
     
    >>> 04-30 03:16:49.132: INFO/ActivityManager(71): Starting activity: Intent
    {
    >>> cmp=com.example.flag/.SecondActivity }
     
    >>> 04-30 03:16:49.233: DEBUG/SecondActivity(235): MainActivity
    SecondActivity
    >>> com.example.flag/.SecondActivity: 338 ms (total 338 ms)
     
    >>> I press Home button, I do a Long press Home to launch
    >>> MainActivity(MainActivity is first activity of this app task,Second
    Activity
    >>> being on top of MainActivity) from the Recent Apps, I get this log and I
    >>> don't get any Flags from the Second Activity
     
    >>> 04-30 03:16:56.833: INFO/ActivityManager(71): Starting activity: Intent
    {
    >>> act=android.intent.action.MAIN cat=[android.intent.category.HOME]
    >>> flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher }
     
    >>> 04-30 03:17:05.962: INFO/ActivityManager(71): Starting activity: Intent
    {
    >>> act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
    >>> flg=0x10100000 cmp=com.example.flag/.MainActivity }
     
    >>> 04-30 03:17:06.022: DEBUG/SecondActivity(235): MainActivity
    SecondActivity
     
    >>> *
    >>> *
     
    >>> I request anyone to tell me if there is some gap in my understanding or
    if
     
    >>> AndUzer
     
    >>> --
    >>> You received this message because you are subscribed to the Google
    Groups
     
    >> Note: please don't send private questions to me, as I don't have time to
    >> provide private support, and so won't reply to such e-mails. All such
    >> questions should be posted on public forums, where I and others can see
    and

     

    Manohar Mahapatra <androiduzer@gmail.com> Apr 30 07:45PM +0530 ^
     
    Hi Dianne,
     
    Thanks for the reply. I want to let you know the exact dilemma I am in.
     
    My application is a client based financial app and compulsorily it needs to
    validate the user token from the server every time it comes to foreground.
    This is a security mandate.
     
    Are you aware of any call back( ( Activity) or (Context ) level)/or
    any workaround that we can use when the App is brought to foreground from
    the Recent Apps. Usually the user of my app would be in some secondary
    activity launched by the root activity.
     
    I works fine in all the App launch scenarios except the Recent App workflow
    where any of my Secondary activity has *no way* to know that it has been
    brought to the foreground from the Recent Apps.
     
    If you are aware of some good practice for this kind of situation,
    any suggestion or advice would be greatly appreciated.
     
    Thanks
    AndUzer
     

     

    Mark Murphy <mmurphy@commonsware.com> Apr 30 10:24AM -0400 ^
     
    On Sat, Apr 30, 2011 at 10:15 AM, Manohar Mahapatra
    > My application is a client based financial app and compulsorily it needs to
    > validate the user token from the server every time it comes to foreground.
    > This is a security mandate.
     
    Then validate the user token in every activity in onResume(). I fail
    to see how anything else can satisfy this "security mandate".
     
    Android applications don't "come to foreground" any more than Web
    applications do.
     
    --
    Mark Murphy (a Commons Guy)
    http://commonsware.com | http://github.com/commonsguy
    http://commonsware.com/blog | http://twitter.com/commonsguy
     
    _The Busy Coder's Guide to Android Development_ Version 3.6 Available!

     

    Manohar Mahapatra <androiduzer@gmail.com> Apr 30 08:21PM +0530 ^
     
    Hi Mark,
     
    Thanks for the reply. You are right , I could have used onResume in
    my secondary(not root activity) activities, but onResume will be called
    even when I navigate between the activities in my app once it is launched.
    . I dont want to check the user token during this scenario as it would be a
    overkill.
     
    My requirement is if my application( hint app task level) as a whole is
    brought to foreground ( see the two cases below)
     
    a) From the Home page - works fine in this scenario
    b) From the Recent Apps - has the issue , here i cant know the onResume for
    any secondary activity is called due to an internal navigation or due to
    the *app task* coming to the foreground again. So i thought of using the
    FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY<http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY>
    from any of the secondary activity but I get 0 when I query for getFlags()
    in any of the secondary activity
     
    thanks
    And Uzer
     

     

    Mark Murphy <mmurphy@commonsware.com> Apr 30 10:58AM -0400 ^
     
    On Sat, Apr 30, 2011 at 10:51 AM, Manohar Mahapatra
    > the FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY from any of the secondary activity
    > but I get 0 when I query for getFlags() in any of the secondary activity
    > thanks
     
    IMHO, your requirement is flawed. It's almost as flawed as those who
    think they need to find out when their "application goes in the
    background" to log people out.
     
    Any sensible Web application would use a time-based mechanism based
    upon session cookies. After N minutes (either since login or since
    inactivity) -- or if there is no session cookie -- force a
    re-authentication. IMHO, sensible Android applications will take the
    same approach.
     
    --
    Mark Murphy (a Commons Guy)
    http://commonsware.com | http://github.com/commonsguy
    http://commonsware.com/blog | http://twitter.com/commonsguy
     
    _The Busy Coder's Guide to Android Development_ Version 3.6 Available!

     

    Greg Brown <gk_brown@verizon.net> Apr 30 06:47AM -0700 ^
     
    Hi all,
     
    I'm using Eclipse to develop an Android application. I have a number
    of resource files in my project that are used for unit testing. When I
    generate an APK file for my app using "Android Tools > Export Unsigned
    Application Package", the generated file includes these data files. I
    have not been able to find a way to filter them out.
     
    Is there a configuration file somewhere that I can modify to exclude
    these files?
     
    Thanks for your help,
    Greg

     

    Dianne Hackborn <hackbod@android.com> Apr 30 10:50AM -0400 ^
     
    Do they actually need to be in your main .apk? Generally we like to keep
    all test related code (and resources) in a separate .apk that has the
    Instrumentation components.

     

    Kevin TeslaCoil Software <kevin@teslacoilsw.com> Apr 30 07:32AM -0700 ^
     
    Actually on AT&T you can't use http or dropbox to install APKs because
    AT&T block sideloading.
     
    But enabling the phone's System Settings > Applications > Development
    > USB debugging and using eclipse or adb is easier anyway.
    (And like Mark said you may need the usb driver)
     
    -Kevin
     
    On Apr 30, 12:47 am, Russell DuRoss <r2s...@gmail.com> wrote:

     

    "Gabriel Simões" <gsimoes@gmail.com> Apr 30 07:31AM -0700 ^
     
    No ideas? Please, some help here would be really nice!
     
    tnx
     

     

    Yoan <yoan.gras@gmail.com> Apr 30 07:00AM -0700 ^
     
    I didn't see this group, sorry
    Thanks for the link
     

     

    Dianne Hackborn <hackbod@android.com> Apr 30 09:57AM -0400 ^
     
    Re battery levels -- the batteries on these devices don't simply charge to
    100%, they will charge up 100%, then drain down some amount (toward 90%),
    then charge up again.
     
    The Droid's hardware only reports battery level in 10% increments, so you
    wouldn't see the behavior there. Also some manufacturers hide this charging
    behavior when they report the battery level so it doesn't confuse users.

     

    Dianne Hackborn <hackbod@android.com> Apr 30 09:49AM -0400 ^
     
    Sorry, this is probably a bug in 2.3 with trying to grant a URI permission
    to an activity instance that is already running. I'll look in to this. In
    the mean-time, the only solution may be to not use singleTask for the
    activity being launched to a preview an attachment. This is actually the
    preferred thing to do, since your preview activity should be running as its
    own instance as part of the gmail task.

     

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en