Re: [android-developers] Re: 9.png file not spanning the LinearLayout when android:paddingBottom is specified

2013-06-30 Thread Shri Borde
That kind of makes sense. However, even if the padding gets overwritten,
the Button should still be over the red background since that is the
content area of the 9.png. Why would the Button be positioned on the drop
shadow (the non-content area of the 9.png)? Seems like there is some
undefined non-intuitive behavior happening whereas it would be preferable
for either of the defined padding to be applied (as that would the
intuitive behavior).


On Sat, Jun 29, 2013 at 11:54 PM, Piren  wrote:

> Part of what 9patches do is define padding... if you define them on your
> own you'll overwrite the settings provided by the 9patch.
>
> On Saturday, June 29, 2013 2:10:36 AM UTC+3, Shri wrote:
>
>> I have the following layout file which uses the attached 9.png. It
>> results in the attached screenshot where the red background from the 9.png
>> does not extend all the way behind the button. If I remove the
>> android:paddingBottom="1dp" attribute below, things work as I expect. Is
>> this behavior expected (if so, why), or is this a bug?
>>
>> Thanks,
>> Shri
>>
>> 
>> > xmlns:android="http://schemas.**android.com/apk/res/android
>> "
>> android:id="@+id/container"
>> android:orientation="vertical"
>> android:layout_width="match_**parent"
>> android:layout_height="match_**parent"
>> android:background="#ff" >
>> > android:id="@+id/view_with_**drop_shadow"
>> android:orientation="vertical"
>> android:paddingBottom="1dp"
>> android:layout_width="match_**parent"
>> android:layout_height="wrap_**content"
>> android:background="@drawable/**red_background_with_drop_**shadow"
>> >
>>
>> > android:text="Hello"
>> android:layout_width="wrap_**content"
>> android:layout_height="48dip" />
>>
>> 
>> 
>>
>>  --
> --
> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Android Developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/android-developers/oXTXTevOqEE/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> android-developers+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] Re: std::locale("").name() returns "C"

2013-03-08 Thread Shri Borde
I did ask on android-ndk and was told that the NDK does not support
locales. Will do locale processing in Java code.


On Fri, Mar 8, 2013 at 7:15 AM, bob  wrote:

> Please see this:
>
>
> http://stackoverflow.com/questions/571359/how-do-i-set-the-proper-initial-locale-for-a-c-program-on-windows
>
> It says:
>
> At program startup, the global locale is the "C" or "*Classic*" locale.
> To set the global locale to the program's environment locale (which I guess
> is what you're asking), you thus write:
>
> std::locale::global(std::locale(""));
>
>
>
>
>
>
> On Thursday, March 7, 2013 6:49:12 PM UTC-6, Shri wrote:
>>
>> std::locale().name() and std::locale("").name() are both returning "C" on
>> a JellyBean phone, instead of the expected "En_US". Is it possible to get
>> to the user's locale from C++ code?
>>
>> Thanks,
>> Shri
>>
>  --
> --
> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Android Developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/android-developers/QyQKcz_Plg8/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> android-developers+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [android-developers] How can I check the value of wtf_is_fatal?

2012-08-10 Thread Shri Borde
I want to use wtf_is_fatal==1 as the gate for my expensive asserts since
the people who will set wtf_is_fatal (the dev team) will also be ok with
the slight slowdown caused by expensive asserts. Strictly speaking, these
should be two independent settings, but I was hoping to piggyback off of
wtf_is_fatal==1 so the devs do not have to worry about setting two
different bits. If I can not access wtf_is_fatal, I will probably add a
separate property.

On Fri, Aug 10, 2012 at 11:32 AM, Dianne Hackborn wrote:

> Why do you want to do this?  If you want to log an error that doesn't
> cause your app to crash, use Log.w().  I generally recommend if you have a
> fatal error, using Log.e() (though it is your responsibility to crash or
> whatever the fatal error behavior is after that).
>
> If you don't want the behavior of Log.wtf() (which is partly that it can
> optional crash your app based on the setting), then don't use it.  The only
> reason to use it that I can think of is because you want the behavior it
> provides.  Is there some other reason you want to call that specific method?
>
>
> On Fri, Aug 10, 2012 at 11:13 AM, Shri  wrote:
>
>> I want to check if Log.wtf will result in program termination. I want to
>> use that property to enable expensive asserts in my program. How can I
>> check for this? I used the following code but it throws
>> SettingNotFoundException.
>>
>>   int wtfIsFatal =
>> android.provider.Settings.Secure.getInt(getContentResolver(),
>> "wtf_is_fatal");
>>
>> I tried adding android.permission.WRITE_SECURE_SETTINGS to my
>> AndroidManifest.xml but that does not help. I had set wtf_is_fatal as such:
>>
>> adb root
>> adb shell
>> sqlite3 /data/data/com.android.providers.settings/databases/settings.db
>> >> insert into secure (name, value) values ('wtf_is_fatal', 1);
>> >> select * from secure;
>> ...
>> 60|wtf_is_fatal|1
>> ...
>>
>> Thanks,
>> Shri
>>
>> --
>> 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+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
>
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@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.
>
>  --
> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Intent.FLAG_ACTIVITY_REORDER_TO_FRONT does not work with PendingIntent

2011-09-16 Thread Shri Borde
I guess I can create a trampoline Activity which gets launched by clicking
on the notification icon, and it could then start MyActivity using
FLAG_ACTIVITY_REORDER_TO_FRONT. A bit of a pain which PendingIntent would
have supported itself, but I can give this a shot.

On Fri, Sep 16, 2011 at 3:22 PM, TreKing  wrote:

> On Fri, Sep 16, 2011 at 1:37 PM, Shri  wrote:
>
>> However,
>> this does not seem to work even though I set
>> Intent.FLAG_ACTIVITY_REORDER_TO_FRONT - a new instance gets created if
>> MyActivity was not on top of my task's stack.
>>
>
> http://developer.android.com/reference/android/app/PendingIntent.html#getActivity(android.content.Context,
> int, android.content.Intent, int)
>
> "Note that the activity will be started outside of the context of an
> existing activity, so you must use the 
> Intent.FLAG_ACTIVITY_NEW_TASK
>  launch
> flag in the Intent."
>
> It might get set for you if you don't specify it.
>
>
> -
> TreKing  - Chicago
> transit tracking app for Android-powered devices
>
>  --
> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] GridView shows only one row with layout_height=WRAP_CONTENT

2011-09-03 Thread Shri Borde
TableLayout is for cases where you want a specific number of columns.
However, I would like the number of columns to adjust based on the width of
the screen/parent ViewGroup as done by GridLayout. And I do not actually
want the grid to scroll - I want its height to expand as much as needed to
display all the rows. So overriding GridView and modifying its behavior
seems like the best option.

Thanks for the pointers and the discussion.

On Fri, Sep 2, 2011 at 5:28 PM, Mark Murphy  wrote:

> On Fri, Sep 2, 2011 at 8:12 PM, Shri Borde  wrote:
> > Actually, I am using a GridView in a ListView, not a LinearLayout.
>
> You cannot reliably put scrollable things in other scrollable things.
>
> > I am using the GridView as a table, and it seems
> > reasonable to want to display the table in a ListView. There needs to be
> > some way to accomplish this.
>
> Use a TableLayout.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android 3.1 Programming Books: http://commonsware.com/books
>
> --
> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] GridView shows only one row with layout_height=WRAP_CONTENT

2011-09-02 Thread Shri Borde
Actually, I am using a GridView in a ListView, not a LinearLayout. So the
entire grid can actually be displayed by scrolling the list (with the
Adapter architecture kicking in to display only those cells of the grid that
are visible on screen). I am using the GridView as a table, and it seems
reasonable to want to display the table in a ListView. There needs to be
some way to accomplish this.

One workaround I found was to override #onMeasure. This does show all the
rows of the GridView (on Gingerbread and Honeycomb)

public class MyGridView extends GridView {
  public MyGridView(Context context, AttributeSet attrs) {
super(context, attrs);
  }

  protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec) {
heightMeasureSpec = MeasureSpec.makeMeasureSpec(
MeasureSpec.AT_MOST, MAX_EXPECTED_HEIGHT_OF_TABLE);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  }
}

On Fri, Sep 2, 2011 at 4:42 PM, Mark Murphy  wrote:

> On Fri, Sep 2, 2011 at 7:33 PM, Shri  wrote:
> > I am using a GridView in a LinearLayout. I want the GridView to show
> > up as tall as needed to show all the rows.
>
> That is not really possible. For example, if you have a million cells,
> the user's device is not going to stretch to a few hundred meters just
> to please you.
>
> > However, I am seeing only
> > one row when set (layout_width=MATCH_PARENT and)
> > layout_height=WRAP_CONTENT.
>
> wrap_content is not a valid value for vertically scrollable widgets,
> particularly ListView and GridView. Please use
> fill_parent/match_parent, optionally along with other layout rules to
> control the size (e.g., layout_weight for LinearLayout).
>
> > Looking at onMeasure in
> http://www.netmite.com/android/mydroid/frameworks/base/core/java/android/widget/GridView.java
> ,
>
> That is not a valid source URL for current versions of Android AFAIK.
> Use Google Code Search or http://source.android.com, though the latter
> may still be down due to the kernel.org hack from earlier in the week.
>
> > I see that onMeasure does not calculate the number of rows at all, and
> > so I can understand why only one row shows up. So it seems like an
> > oversight.
>
> No, it seems like it works as expected.
>
> > Shouldn't layout_height=WRAP_CONTENT show all rows (if possible)?
>
> No.
>
> > Is there any workaround?
>
> No. Please use fill_parent/match_parent, optionally along with other
> layout rules to control the size (e.g., layout_weight for
> LinearLayout).
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android 3.1 Programming Books: http://commonsware.com/books
>
> --
> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Activity#onRetainNonConfigurationInstance vs Fragment#setRetainInstance

2011-04-15 Thread Shri Borde
It actually worked with Fragment#setRetainInstance. I just had to call
((ViewGroup) fragmentLayout.getParent()).removeView(fragmentLayout) before I
could reuse the views.

I got crashes in native code when I tried doing the same with
Activity#onRetainNonConfigurationInstance.

On Fri, Apr 15, 2011 at 2:53 PM, Dianne Hackborn wrote:

> Sorry, you just can't re-use a WebView across config changes -- a view is
> instantiated with a Context it runs in, which is the Activity that created
> it.  You can't change this context later, when you have a new Activity
> instance.
>
> On Fri, Apr 15, 2011 at 8:33 AM, Shri  wrote:
>
>> I have a WebView in my Activity which I want to reuse across config
>> changes so that the webpage does not get reloaded after every
>> orientation change. I can use
>> Activity#onRetainNonConfigurationInstance/getLastConfigurationInstance
>> for this. However, I have heard that Fragment#setRetainInstance is
>> better for this purpose. This does not seem correct if there are other
>> Views involved which should be recreated after a config change (eg.
>> TextView which should be recreated after a locale change so that new
>> string resources can be picked up). I could keep only the WebView in a
>> Fragment, and all other Views in the Activity, but then either
>> approach seems good enough.
>>
>> Just checking that Activity#onRetainNonConfigurationInstance/
>> getLastConfigurationInstance are not considered to be bad practice
>> going forward.
>> http://developer.android.com/guide/topics/resources/runtime-changes.html
>> only mentions these apis anyway, not Fragment#setRetainInstance.
>>
>> Thanks
>> Shri
>>
>> --
>> 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+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@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.
>
>

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en