Re: [android-developers] 7-Day Notification of Google Play Developer Term Violation

2014-09-19 Thread Thierry Legras
Thanks Dallas for supporting me!

The first link applies to apk you download  install from internet that
would be incorrectly detected as harmfull, so not my case

The second link is much more interesting, but (hopefully) I am not yet in
the case where my app is removed. So far I have just been warned. It is now
more than 8 days since I got the warning and no new (good nor bad)
notification received so far. I hope my changes to the app description in
Google Play are considered as enough. Else I will have to use this form...

Thierry







2014-09-18 21:54 GMT+02:00 Dallas Singletary devdal...@gmail.com:

 Here is some more info I found for you, please let me know if it is
 helpful here is the first link
 https://support.google.com/googleplay/android-developer/answer/2992033?hl=enref_topic=3453554

 And the second.
 https://support.google.com/googleplay/android-developer/troubleshooter/2993242?hl=enref_topic=3453554#ts=2993245,2993352
 The second has a contact form
 On Sep 15, 2014 4:57 AM, Thierry Legras tleg...@gmail.com wrote:


 Here we go, after 3 years with almost no change in my application
 description on Google Play I received the violation notification for my
 application
 https://play.google.com/store/apps/details?id=com.tlegras.freeboxrec
 (sorry only available in google play France)

 This is a notification that your application, Freebox Recorder, with
 package ID com.tlegras.freeboxrec, is currently in violation of our
 developer terms.
 *REASON FOR WARNING*: Violation of the spam
 https://play.google.com/about/developer-content-policy.html#spam 
 provisions
 of the Content Policy. Please refer to the spam policy help article
 https://support.google.com/googleplay/android-developer/answer/2985717 for
 more information.

- Do not engage in keyword stuffing by loading app descriptions
with keywords out of context


- Do not use irrelevant, misleading, or excessive keywords in apps
descriptions, titles, or metadata.


 It seems that Google anti-spam robots has gone crazy (why only now after
 all these years??) with the keywords Freebox and Free which are related
 to the name of the French Telecom operator Free and its set-top box
 Freebox that my application allows to control remotely. So these keywords
 are definitively NOT out of context, my application does not pretend
 anywhere to give anything for free or whatever of the kind.

 While waiting for the end of the countdown, I removed a few occurrences
 of Freebox in Google play description. Changing the package ID is really
 not an option for me as other applications are using mine, and anyway, come
 on, my application is controlling a device called Freebox so what would
 be the issue with freebox in the id???

 So, can anybody tell me if there is a way to contact a HUMAN at Google
 play team before my application may be deleted from Google Play, or at
 least how to get more precise feedback than this generic automatically
 generated mail.

 I am pretty upset by such mail after having supported a free ad-less
 revenue-less application stared 4.5/5 for so many year and seeing it could
 be deleted by a stupid brainless anti-spam algorithm :(

 Thanks for any help
 --
 Thierry.

 --
 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/d/optout.

  --
 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/d/optout.




-- 
Thierry.

-- 
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

Re: [android-developers] 7-Day Notification of Google Play Developer Term Violation

2014-09-18 Thread Thierry Legras
Thanks for the tip Dallas, but indeed this question just give as answer a
link to http://developer.android.com, no way to get human feedback there.

Thierry


2014-09-17 22:49 GMT+02:00 Dallas Singletary devdal...@gmail.com:

 Try this link
 https://support.google.com/googleplay/android-developer/troubleshooter/3055196
 select App Development Question worth a shot atleast
 On Sep 17, 2014 4:39 PM, Thierry Legras tleg...@gmail.com wrote:

 Good point but the next question si how :)
 I replied to the mail with no luck. Nowhere I could find any contact,
 just link to guidelines and good practises.
 So I just removed dupplicated keywords and I am now praying...

 Thierry.
 Le 17 sept. 2014 20:10, Dallas Singletary devdal...@gmail.com a
 écrit :

 Have you reached out to the Google Play Team? Maybe bring it to there
 attention for manual review?
 On Sep 15, 2014 4:57 AM, Thierry Legras tleg...@gmail.com wrote:


 Here we go, after 3 years with almost no change in my application
 description on Google Play I received the violation notification for my
 application
 https://play.google.com/store/apps/details?id=com.tlegras.freeboxrec
 (sorry only available in google play France)

 This is a notification that your application, Freebox Recorder, with
 package ID com.tlegras.freeboxrec, is currently in violation of our
 developer terms.
 *REASON FOR WARNING*: Violation of the spam
 https://play.google.com/about/developer-content-policy.html#spam 
 provisions
 of the Content Policy. Please refer to the spam policy help article
 https://support.google.com/googleplay/android-developer/answer/2985717 
 for
 more information.

- Do not engage in keyword stuffing by loading app descriptions
with keywords out of context


- Do not use irrelevant, misleading, or excessive keywords in apps
descriptions, titles, or metadata.


 It seems that Google anti-spam robots has gone crazy (why only now
 after all these years??) with the keywords Freebox and Free which are
 related to the name of the French Telecom operator Free and its set-top
 box Freebox that my application allows to control remotely. So these
 keywords are definitively NOT out of context, my application does not
 pretend anywhere to give anything for free or whatever of the kind.

 While waiting for the end of the countdown, I removed a few occurrences
 of Freebox in Google play description. Changing the package ID is really
 not an option for me as other applications are using mine, and anyway, come
 on, my application is controlling a device called Freebox so what would
 be the issue with freebox in the id???

 So, can anybody tell me if there is a way to contact a HUMAN at Google
 play team before my application may be deleted from Google Play, or at
 least how to get more precise feedback than this generic automatically
 generated mail.

 I am pretty upset by such mail after having supported a free ad-less
 revenue-less application stared 4.5/5 for so many year and seeing it could
 be deleted by a stupid brainless anti-spam algorithm :(

 Thanks for any help
 --
 Thierry.

 --
 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/d/optout.

  --
 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/d/optout.

  --
 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

Re: [android-developers] 7-Day Notification of Google Play Developer Term Violation

2014-09-17 Thread Thierry Legras
Good point but the next question si how :)
I replied to the mail with no luck. Nowhere I could find any contact, just
link to guidelines and good practises.
So I just removed dupplicated keywords and I am now praying...

Thierry.
Le 17 sept. 2014 20:10, Dallas Singletary devdal...@gmail.com a écrit :

 Have you reached out to the Google Play Team? Maybe bring it to there
 attention for manual review?
 On Sep 15, 2014 4:57 AM, Thierry Legras tleg...@gmail.com wrote:


 Here we go, after 3 years with almost no change in my application
 description on Google Play I received the violation notification for my
 application
 https://play.google.com/store/apps/details?id=com.tlegras.freeboxrec
 (sorry only available in google play France)

 This is a notification that your application, Freebox Recorder, with
 package ID com.tlegras.freeboxrec, is currently in violation of our
 developer terms.
 *REASON FOR WARNING*: Violation of the spam
 https://play.google.com/about/developer-content-policy.html#spam 
 provisions
 of the Content Policy. Please refer to the spam policy help article
 https://support.google.com/googleplay/android-developer/answer/2985717 for
 more information.

- Do not engage in keyword stuffing by loading app descriptions
with keywords out of context


- Do not use irrelevant, misleading, or excessive keywords in apps
descriptions, titles, or metadata.


 It seems that Google anti-spam robots has gone crazy (why only now after
 all these years??) with the keywords Freebox and Free which are related
 to the name of the French Telecom operator Free and its set-top box
 Freebox that my application allows to control remotely. So these keywords
 are definitively NOT out of context, my application does not pretend
 anywhere to give anything for free or whatever of the kind.

 While waiting for the end of the countdown, I removed a few occurrences
 of Freebox in Google play description. Changing the package ID is really
 not an option for me as other applications are using mine, and anyway, come
 on, my application is controlling a device called Freebox so what would
 be the issue with freebox in the id???

 So, can anybody tell me if there is a way to contact a HUMAN at Google
 play team before my application may be deleted from Google Play, or at
 least how to get more precise feedback than this generic automatically
 generated mail.

 I am pretty upset by such mail after having supported a free ad-less
 revenue-less application stared 4.5/5 for so many year and seeing it could
 be deleted by a stupid brainless anti-spam algorithm :(

 Thanks for any help
 --
 Thierry.

 --
 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/d/optout.

  --
 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/d/optout.


-- 
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/d/optout.


[android-developers] 7-Day Notification of Google Play Developer Term Violation

2014-09-15 Thread Thierry Legras
Here we go, after 3 years with almost no change in my application
description on Google Play I received the violation notification for my
application
https://play.google.com/store/apps/details?id=com.tlegras.freeboxrec (sorry
only available in google play France)

This is a notification that your application, Freebox Recorder, with
 package ID com.tlegras.freeboxrec, is currently in violation of our
 developer terms.
 *REASON FOR WARNING*: Violation of the spam
 https://play.google.com/about/developer-content-policy.html#spam provisions
 of the Content Policy. Please refer to the spam policy help article
 https://support.google.com/googleplay/android-developer/answer/2985717 for
 more information.

- Do not engage in keyword stuffing by loading app descriptions with
keywords out of context


- Do not use irrelevant, misleading, or excessive keywords in apps
descriptions, titles, or metadata.


It seems that Google anti-spam robots has gone crazy (why only now after
all these years??) with the keywords Freebox and Free which are related
to the name of the French Telecom operator Free and its set-top box
Freebox that my application allows to control remotely. So these keywords
are definitively NOT out of context, my application does not pretend
anywhere to give anything for free or whatever of the kind.

While waiting for the end of the countdown, I removed a few occurrences of
Freebox in Google play description. Changing the package ID is really not
an option for me as other applications are using mine, and anyway, come on,
my application is controlling a device called Freebox so what would be
the issue with freebox in the id???

So, can anybody tell me if there is a way to contact a HUMAN at Google play
team before my application may be deleted from Google Play, or at least how
to get more precise feedback than this generic automatically generated
mail.

I am pretty upset by such mail after having supported a free ad-less
revenue-less application stared 4.5/5 for so many year and seeing it could
be deleted by a stupid brainless anti-spam algorithm :(

Thanks for any help
-- 
Thierry.

-- 
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/d/optout.


[android-developers] Advice for a strategic game map

2012-11-10 Thread Thierry Legras
Hi,
I am starting the development of a strategy game. For that I would like to
develop an interactive galaxy map with objects (basically planets,
spaceships). Note this would NOT be a real time game, but a turn by turn
game.
What is the best way to start knowing I would like a typical mapview touch
controls (scroll, zoom) but of course with my own map content :)
- ViewGroup and I develop everything?
- Custom MapView?
- Some higher level android or google class
- third party open source toolkit

Any suggestion welcome
Thierry.

-- 
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] Re: android.text.format.DateFormat.format performance

2011-10-18 Thread Thierry Legras
Wow nice! I haven't tried JNI before as well and I could not imagine it
would be interesting for such small functions.

In my case though I will stick to Calendar use as the time spent for time
formating is now little enough compared to the remaining parts. Si I won't
gain significant in further optimization.


2011/10/18 Studio LFP studio@gmail.com

 Thanks for the update!

 I just sat down and put together a JNI routine that uses strftime in C and
 I took my formatting from 50%+ of the routine that was populating my view
 down to 0.2%.  I would call that a significant improvement! Here is the code
 I used:

  Java Class 

 public class JNIUtils
 {
 private static native String dateFormatJNI( String sFormat, long millis
 );

 static
 {
 System.loadLibrary( jniutils );
 }

 public static String dateFormat( String sFormat, long lTime )
 {
 return dateFormatJNI( sFormat, lTime );
 }
 }

  C File 

 #include jni.h
 #include time.h

 JNIEXPORT jstring JNICALL
 Java_com_company_project_jni_JNIUtils_dateFormatJNI( JNIEnv *env, jclass
 cls, jstring format, jlong millis )
 {
 time_t javaTime = millis/1000;
 struct tm * timeInfo;
 char buffer[32];
 const jbyte *str;

 str = (*env)-GetStringUTFChars( env, format, NULL );

 timeInfo = localtime( javaTime );
 strftime( buffer, 32, str, timeInfo );

 (*env)-ReleaseStringUTFChars( env, format, str );

 return (*env)-NewStringUTF( env, buffer );
 }

 I am new to JNI, so I'm not sure how clean this code is. I know C/C++, but
 I'm getting use to how you have to deal with the Java-to-C layers properly.
 Regardless, this runs about 250x (or more) faster than the built-in Java
 version.

 You may want to check this out if you feel like getting the NDK installed
 and configured to where you can build the libraries.


 Steven
 Studio LFP
 http://www.studio-lfp.com


 On Monday, October 17, 2011 5:35:52 PM UTC-5, tlegras wrote:

 I do confirm using Date is about 2x faster.
 But I tryed using Calendar as Date.getHours/Minutes etc. is deprecated.
 The good news is that is even faster: Almost 6x faster than my original
 which was using DateFormat.format

 Here is my code:
 private static Calendar sTmpCalendar = Calendar.getInstance();

  // convert timemilli to HH:mm string
 public static CharSequence Time2DisplayString(long timemilli) {
  sTmpCalendar.setTimeInMillis(**time);
  int hours = sTmpCalendar.get(Calendar.**HOUR_OF_DAY);
 int minutes = sTmpCalendar.get(Calendar.**MINUTE);
  return ((hours10)?0:)+hours+:+**((minutes10)?0:)+ minutes;
  }



 2011/10/14 Thierry Legras tle...@gmail.com


 Thanks Steven! I will try that.
 As Date.getHours() etc. methods are mentioned as deprecated. I will check
 with Calendar class as well if it is still faster than DateFormat.

 Thierry.


 2011/10/14 Studio LFP studi...@gmail.com

  It is slow and so is String.format(). I've been messing around with it
 a bit and here is a *rough *sample I tested:

 private static final String DATE_AM_PM[] = { am, pm };
 private static Date dFormat = new Date();
 private static int iHour, iAMPM;

 public static String formatDate( long lTimestamp )
 {
 dFormat.setTime( lTimestamp );
 iHour = dFormat.getHours();

 if( iHour == 0 ) { iHour = 12; iAMPM = 0; }
 if( iHour == 12 ) { iAMPM = 1; }
 else if( iHour  0  iHour  11 ) { iAMPM = 0; }
 else if( iHour  12  iHour  24 ) { iHour -= 12; iAMPM = 1; }

 return dFormat.getMonth() + / + dFormat.getDay() + / +
 (dFormat.getYear() + 1900) +   + iHour + : + dFormat.getMinutes() +
 DATE_AM_PM[ iAMPM ];
 }

 As I said, it is rough and doesn't even format the output fully.

 I tossed this in my application and used it a bit for a speed test and
 this takes up half the time as the formatting routines do. Funny thing is,
 it has nothing to do with the date part. It seems the formatters are using 
 a
 StringBuffer and some replace functions in the StringBuffer and that is 
 what
 is slowing it down.  I may try to work up a JNI replacement and see if some
 sprintf or fprintf action fix the issue but it may not because of the extra
 layer.

 Steven
 Studio LFP
 http://www.studio-lfp.com



 On Thursday, October 13, 2011 4:26:32 PM UTC-5, tlegras wrote:

 Hi,

 I am optimizing the critical parts of my code, and I coming to some
 ResourceCursorAdapter bindView method.
 Though the method is quite long, I saw on traceview that only 2 lines
 are taking 40% of the time in traceview; those are call to DateFormat:

 ((TextView)view.findViewById(**R**.id.EPG_list_item_hour)).**setTe**
 xt(
 android.text.format.**DateFormat**.format(kk:mm,**beginTimeMilli
 **) +  -  +
  android.text.format.**DateForm**at.format(kk:mm,**endTimeMilli*
 *));


 So just curious: Is there any more efficient way to transform a
 timeMillisecond time to a date string (in my case hour/minute)?

 Thierry.

  --
 You received this message because you are subscribed to the Google
 Groups Android

Re: [android-developers] Re: android.text.format.DateFormat.format performance

2011-10-17 Thread Thierry Legras
I do confirm using Date is about 2x faster.
But I tryed using Calendar as Date.getHours/Minutes etc. is deprecated. The
good news is that is even faster: Almost 6x faster than my original which
was using DateFormat.format

Here is my code:
private static Calendar sTmpCalendar = Calendar.getInstance();

 // convert timemilli to HH:mm string
public static CharSequence Time2DisplayString(long timemilli) {
 sTmpCalendar.setTimeInMillis(time);
 int hours = sTmpCalendar.get(Calendar.HOUR_OF_DAY);
int minutes = sTmpCalendar.get(Calendar.MINUTE);
 return ((hours10)?0:)+hours+:+((minutes10)?0:)+ minutes;
 }



2011/10/14 Thierry Legras tleg...@gmail.com


 Thanks Steven! I will try that.
 As Date.getHours() etc. methods are mentioned as deprecated. I will check
 with Calendar class as well if it is still faster than DateFormat.

 Thierry.


 2011/10/14 Studio LFP studio@gmail.com

 It is slow and so is String.format(). I've been messing around with it a
 bit and here is a *rough *sample I tested:

 private static final String DATE_AM_PM[] = { am, pm };
 private static Date dFormat = new Date();
 private static int iHour, iAMPM;

 public static String formatDate( long lTimestamp )
 {
 dFormat.setTime( lTimestamp );
 iHour = dFormat.getHours();

 if( iHour == 0 ) { iHour = 12; iAMPM = 0; }
 if( iHour == 12 ) { iAMPM = 1; }
 else if( iHour  0  iHour  11 ) { iAMPM = 0; }
 else if( iHour  12  iHour  24 ) { iHour -= 12; iAMPM = 1; }

 return dFormat.getMonth() + / + dFormat.getDay() + / +
 (dFormat.getYear() + 1900) +   + iHour + : + dFormat.getMinutes() +
 DATE_AM_PM[ iAMPM ];
 }

 As I said, it is rough and doesn't even format the output fully.

 I tossed this in my application and used it a bit for a speed test and
 this takes up half the time as the formatting routines do. Funny thing is,
 it has nothing to do with the date part. It seems the formatters are using a
 StringBuffer and some replace functions in the StringBuffer and that is what
 is slowing it down.  I may try to work up a JNI replacement and see if some
 sprintf or fprintf action fix the issue but it may not because of the extra
 layer.

 Steven
 Studio LFP
 http://www.studio-lfp.com



 On Thursday, October 13, 2011 4:26:32 PM UTC-5, tlegras wrote:

 Hi,

 I am optimizing the critical parts of my code, and I coming to some
 ResourceCursorAdapter bindView method.
 Though the method is quite long, I saw on traceview that only 2 lines are
 taking 40% of the time in traceview; those are call to DateFormat:

 ((TextView)view.findViewById(**R.id.EPG_list_item_hour)).**setText(
 android.text.format.**DateFormat.format(kk:mm,**beginTimeMilli) +
  -  +
 android.text.format.**DateFormat.format(kk:mm,**endTimeMilli));


 So just curious: Is there any more efficient way to transform a
 timeMillisecond time to a date string (in my case hour/minute)?

 Thierry.

  --
 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




 --
 Thierry.




-- 
Thierry.

-- 
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] Re: android.text.format.DateFormat.format performance

2011-10-14 Thread Thierry Legras
Thanks Steven! I will try that.
As Date.getHours() etc. methods are mentioned as deprecated. I will check
with Calendar class as well if it is still faster than DateFormat.

Thierry.


2011/10/14 Studio LFP studio@gmail.com

 It is slow and so is String.format(). I've been messing around with it a
 bit and here is a *rough *sample I tested:

 private static final String DATE_AM_PM[] = { am, pm };
 private static Date dFormat = new Date();
 private static int iHour, iAMPM;

 public static String formatDate( long lTimestamp )
 {
 dFormat.setTime( lTimestamp );
 iHour = dFormat.getHours();

 if( iHour == 0 ) { iHour = 12; iAMPM = 0; }
 if( iHour == 12 ) { iAMPM = 1; }
 else if( iHour  0  iHour  11 ) { iAMPM = 0; }
 else if( iHour  12  iHour  24 ) { iHour -= 12; iAMPM = 1; }

 return dFormat.getMonth() + / + dFormat.getDay() + / +
 (dFormat.getYear() + 1900) +   + iHour + : + dFormat.getMinutes() +
 DATE_AM_PM[ iAMPM ];
 }

 As I said, it is rough and doesn't even format the output fully.

 I tossed this in my application and used it a bit for a speed test and this
 takes up half the time as the formatting routines do. Funny thing is, it has
 nothing to do with the date part. It seems the formatters are using a
 StringBuffer and some replace functions in the StringBuffer and that is what
 is slowing it down.  I may try to work up a JNI replacement and see if some
 sprintf or fprintf action fix the issue but it may not because of the extra
 layer.

 Steven
 Studio LFP
 http://www.studio-lfp.com



 On Thursday, October 13, 2011 4:26:32 PM UTC-5, tlegras wrote:

 Hi,

 I am optimizing the critical parts of my code, and I coming to some
 ResourceCursorAdapter bindView method.
 Though the method is quite long, I saw on traceview that only 2 lines are
 taking 40% of the time in traceview; those are call to DateFormat:

 ((TextView)view.findViewById(**R.id.EPG_list_item_hour)).**setText(
 android.text.format.**DateFormat.format(kk:mm,**beginTimeMilli) + 
 -  +
 android.text.format.**DateFormat.format(kk:mm,**endTimeMilli));


 So just curious: Is there any more efficient way to transform a
 timeMillisecond time to a date string (in my case hour/minute)?

 Thierry.

  --
 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




-- 
Thierry.

-- 
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] Re: android.text.format.DateFormat.format performance

2011-10-14 Thread Thierry Legras
No I don't. Time as been converted from string to timemilli on a serveur for
efficiency, and I have to convert them back to String when I want to display
it.



2011/10/14 Zsolt Vasvari zvasv...@gmail.com

 Sure, if you don't care about localization issues.

 On Oct 14, 5:26 am, Thierry Legras tleg...@gmail.com wrote:
  Hi,
 
  I am optimizing the critical parts of my code, and I coming to some
  ResourceCursorAdapter bindView method.
  Though the method is quite long, I saw on traceview that only 2 lines are
  taking 40% of the time in traceview; those are call to DateFormat:
 
  ((TextView)view.findViewById(R.id.EPG_list_item_hour)).setText(
  android.text.format.DateFormat.format(kk:mm,beginTimeMilli) +  - 
 +
  android.text.format.DateFormat.format(kk:mm,endTimeMilli));
 
  So just curious: Is there any more efficient way to transform a
  timeMillisecond time to a date string (in my case hour/minute)?
 
  Thierry.

 --
 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




-- 
Thierry.

-- 
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] Re: Custom DialogPreference and PreferenceManager.setDefaultValues issue

2011-10-13 Thread Thierry Legras
Okay, I give up.
My preference default value will be copied in the preference access code as
well:

value = sharedPref.getInt(mykey,myDirtyHardcodedDefaultValue );


If ever someone has a better solution, it will be welcome :)

Thierry.


2011/10/11 Thierry Legras tleg...@gmail.com

 Hi Ibendlin,

 Thanks for helping me :)

 I don't think the problem is in SeekBarPreference.onSetInitialValue()
 function itself as it is never called (I have put a log in it to check).
 There is certainly an issue somewhere in my implementation; when
 setDefaultValues is called, only SeekBarPreference constructor is called.

 I was suspecting the xml, but I don't see any problem in it
 (android:defaultValue is set and android:persistent as well):

 com.tlegras.tools.SeekBarPreference
 android:key=preferences_epg_daytostore
 android:title=@string/preferences_epg_daytostore_title
 android:summary=@string/preferences_epg_daytostore_summary
 android:dialogMessage=Nombre de journées à télécharger.
 Attention, plus ce nombre est élevé, plus le chargement sera long et moins
 l'application sera réactive.
 android:text= jour(s)
 android:defaultValue=4
 android:max=5
 android:persistent=true
 /


 2011/10/11 lbendlin l...@bendlin.us

 it took me a few weeks to get that right.  here's my example for a boolean
 value. And yes, .setDefaultValues is actually working, despite what you may
 think :-/

@Override
 protected void onSetInitialValue(boolean restoreValue, Object
 defaultValue) {
 boolean temp = restoreValue ? getPersistedBoolean(false) :
 defaultValue.toString().equals(true) ? true : false;
 if (!restoreValue)
 persistBoolean(temp);
 this.oldValue = temp;
 }

  --
 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




 --
 Thierry.




-- 
Thierry.

-- 
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

[android-developers] android.text.format.DateFormat.format performance

2011-10-13 Thread Thierry Legras
Hi,

I am optimizing the critical parts of my code, and I coming to some
ResourceCursorAdapter bindView method.
Though the method is quite long, I saw on traceview that only 2 lines are
taking 40% of the time in traceview; those are call to DateFormat:

((TextView)view.findViewById(R.id.EPG_list_item_hour)).setText(
android.text.format.DateFormat.format(kk:mm,beginTimeMilli) +  -  +
android.text.format.DateFormat.format(kk:mm,endTimeMilli));


So just curious: Is there any more efficient way to transform a
timeMillisecond time to a date string (in my case hour/minute)?

Thierry.

-- 
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] Re: Custom DialogPreference and PreferenceManager.setDefaultValues issue

2011-10-11 Thread Thierry Legras
Hi Ibendlin,

Thanks for helping me :)

I don't think the problem is in SeekBarPreference.onSetInitialValue()
function itself as it is never called (I have put a log in it to check).
There is certainly an issue somewhere in my implementation; when
setDefaultValues is called, only SeekBarPreference constructor is called.

I was suspecting the xml, but I don't see any problem in it
(android:defaultValue is set and android:persistent as well):

com.tlegras.tools.SeekBarPreference
android:key=preferences_epg_daytostore
android:title=@string/preferences_epg_daytostore_title
android:summary=@string/preferences_epg_daytostore_summary
android:dialogMessage=Nombre de journées à télécharger.
Attention, plus ce nombre est élevé, plus le chargement sera long et moins
l'application sera réactive.
android:text= jour(s)
android:defaultValue=4
android:max=5
android:persistent=true
/


2011/10/11 lbendlin l...@bendlin.us

 it took me a few weeks to get that right.  here's my example for a boolean
 value. And yes, .setDefaultValues is actually working, despite what you may
 think :-/

@Override
 protected void onSetInitialValue(boolean restoreValue, Object
 defaultValue) {
 boolean temp = restoreValue ? getPersistedBoolean(false) :
 defaultValue.toString().equals(true) ? true : false;
 if (!restoreValue)
 persistBoolean(temp);
 this.oldValue = temp;
 }

  --
 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




-- 
Thierry.

-- 
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

[android-developers] Custom DialogPreference and PreferenceManager.setDefaultValues issue

2011-10-10 Thread Thierry Legras
Hi,

I have integrated a custom DialogPreference (SeekBarPreference from
http://android.hlidskialf.com/blog/code/android-seekbar-preference).

But I can't make the call to PreferenceManager.setDefaultValues correctly
initialize the preference to defaut value.

After looking at android source, I would expect
that onSetInitialValue(boolean restore, Object defaultValue) is called,
which is not the case.

Is there something missing so that PreferenceManager.setDefaultValues works
as expected on this preference?

Thanks for any help,
Thierry.

-- 
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

[android-developers] Re: AdapterView.OnItemSelectedListener.onItemSelected called with out of date position argument!

2011-03-02 Thread Thierry Legras
Okay, as I could not find a way to fix that smoothly, I just used a flag
ignoreNextOnItemSelected like described hereafter. Seems to me a dirty hack
:(

// called from another activity context
updateSpinnerSelection(int newposition) {

mPosition = newposition; // store it
mSpinner.setSelection(newposition);
ignoreNextOnItemSelected= true;
}

and

public void onItemSelected(AdapterView? arg0, View arg1, int position,
long rowid) {
if (ignoreNextOnItemSelected) {
// position might be outdate ?!?! just reapply mPosition
ignoreNextOnItemSelected = false;

// required
mSpinner.setSelection(mPosition);
} else {
mPosition = position;
... // do usual stuff
}
}



2011/2/25 Thierry Legras tleg...@gmail.com

 Hi,

 I have a strange behavior in a very specific case and wonder if the issue
 comes from my code or not.

 I have a TabActivity A with 2 tabs:
 - Tab 1 content is created as a view with a spinner in it
 - Tab 2 content is an activity B.

 I want at some point when Tab2 is selected to switch to Tab 1 and update
 spinner selection in it.

 Case 1)
 Tab 2 is selected, from Activity B context:

 activityA.updateSpinnerSelection(newposition);
 activityA.getTabHost().setCurrentTabByTag(tab1tag);

 later AdapterView.OnItemSelectedListener.onItemSelected is called with my
 newposition

 = so this *usually *works fine:

 Case 2)
 Tab 2 is selected, from Activity B context, but before doing the same
 things, if the users for some reason *first open a new acticity C on top
 of B (like preference screen) and close this activity C*, (so A and B are
 paused then resumed), then if I later try again the same things:

 activityA.updateSpinnerSelection(newposition);
 activityA.getTabHost().setCurrentTabByTag(tab1tag);

 so far so goog, but later
 AdapterView.OnItemSelectedListener.onItemSelected is called not with
 newposition as argument *but with the older position value*.


 I hope the description is clear.

 Did I missed something? or could this behavior dues to some bug in Android?


 Thanks for any help,
 --
 Thierry.




-- 
Thierry.

-- 
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] Re: AdapterView.OnItemSelectedListener.onItemSelected called with out of date position argument!

2011-03-02 Thread Thierry Legras
Hi Kostya,

Thanks to try to help to sort this out. unfortunatly I don't think this is
the cause in this case:

Activity A is a TabActivity that embeds activity B being in tab 2. Indeed
when I select tab 1 from activity B using setCurrentTabByTag , *Activity A
is already in running state* (I checked onResume was called earlier), so I
dont think onRestoreInstanceState will be called here.

Also I tried to place a breakpoint in onItemSelected, but this was no help,
it seems to be triggered using runOnUIThread() or similar.

But on the idea, you are probably close. It seems Android is trying to
restore an old state (spinner position). Either this is a bug, or I did not
correctly used setSelection. I am wondering if calling setPosition from
another activity is a safe pratice??

Thierry.


2011/3/2 Kostya Vasilyev kmans...@gmail.com

  Thierry,

 I think you are seeing interaction between the activity's
 onRestoreInstanceState and your setSelection.

 Should be pretty easy to check by overriding onRestoreInstanceState in
 ActivityA and/or the spinner and logging them - as well as your code that
 calls setSelection. Then you can re-run both scenarios from your original
 email and watch the exact sequence of events.

 -- Kostya

 02.03.2011 12:52, Thierry Legras пишет:


 Okay, as I could not find a way to fix that smoothly, I just used a flag
 ignoreNextOnItemSelected like described hereafter. Seems to me a dirty hack
 :(

 // called from another activity context
 updateSpinnerSelection(int newposition) {

 mPosition = newposition; // store it
 mSpinner.setSelection(newposition);
 ignoreNextOnItemSelected= true;
  }

 and

 public void onItemSelected(AdapterView? arg0, View arg1, int position,
 long rowid) {
 if (ignoreNextOnItemSelected) {
 // position might be outdate ?!?! just reapply mPosition
 ignoreNextOnItemSelected = false;

 // required
 mSpinner.setSelection(mPosition);
 } else {
 mPosition = position;
 ... // do usual stuff
 }
 }



 2011/2/25 Thierry Legras tleg...@gmail.com

 Hi,

 I have a strange behavior in a very specific case and wonder if the issue
 comes from my code or not.

 I have a TabActivity A with 2 tabs:
 - Tab 1 content is created as a view with a spinner in it
 - Tab 2 content is an activity B.

 I want at some point when Tab2 is selected to switch to Tab 1 and update
 spinner selection in it.

 Case 1)
 Tab 2 is selected, from Activity B context:

 activityA.updateSpinnerSelection(newposition);
 activityA.getTabHost().setCurrentTabByTag(tab1tag);

 later AdapterView.OnItemSelectedListener.onItemSelected is called with my
 newposition

 = so this *usually *works fine:

 Case 2)
 Tab 2 is selected, from Activity B context, but before doing the same
 things, if the users for some reason *first open a new acticity C on top
 of B (like preference screen) and close this activity C*, (so A and B are
 paused then resumed), then if I later try again the same things:

 activityA.updateSpinnerSelection(newposition);
 activityA.getTabHost().setCurrentTabByTag(tab1tag);

 so far so goog, but later
 AdapterView.OnItemSelectedListener.onItemSelected is called not with
 newposition as argument *but with the older position value*.


 I hope the description is clear.

 Did I missed something? or could this behavior dues to some bug in
 Android?

 Thanks for any help,
 --
 Thierry.




 --
 Thierry.
 --
 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



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




-- 
Thierry.

-- 
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] Re: AdapterView.OnItemSelectedListener.onItemSelected called with out of date position argument!

2011-03-02 Thread Thierry Legras
(putting again  CC to android as your answer seems quite usefull to android
community!)

Wow, thanks Kostya, I am impressed by this so detailed answer :). Answers
inline.


2011/3/2 Kostya Vasilyev kmans...@gmail.com

  Yes, if the activity isn't getting recreated, there won't be
 onRestoreInstanceState due to activity lifecycle. However it can still be
 called on the spinner view under certain conditions.

 For a cursor-based adapter, a managed cursor gets closed/reopened when the
 activity is paused / resumed, which causes the data set to be invalidated.

 AdapterView saves and restores selection state when that happens, by
 calling onSaveInstanceState / onRestoreInstanceState on itself: see
 AdapterDataSetObserver in AdapterView.java.

 Selection state *can* be delivered asynchronously, when an adapter view is
 undergoing a layout: see SelectionNotifier in the same source file. That's
 another possibility, that the spinner is undergoing a layout, and actually,
 AdapterView does request layout when the data set changes - so we're back to
 the question of, what kind of adapter are you using for the spinner?


Indeed, my spinner use a SimpleCursorAdapter. It seems in my case, the view
is underoing a layout after selected tab has been changed and the new view
containing the spinner needs to be drawn.




 A couple practical things to try that came to my mind are:

 1 - Post selection change from Activity B to tab1 asynchronously, using a
 Handler, after calling setCurrentTab;


If this works, this would be a neat solution as it will clearly keep
separated activites code.
I will definitively try that instead of my dirty flag trick, thanks :-)




 2 - If tab activities have onResume called when switched (I haven't used
 tabs, so don't know) ...


Not in my case as tab 1 content is not an activity but only a view. so when
I select tab 2, Activity A (which is the TabActivity) does not pause, but
stay actives.


 ... - you could set the new selection state as a member variable in tab1,
 and set the new selection in its onResume (probably after calling the base
 class).

 Finally, as a side note, this falls into the 0,01% of bugs for which it's
 very useful to have Android framework sources installed in the Eclipse
 debugger. I have detailed instructions in my blog, under tools - it recently
 really helped me resolve a similar bug caused by interference with that very
 same code in AdapterView.


Thanks again for this tip!
BTW your blog looks like a goldmine to me, I think I will re-use your IP
address EditText :)

Thierry.





 -- Kostya

 02.03.2011 14:21, Thierry Legras пишет:

 Hi Kostya,

 Thanks to try to help to sort this out. unfortunatly I don't think this is
 the cause in this case:

 Activity A is a TabActivity that embeds activity B being in tab 2. Indeed
 when I select tab 1 from activity B using setCurrentTabByTag , *Activity A
 is already in running state* (I checked onResume was called earlier), so I
 dont think onRestoreInstanceState will be called here.

 Also I tried to place a breakpoint in onItemSelected, but this was no help,
 it seems to be triggered using runOnUIThread() or similar.

 But on the idea, you are probably close. It seems Android is trying to
 restore an old state (spinner position). Either this is a bug, or I did not
 correctly used setSelection. I am wondering if calling setPosition from
 another activity is a safe pratice??

 Thierry.


 2011/3/2 Kostya Vasilyev kmans...@gmail.com

  Thierry,

 I think you are seeing interaction between the activity's
 onRestoreInstanceState and your setSelection.

 Should be pretty easy to check by overriding onRestoreInstanceState in
 ActivityA and/or the spinner and logging them - as well as your code that
 calls setSelection. Then you can re-run both scenarios from your original
 email and watch the exact sequence of events.

 -- Kostya

 02.03.2011 12:52, Thierry Legras пишет:


 Okay, as I could not find a way to fix that smoothly, I just used a flag
 ignoreNextOnItemSelected like described hereafter. Seems to me a dirty hack
 :(

 // called from another activity context
 updateSpinnerSelection(int newposition) {

 mPosition = newposition; // store it
 mSpinner.setSelection(newposition);
 ignoreNextOnItemSelected= true;
  }

 and

 public void onItemSelected(AdapterView? arg0, View arg1, int position,
 long rowid) {
 if (ignoreNextOnItemSelected) {
 // position might be outdate ?!?! just reapply mPosition
 ignoreNextOnItemSelected = false;

 // required
 mSpinner.setSelection(mPosition);
 } else {
 mPosition = position;
 ... // do usual stuff
 }
 }



 2011/2/25 Thierry Legras tleg...@gmail.com

 Hi,

 I have a strange behavior in a very specific case and wonder if the issue
 comes from my code or not.

 I have a TabActivity A with 2 tabs:
 - Tab 1 content is created as a view with a spinner in it
 - Tab 2 content is an activity B.

 I want

[android-developers] AdapterView.OnItemSelectedListener.onItemSelected called with out of date position argument!

2011-02-25 Thread Thierry Legras
Hi,

I have a strange behavior in a very specific case and wonder if the issue
comes from my code or not.

I have a TabActivity A with 2 tabs:
- Tab 1 content is created as a view with a spinner in it
- Tab 2 content is an activity B.

I want at some point when Tab2 is selected to switch to Tab 1 and update
spinner selection in it.

Case 1)
Tab 2 is selected, from Activity B context:

activityA.updateSpinnerSelection(newposition);
activityA.getTabHost().setCurrentTabByTag(tab1tag);

later AdapterView.OnItemSelectedListener.onItemSelected is called with my
newposition

= so this *usually *works fine:

Case 2)
Tab 2 is selected, from Activity B context, but before doing the same
things, if the users for some reason *first open a new acticity C on top of
B (like preference screen) and close this activity C*, (so A and B are
paused then resumed), then if I later try again the same things:

activityA.updateSpinnerSelection(newposition);
activityA.getTabHost().setCurrentTabByTag(tab1tag);

so far so goog, but later
AdapterView.OnItemSelectedListener.onItemSelected is called not with
newposition as argument *but with the older position value*.


I hope the description is clear.

Did I missed something? or could this behavior dues to some bug in Android?

Thanks for any help,
-- 
Thierry.

-- 
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

[android-developers] NullPointerException with Strange backtrace not going into my code

2011-02-23 Thread Thierry Legras
Hi,

I have got from time to time crash reports with such backtrace:

java.lang.NullPointerException
at
android.widget.PopupWindow$PopupViewContainer.dispatchKeyEvent(PopupWindow.java:1350)
at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2368)
at android.view.ViewRoot.deliverKeyEvent(ViewRoot.java:2328)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1647)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
at dalvik.system.NativeStart.main(Native Method)

Of course, I have never got such crash and no idea at all how to reproduce
this :((

Any one has the beginning of a clue to fix this??

Thanks for any help,
Thierry.

-- 
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] NullPointerException with Strange backtrace not going into my code

2011-02-23 Thread Thierry Legras
Hi Miguel,

Difficult to be 100% sure, but I don't think so, I have several asynctask
which updates my sqlite DB, but I update the GUI (changing cursor, etc.) in
onPostExecute. I will definitively do a code rereading anyway about that.

What makes me ask question is the PopupWindow in the backtrace. So far in my
code I only have a use of it from a quickaction implementation (check this
excellent one:
http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/) on
ListView items. I am wondering what happens if the item in listview is
deleted while quickaction popupwindow is open on it...



2011/2/23 Miguel Morales therevolti...@gmail.com

 Are you sure you're not messing with the UI from another thread?

 On Wed, Feb 23, 2011 at 2:39 AM, Thierry Legras tleg...@gmail.com wrote:

 Hi,

 I have got from time to time crash reports with such backtrace:

 java.lang.NullPointerException
 at
 android.widget.PopupWindow$PopupViewContainer.dispatchKeyEvent(PopupWindow.java:1350)
 at
 android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2368)
 at android.view.ViewRoot.deliverKeyEvent(ViewRoot.java:2328)
 at android.view.ViewRoot.handleMessage(ViewRoot.java:1647)
 at android.os.Handler.dispatchMessage(Handler.java:99)
 at android.os.Looper.loop(Looper.java:123)
 at android.app.ActivityThread.main(ActivityThread.java:4363)
 at java.lang.reflect.Method.invokeNative(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:521)
 at
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
 at dalvik.system.NativeStart.main(Native Method)

 Of course, I have never got such crash and no idea at all how to reproduce
 this :((

 Any one has the beginning of a clue to fix this??

 Thanks for any help,
 Thierry.

  --
 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




 --
 ~ Jeremiah:9:23-24
 Android 2D MMORPG: http://developingthedream.blogspot.com/,
 http://www.youtube.com/user/revoltingx

 --
 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




-- 
Thierry.

-- 
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] Re: How to stream video to android device over HTTP.

2011-01-24 Thread Thierry Legras
Thanks for feedback. Unfortunatly don't expect that 554 port will work on
any operator.
For instance in France, it seems Bouygues Telecom operator is blocking
incoming UDP from whatever port :(


2011/1/24 Anthoni anthoni.gard...@gmail.com

 Hi,

 Just wanted to add. First think that website is brilliant the
 traveldevel one and I found a lot of useful information there.

 Second, I am streaming to Mobile via RTSP but using hinted 3gp
 instead. We have a server with RTSP engine and that broadcasts the
 stream. I've found that it does not work for any other port apart from
 554 which is annoying, so still looking into that part. Other than
 that it all works like it should. Tested on two HTC phones so far.
 Need to test on more.

 Regards
 Anthoni

 On Jan 23, 10:30 pm, Thierry Legras tleg...@gmail.com wrote:
  After digging here and there for some times...  It turns out that it is
  completly possible to stream video over HTTP using MP4 muxing on Android,
 it
  is just that VLC software can't do that. So it seems there is no
 universal
  video streaming solution over 3G network with VLC as server and Android
  device as client :(
 
  Summary:
 
  Flash Video/HTTP: compatible with VLC, compatible with 3G network, not
  compatible with all android device
  MP4/HTTP: not compatible with VLC, OK with 3G network, OK with all
 android
  device
  MP4/RTSP: OK with VLC, not compatible with all 3G network, OK with all
  android device
  Sound only/HTTP: compatible with VLC, compatible with 3G network,
 compatible
  with all android device
 
  Thierry.
 
  2010/12/20 Thierry Legras tleg...@gmail.com
 
 
 
 
 
 
 
 
 
   Hi,
 
   I would like to stream video files to Android device, and intend to
   integrate playback in my application.
 
   I first tried to use flash video streaming, which works pretty nice on
 my
   HTC Hero which integrated flash player, but now on Floyo ROM it does
 not
   work any more. I guess HTC player is more complete than froyo 2.2 flash
   support.
 
   Then I tried to stream with VLC software using RTSP and it appears to
 work
   only with WiFi. On 3G, I see on the streaming PC that the stream is
 sent,
   but nothing is displayed on the Android device, whereas it works on
 WiFi.
   I found this very interesting page from VLC stream  convert
 developper
   which seems to show that this method is hazardous. Indeed the proposed
 test
   does not work at all on my device/operator.
  http://traveldevel.com/vlc-stream-convert/streaming-over-3g
 
   Finally I am trying to stream over HTTP. I made it work (WiFi AND 3G)
 for
   audio stream only, but when I try to stream audio+video, it does not
 work at
   all (WiFi nor 3G). Of course I set the bitrate and screen size to low
 so it
   is supposed to work at least in WiFi. I tried several combination
   codec/muxer with no luck.
 
   So anyone knows if it is ever possible to stream video over HTTP? if
 yes,
   any idea which codec/muxer is supposed to work?
 
   Or at least what is the most universal and/or recommanded way to stream
   video to android device??
 
   Thanks for any help,
 
   --
   Thierry.
 
  --
  Thierry.

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




-- 
Thierry.

-- 
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

[android-developers] Re: How to stream video to android device over HTTP.

2011-01-23 Thread Thierry Legras
After digging here and there for some times...  It turns out that it is
completly possible to stream video over HTTP using MP4 muxing on Android, it
is just that VLC software can't do that. So it seems there is no universal
video streaming solution over 3G network with VLC as server and Android
device as client :(

Summary:

Flash Video/HTTP: compatible with VLC, compatible with 3G network, not
compatible with all android device
MP4/HTTP: not compatible with VLC, OK with 3G network, OK with all android
device
MP4/RTSP: OK with VLC, not compatible with all 3G network, OK with all
android device
Sound only/HTTP: compatible with VLC, compatible with 3G network, compatible
with all android device

Thierry.


2010/12/20 Thierry Legras tleg...@gmail.com

 Hi,

 I would like to stream video files to Android device, and intend to
 integrate playback in my application.

 I first tried to use flash video streaming, which works pretty nice on my
 HTC Hero which integrated flash player, but now on Floyo ROM it does not
 work any more. I guess HTC player is more complete than froyo 2.2 flash
 support.

 Then I tried to stream with VLC software using RTSP and it appears to work
 only with WiFi. On 3G, I see on the streaming PC that the stream is sent,
 but nothing is displayed on the Android device, whereas it works on WiFi.
 I found this very interesting page from VLC stream  convert developper
 which seems to show that this method is hazardous. Indeed the proposed test
 does not work at all on my device/operator.
 http://traveldevel.com/vlc-stream-convert/streaming-over-3g

 Finally I am trying to stream over HTTP. I made it work (WiFi AND 3G) for
 audio stream only, but when I try to stream audio+video, it does not work at
 all (WiFi nor 3G). Of course I set the bitrate and screen size to low so it
 is supposed to work at least in WiFi. I tried several combination
 codec/muxer with no luck.

 So anyone knows if it is ever possible to stream video over HTTP? if yes,
 any idea which codec/muxer is supposed to work?

 Or at least what is the most universal and/or recommanded way to stream
 video to android device??

 Thanks for any help,

 --
 Thierry.




-- 
Thierry.

-- 
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

[android-developers] SQLiteDiskIOException in SQLiteDatabase.delete

2011-01-12 Thread Thierry Legras
Hi,

In my application, in very very rare cases, some users get this kind of
exception:

Caused by: android.database.sqlite.SQLiteDiskIOException: error code 10:
disk I/O error
at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
at
android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:66)
at
android.database.sqlite.SQLiteDatabase.delete(SQLiteDatabase.java:1362)
at
com.tlegras.freeboxrec.FBRBroadcastDBAdapter.deleteOldEntries(FBRBroadcastDBAdapter.java:194)
...

Indeed something similar than this one:
http://code.google.com/p/android/issues/detail?id=7260

Can any other reason than corrupted DB generate such exception? if no what
should i do in such cases? advise the user to try to uninstall and reinstall
the applications?

Thanks for any help,
Thierry.

-- 
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] How to stream video to android device over HTTP.

2010-12-21 Thread Thierry Legras
Hi,

Thanks for your answer. Well I did not tried a VideoView but the MediaPlayer
and a SurfaceView as given by ApiDemos. However I consider the code as good
as it works for RTSP stream on WiFi.

What kind of stream do you open from your VideoView? are you able to open
RTSP stream through 3G networks?

There must be a universal method that works on both WiFi and 3G; there are
so many applications like those weather applications that propose forecast
videos.

Thierry.

2010/12/20 andy zhao zxganga...@gmail.com

 Hi,
 I don't know which method or class you use to play the audio or video
 stream. I used VideoView class to do that successfully.

 2010/12/20 Thierry Legras tleg...@gmail.com

 Hi,

 I would like to stream video files to Android device, and intend to
 integrate playback in my application.

 I first tried to use flash video streaming, which works pretty nice on my
 HTC Hero which integrated flash player, but now on Floyo ROM it does not
 work any more. I guess HTC player is more complete than froyo 2.2 flash
 support.

 Then I tried to stream with VLC software using RTSP and it appears to work
 only with WiFi. On 3G, I see on the streaming PC that the stream is sent,
 but nothing is displayed on the Android device, whereas it works on WiFi.
 I found this very interesting page from VLC stream  convert developper
 which seems to show that this method is hazardous. Indeed the proposed test
 does not work at all on my device/operator.
 http://traveldevel.com/vlc-stream-convert/streaming-over-3g

 Finally I am trying to stream over HTTP. I made it work (WiFi AND 3G) for
 audio stream only, but when I try to stream audio+video, it does not work at
 all (WiFi nor 3G). Of course I set the bitrate and screen size to low so it
 is supposed to work at least in WiFi. I tried several combination
 codec/muxer with no luck.

 So anyone knows if it is ever possible to stream video over HTTP? if yes,
 any idea which codec/muxer is supposed to work?

 Or at least what is the most universal and/or recommanded way to stream
 video to android device??

 Thanks for any help,

 --
 Thierry.

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




-- 
Thierry.

-- 
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

[android-developers] How to stream video to android device over HTTP.

2010-12-20 Thread Thierry Legras
Hi,

I would like to stream video files to Android device, and intend to
integrate playback in my application.

I first tried to use flash video streaming, which works pretty nice on my
HTC Hero which integrated flash player, but now on Floyo ROM it does not
work any more. I guess HTC player is more complete than froyo 2.2 flash
support.

Then I tried to stream with VLC software using RTSP and it appears to work
only with WiFi. On 3G, I see on the streaming PC that the stream is sent,
but nothing is displayed on the Android device, whereas it works on WiFi.
I found this very interesting page from VLC stream  convert developper
which seems to show that this method is hazardous. Indeed the proposed test
does not work at all on my device/operator.
http://traveldevel.com/vlc-stream-convert/streaming-over-3g

Finally I am trying to stream over HTTP. I made it work (WiFi AND 3G) for
audio stream only, but when I try to stream audio+video, it does not work at
all (WiFi nor 3G). Of course I set the bitrate and screen size to low so it
is supposed to work at least in WiFi. I tried several combination
codec/muxer with no luck.

So anyone knows if it is ever possible to stream video over HTTP? if yes,
any idea which codec/muxer is supposed to work?

Or at least what is the most universal and/or recommanded way to stream
video to android device??

Thanks for any help,

-- 
Thierry.

-- 
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

[android-developers] Modularity: advises to develop an applicatin plugin that could access application Sqlite, preferences, ...

2010-11-15 Thread Thierry Legras
Hi,

I want to add a big feature to an application i am developping, but as this
feature interest few people and is quite independant from the main part, I
would like to put that in a seperate plugin application.

Does anyone knows any design patterns, snippets, reference examples about
such design?

In particular:
- that separate plugin application should be able to access some tables in
the main application DB. Is it possible to do that without broadcast
receiver?
- the main application uses a TabActivity: is it possible that a the
tabactivity instanciates an Intent Activity that is part of the plugin?
- does the plugin can access main application preferences (not sure this
would be necessary, but better to anticipate the question!)
- is it possible from the plugin to access main applications ressources?

At least the 2 first points are mandatory for me.
Thanks for any help,
Thierry.

-- 
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] Re: Adding separators to a ListView

2010-11-15 Thread Thierry Legras
Hi,

I found something that highlights Kostya solution including a trick to avoir
header to appear selected:

http://thebogles.com/blog/2010/02/section-headers-for-android-listviews/

This seems straightforward to follow ... except that i can't get previous
record. Unfortunately the isHeaderVisible(Cursor) method is not given :(
I tried to use Cursor.moveToPrevious(), but that crashes on subsequent
setViewValue call. I guessed I should not modify cursor within
setViewValue() and try to restore cursor position before leaving the method,
but that still crashes.
Any clue?

Thierry.

2010/11/15 Neilz neilhorn...@gmail.com

 Hi Mark.

 I've taken a look at this, and put together a quick sample based on
 your demo.

 It seems to me that you must have your list content already separated
 before adding them to the ListView. So, you add one Array, then you
 add a different View, then you add another Array.

 I can probably find a way to sort my data in this way, although I was
 hoping to add the view on the fly. My data is currently returned as
 one long List, and I don't know in advance where these separator views
 are going to go. I need to study the contents of my data as it's added
 to the View, and say Ah, here's some condition, add a separator view
 here. Does that make sense, and can this be done?

 Thanks.

 On Nov 11, 12:26 pm, Mark Murphy mmur...@commonsware.com wrote:
  On Thu, Nov 11, 2010 at 7:20 AM,Neilzneilhorn...@gmail.com wrote:
   Hi all. I have created a ListView from a collection of objects, using
   an ArrayAdaptor to set the items.
 
   The objects used to populate the list have a NAME field, and are
   sorted into alphabetical order, so ultimately the ListView is long
   list of names.
 
   I now want to make the list more user friendly. I'd like to add a
   separator for each letter of the alphabet, saying A, B etc. The
   separator could be one of the list items (non-clickable) or just a
   normal View.
 
   I'm just not sure how I can manipulate the ListView to achieve this,
   and would appreciate any help.
 
  It's not a question of the ListView, but of the ListAdapter. Your
  ListAdapter needs to:
 
  -- Override getViewTypeCount() to return 2
  -- Override getItemViewType() to return 0 for regular rows and 1 for
 headings
  -- Override getView() (or newView() and bindView() for CursorAdapter)
  and have it properly create the right rows and bind them
 
  This is somewhat of a pain.
 
  I have a MergeAdapter that can simplify it, but only where each
  section is its own adapter, with plain Views being interspersed:
 
  https://github.com/commonsguy/cwac-merge
 
  Creating a HeaderCursorAdapter that injects headings based on some
  rule (e.g., when the first letter of such-and-so column in the Cursor
  changes) is on my list of 18,000 things to do. Though anyone is
  welcome to go and beat me to writing it. :-)
 
  --
  Mark Murphy (a Commons Guy)http://commonsware.com|
 http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguyhttp://github.com/commonsguyhttp://commonsware.com/blog%7Chttp://twitter.com/commonsguy
 
  Android App Developer 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Thierry.

-- 
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] Re: Adding separators to a ListView

2010-11-15 Thread Thierry Legras
Could you please share the way you grab the previous row from within
setViewValue? :)

2010/11/15 Kostya Vasilyev kmans...@gmail.com

 Ok, so I had a cursor-based ListView laying around, and decided to try and
 practice what I preach :)

 Got it working in just a few minutes, actually.

 The second screenshot shows that there aren't any issues with trackpad
 based selection highlighting, at least on my Motorola Milestone.

 To prevent clickable headers, I set an empty click listener just on the
 view that shows group data (the blue one).

 No crashes, either - I scrolled up and down quite a bit.

 http://img-fotki.yandex.ru/get/4700/kman.0/0_5bc24_c4d124db_L

 http://img-fotki.yandex.ru/get/4400/kman.0/0_5bc25_20348bcf_L

 -- Kostya

 15.11.2010 18:50, Neilz пишет:

  Interesting solution thanks , and I've kind of got it working very
 quickly. Unfortunately the headers are still clickable when visible
 (as they're part of a list item), so it's not as clean a solution as
 the MergeAdapter - if I can get that working!

 On Nov 15, 3:10 pm, Thierry Legrastleg...@gmail.com  wrote:

 Hi,

 I found something that highlights Kostya solution including a trick to
 avoir
 header to appear selected:

 http://thebogles.com/blog/2010/02/section-headers-for-android-listviews/

 This seems straightforward to follow ... except that i can't get previous
 record. Unfortunately the isHeaderVisible(Cursor) method is not given :(
 I tried to use Cursor.moveToPrevious(), but that crashes on subsequent
 setViewValue call. I guessed I should not modify cursor within
 setViewValue() and try to restore cursor position before leaving the
 method,
 but that still crashes.
 Any clue?

 Thierry.

 2010/11/15 Neilzneilhorn...@gmail.com



 --
 Kostya Vasilyev -- WiFi Manager + pretty widget --
 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+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Thierry.

-- 
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] Modularity: advises to develop an applicatin plugin that could access application Sqlite, preferences, ...

2010-11-15 Thread Thierry Legras
Thanks TreKing. This seems a very good start. I will try that.

Thierry.


2010/11/15 TreKing treking...@gmail.com

 On Mon, Nov 15, 2010 at 5:09 AM, Thierry Legras tleg...@gmail.com wrote:

 - that separate plugin application should be able to access some tables in
 the main application DB. Is it possible to do that without broadcast
 receiver?


 Look into ContentProvider.


 - the main application uses a TabActivity: is it possible that a the
 tabactivity instanciates an Intent Activity that is part of the plugin?


 Not sure what an Intent Activity is, but it's possible for the
 TabActivity to launch an intent that triggers the plugin, sure.


 - does the plugin can access main application preferences (not sure this
 would be necessary, but better to anticipate the question!)


 Probably, but unnecessary. Look at ContentProvider again.


  - is it possible from the plugin to access main applications ressources?


 No idea.


 -
 TreKing http://sites.google.com/site/rezmobileapps/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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Thierry.

-- 
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] Re: sqlite

2010-10-29 Thread Thierry Legras
That certainly works, but that might double the processing time, doesn't it?

2010/10/28 Bret Foreman bret.fore...@gmail.com

 Do an update and check how many rows got updated. If 0, then insert a
 new row. If 1, do nothing. If more than 1, throw an exception.

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




-- 
Thierry.

-- 
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] sqlite

2010-10-28 Thread Thierry Legras
Hi Henridk,

I have the same issue and I think that can not be solved with insert
facility which is only for basic usage. Instead we have to use query or
rawquery in such way:
http://stackoverflow.com/questions/531035/how-to-do-if-not-exists-in-sqliteI
have not tried it yet, wut will soon do.

Hope this helps,
Thierry.


2010/10/17 Hendrik Greving fourhend...@gmail.com

  I'd like to have a sqlite table with rows of 4 entries: a row id, a
 string and 2 integers and possibly more data later. I want the string to be
 unique. What's the easiest way to write an adapter that insert new rows with
 automatically replacing if the string already exists? Does 
 DatabaseUtils.InsertHelper
 help? What is this for actually? How can I use CONFLICT_REPLACE? I could
 probably get it working by making a query and then delete and inserting or
 something like that, but I'm sure there is a better way.

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




-- 
Thierry.

-- 
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] Re: Maintaining Aspect Ratio of Background Image

2010-09-17 Thread Thierry Legras
Thanks Bret. Will do something like that.

I hope Android will have more options to define a background with
multiplication of terminals and upcoming pads.

Thierry.


2010/9/17 Bret Foreman bret.fore...@gmail.com

 I made a landscape and a portrait version of my background image and
 designed them both to look ok (not great but ok) when squished to
 square. And square is the worst case unless some particular phone
 implementation is completely illogical.

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




-- 
Thierry.

-- 
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] Re: Maintaining Aspect Ratio of Background Image

2010-09-16 Thread Thierry Legras
Hi,

I have the same issue. Indeed it seems quite a common request without any
easy solution.
Anyone has a code snippet based on Frank suggestion (or other solution)?

Thanks for any help,
Thierry.

2010/7/7 Daniel Lew danle...@gmail.com

 I hadn't considered that, but then you can't reference the image in
 the theme (which allows the background to load faster).  I might give
 that a shot, though.

 -Daniel

 On Jul 6, 9:17 pm, Frank Weiss fewe...@gmail.com wrote:
  No worries.
 
  16x9 (a la Droid) is probably the most extreme screen aspect ratio
  you'll ever encounter in an Android device. Have you considered
  creating a scaled and cropped image on the fly the first time the app
  is run and caching that on the SD card?

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




-- 
Thierry.

-- 
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] Problem in SimpleDateFormat MMM return month number

2010-08-06 Thread Thierry Legras
Thanks for this workaround that shoud be acceptable for my application which
is useful only france!
I fear this kind of bug has few chances to be fixed in htc desire firmware
as updates are rare and monolythics.
Thierry.

Le 5 août 2010 14:16, { Devdroid } webnet.andr...@gmail.com a écrit :

On 3 August 2010 13:30, Mark Murphy mmur...@commonsware.com wrote:
 We got same problem on Desir...
Code is is quite simple.

Date date = 

SimpleDateFormat formatter = new SimpleDateFormat();

formatter.applyLocalizedPattern(  );
 = formatter.format( date );

the issue is with , EEE,  and MMM (in general all localised)

But what I now spotted, that this code no longer works on 1.5
emulator, even it worked yesterday. Quite impressive - we will
investigate the culprit.

Work around is simple, just instance SimpleDateFormat with specified
locale (i.e. SimpleDateFomat(, Locale.) but this is not what
shall be done in the first place. Anyone else facing this?


-- 
You received this message because you are subscribed to the Google
Groups Android Developers ...

-- 
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] Problem in SimpleDateFormat MMM return month number

2010-08-02 Thread Thierry Legras
Hi Sasikumar,

Could you find a solution to this problem?
I have been reported same issue on HTC Desire 2.2 new update and also
on some custom ROM.
The format i use is this one:

final static SimpleDateFormat sDisplayDayFormat = new
SimpleDateFormat( d M);

and later set it in a textvierw like this:

tv.setText(sDisplayDayFormat.format(someDate))

Instead of day and month name, i got 2 numbers (obviously day number
in week, and month number in year)

Thanks,
Thierry.


2010/4/30, Sasikumar.S sasikumar.it1...@gmail.com:
 Hi,,

 when we are using simpledateformat MMM it should return month abbrevation.
 Example :- If it is a june month it should return jun.
 But in my program it returns 6 . That is month number.
 I created my program 3 days before. Till today morning i did not got any
 error in that.
 Today morning only i faced this problem .
 I don't know why?..
 Any one faced this problem..

 --
 Thanks  Regards
 Sasikumar.S

 --
 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


-- 
Thierry.

-- 
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


[android-developers] Re: How to change TabWidget default grey color

2010-07-22 Thread Thierry Legras
Self answering :)

As far as I could read (have not tried it yet),
tabHost.getChildTabViewAt(int pos).setBackgroundColor(int resid) should do
it (Donut and later)

Thierry.


2010/7/18 Thierry Legras tleg...@gmail.com

 Hi,

 What is the supported way to set tabwidget color? I tried this:

 tabHost.getTabWidget().setBackgroundColor(somecolor)

 It does what i want on 1.5  1.6 device e.g. it changes the color of he
 space between tabs *and also *the tabs color.
 On 2.1, it only changes the color of the space behind the tabs.

 Any clue?

 Cheers,
 Thierry.




-- 
Thierry.

-- 
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

[android-developers] How to change TabWidget default grey color

2010-07-18 Thread Thierry Legras
Hi,

What is the supported way to set tabwidget color? I tried this:

tabHost.getTabWidget().setBackgroundColor(somecolor)

It does what i want on 1.5  1.6 device e.g. it changes the color of he
space between tabs *and also *the tabs color.
On 2.1, it only changes the color of the space behind the tabs.

Any clue?

Cheers,
Thierry.

-- 
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] Re: Change background after an Orientation change

2010-06-24 Thread Thierry Legras
I have the similar issue, the answer is interesting but i am wondering if i
can avoid specifying an alternate landscape layout just for that in my case:
indeed i don't want to have 2 different background pictures for
horizontal/vertical layout but just to fit to screen with height/width ratio
preserved and to crop what can not fit in the screen but default behaviour
is to shrink without preserving aspect ratio.

Anyway to tune that? Or at least maybe using an imageview in the background
would avoir replicate the layout just for that?

Thierry.

2010/6/10 Kumar Bibek coomar@gmail.com

 Sure, you have to create a different layout file for the landscape
 mode with a different background image in the layout-land folder.

 Try searching for it in the docs and you will get an idea on what and
 how to do it.

 http://tech-droid.blogspot.com/2009/10/orientation-independent-applications.html

 Thanks and Regards,
 Kumar Bibek
 http://tech-droid.blogspot.com

 On Jun 9, 1:08 am, ChadS cspren...@osthoff.com wrote:
  I have an image set as my background and when it is vertical, the
  image looks fine.  However, when the orentation is changed, the image
  get streched out.  If there a way that I can change the image based on
  the orentation of the device?

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




-- 
Thierry.

-- 
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] Re: Change background after an Orientation change

2010-06-24 Thread Thierry Legras
argggh, the layout-land folder does not work. i guess it is because i have
added android:configChanges=orientation in my manifest. ok i had better
reread this article from the beginning twice :-|
http://www.androidguys.com/2008/10/14/rotational-forceson-your-android-app/


2010/6/24 Thierry Legras tleg...@gmail.com


 I have the similar issue, the answer is interesting but i am wondering if i
 can avoid specifying an alternate landscape layout just for that in my case:
 indeed i don't want to have 2 different background pictures for
 horizontal/vertical layout but just to fit to screen with height/width ratio
 preserved and to crop what can not fit in the screen but default behaviour
 is to shrink without preserving aspect ratio.

 Anyway to tune that? Or at least maybe using an imageview in the background
 would avoir replicate the layout just for that?

 Thierry.

 2010/6/10 Kumar Bibek coomar@gmail.com

 Sure, you have to create a different layout file for the landscape

 mode with a different background image in the layout-land folder.

 Try searching for it in the docs and you will get an idea on what and
 how to do it.

 http://tech-droid.blogspot.com/2009/10/orientation-independent-applications.html

 Thanks and Regards,
 Kumar Bibek
 http://tech-droid.blogspot.com

 On Jun 9, 1:08 am, ChadS cspren...@osthoff.com wrote:
  I have an image set as my background and when it is vertical, the
  image looks fine.  However, when the orentation is changed, the image
  get streched out.  If there a way that I can change the image based on
  the orentation of the device?

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




 --
 Thierry.




-- 
Thierry.

-- 
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

[android-developers] Activity within TabActivity: onResume not always called when tab selected?

2010-06-13 Thread Thierry Legras
Hi,

I have a TabActivity with 3 tabs:
- tab A is created with a TabContentFactory,
- tabs B  C are created as Activity.

When I switch from B to C, B activity is resumed (onResume called). But when
i switch from A to B, onResume is NOT called.
Unfortunately i need B to be aware that it has been selected. How can B
activity knows that i has just been selected?

Any clue?
Thanks for any help.
-- 
Thierry.

-- 
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

[android-developers] Re: Activity within TabActivity: onResume not always called when tab selected?

2010-06-13 Thread Thierry Legras
Maybe I have found something:

From TabActivity, set a OnTabChangedListener,
then the listener is called:

String tabTag = getTabHost().getCurrentTabTag();
if tabTag.isEqual(TAB_B) {
  MyBActivity bActivity = (MyBActivity
)getLocalActivityManager().getActivity(tabTag);
  bActivity-refreshFromDB(); //
}

I will try that.

Thierry.


2010/6/13 Thierry Legras tleg...@gmail.com

 Hi,

 I have a TabActivity with 3 tabs:
 - tab A is created with a TabContentFactory,
 - tabs B  C are created as Activity.

 When I switch from B to C, B activity is resumed (onResume called). But
 when i switch from A to B, onResume is NOT called.
 Unfortunately i need B to be aware that it has been selected. How can B
 activity knows that i has just been selected?

 Any clue?
 Thanks for any help.
 --
 Thierry.




-- 
Thierry.

-- 
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

[android-developers] Re: Activity within TabActivity: onResume not always called when tab selected?

2010-06-13 Thread Thierry Legras
It works. The exact code is:

public void onTabChanged(String tabId) {
if(TAG_B.equals(tabId)) {
MyBActivity bActivity = (MyBActivity
)getLocalActivityManager().getActivity(tabId);
bActivity.refreshFromDB();
}
}


However it is a bit strange that onResume is not called. It would be a much
nicer solution.

Thierry.




2010/6/13 Thierry Legras tleg...@gmail.com

 Maybe I have found something:

 From TabActivity, set a OnTabChangedListener,
 then the listener is called:

 String tabTag = getTabHost().getCurrentTabTag();
 if tabTag.isEqual(TAB_B) {
   MyBActivity bActivity = (MyBActivity
 )getLocalActivityManager().getActivity(tabTag);
   bActivity-refreshFromDB(); //
 }

 I will try that.

 Thierry.


 2010/6/13 Thierry Legras tleg...@gmail.com

 Hi,

 I have a TabActivity with 3 tabs:
 - tab A is created with a TabContentFactory,
 - tabs B  C are created as Activity.

 When I switch from B to C, B activity is resumed (onResume called). But
 when i switch from A to B, onResume is NOT called.
 Unfortunately i need B to be aware that it has been selected. How can B
 activity knows that i has just been selected?

 Any clue?
 Thanks for any help.
 --
 Thierry.




 --
 Thierry.




-- 
Thierry.

-- 
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] Re: How can i vertically align items in RelativeLayout?

2010-06-10 Thread Thierry Legras
Hi Kumar,

Thanks for your help.
Indeed no, they are not below one another but on an horizontal line like
this:

| ImaveView |[TextView][EditText]
| ImaveView |
| ImaveView |

And basically i want to do this:

| ImaveView |
| ImaveView |[TextView][EditText]
| ImaveView |

(there is only one ImaveView!)

Thierry.



2010/6/10 Kumar Bibek coomar@gmail.com

 If you want the views to be below one another, you should be using
 android:layout_below and not android:layout_toRightOf.

 To align them, use android:layout_alignLeft, or alignRight etc.

 Thanks and Regards,
 Kumar Bibek
 http://tech-droid.blogspot.com

 On Jun 10, 3:00 am, Thierry Legras tleg...@gmail.com wrote:
  Hi,
 
  As i am facing limitation of layout depth in my application, i am
 replacing
  some LinearLayout with RelativeLayout.
  However i am stopped by a supposely very simple issue (but apparantly
  without clean solution regarding thathttp://
 stackoverflow.com/questions/1499555/android-layout-centering-i...,
  nor in the ApiDemos sample where RelativeLayout are too simple):
 
  How can i align vertically 3 items (in a simple way!) which are on a
  horizontal line with RelativeLayout without ???
 
  does not seem to have any effect at all.
 
  Here is the xml; in this example i would like an icon at left (fixed
 width),
  a text label in the middle (fixed width) and an edit text on the right
  (remaining space). the problem is that the TextView seems to ignore the
  parameter android:layout_gravity=center_vertical, and seems to be top
  aligned with parent
 
  ?xml version=1.0 encoding=utf-8?
  RelativeLayout
  xmlns:android=http://schemas.android.com/apk/res/android;
  android:layout_height=wrap_content
 android:layout_width=fill_parent
  
  ImageView
  android:id=@+id/Add_ImageView_name
  android:layout_width=wrap_content
  android:layout_height=wrap_content
  android:layout_gravity=center_vertical
  android:maxWidth=35dip
  android:adjustViewBounds=true
  android:scaleType=fitXY
  android:src=@android:drawable/ic_menu_edit
  /
  TextView
  android:id=@+id/Add_TextView_name
  android:text=blabla
  android:layout_toRightOf=@+id/Add_ImageView_name
  android:layout_gravity=center_vertical
  android:layout_width=50dip
  android:layout_height=wrap_content
  /
  EditText
  android:id=@+id/Add_EditText_name
  android:text=sometext
  android:layout_toRightOf=@+id/Add_TextView_name
  android:layout_alignBaseline=@+id/Add_TextView_name
  android:layout_alignParentRight=true
  android:layout_width=wrap_content
  android:layout_height=wrap_content
  /
  /RelativeLayout
 
  Of course i can use marginTop/Bottom and alignTop/Bottom on each single
 item
  but that's not very clean :(
 
  Any idea?
 
  --
  Thierry.

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




-- 
Thierry.

-- 
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] StackOverflowError in UI redraw

2010-06-10 Thread Thierry Legras
Ok, i give up, I tried everything i could to reduce layers, but i am only as
few as 5 so far :(( Seems to me impossible to do less, see screenshot
showing my current layout
herehttp://7121106850168047486-a-1802744773732722657-s-sites.googlegroups.com/site/freeboxrecorder/project-updates/version160/fbr-1.6.0-programmer.png?attachauth=ANoY7cp6uSqcBGdi7yv_N_LjNb8PoaAwQRo2RcTVa1t0fYhweE6OgZ4so6QJobafkJTg44PSz_en4RyW8vmvQ9rQF9e-yDEk5rTm4l1TfJ8FHZRna3u3Ar3A4BGXrzkn1afW0fol1xHV4gLyjZNAS4znA3zzTq6ewGYdQ0e5ul1BwYoZzMPFwtLi0rzF5h36gOnu8wXR9tnREkqvb9MowwxuCNU3qiY3t-6vpDHVky5WzfKgLk2VahKacMqe8OSW00NEz-Q9o-Bsattredirects=0

With 5 layers, my application crashes randomly apparently when i try to add
a background on top level layout. Even if i remove this background, i am not
sure it will not crash because of something else. I saw for instance that
getTabHost().setBackgroundColor(Color.BLACK) that i just tried in
TabActivity also engenders crashes.

My conclusion is that TabHost with activities-in-tabs is just too limited
and seeing this unpredictable behaviour i think we can consider this as a
bug.

The only valid long term solution for me is to change all my application to
views-in-tabs approach thought i will require me a lot of rework.

This huge limitation should be clearly stated in the documentation and
ApiDemos sample because it is something that really should be taken into
account before developping an application.

Thanks everybody who tried to help me on this subject.
Thierry.


2010/6/7 Mark Murphy mmur...@commonsware.com

 Thierry Legras wrote:
  I am facing rare StackOverflowError in my application during UI redraw.
  Does it mean memory is exhausted?

 It means that stack space is exhausted.

  How can i fix this?

 Your UI probably has too many layers in its hierarchy. Run the
 hierarchyviewer program and examine the chart showing your ViewGroups
 and what they all contain. Try to eliminate some layers (e.g., replace
 nested LinearLayouts with a single RelativeLayout, get rid of
 activities-in-tabs and switch to views-in-tabs).

  And finally how
  can i be sure the issue will be definitevly fixed??

 My very rough rule of thumb:

 -- If your hierarchy has 10 layers, you should have no problem
 -- If your hierarchy has 10-14 layers, I get nervous
 -- If your hierarchy has =15 layers, it's gonna blow up sometimes

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

 _Android Programming Tutorials_ Version 2.0 Available!

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




-- 
Thierry.

-- 
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] Re: StackOverflowError in UI redraw

2010-06-09 Thread Thierry Legras
 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.drawChild(ViewGroup.java:1538)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.View.draw(View.java:5841)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.widget.FrameLayout.draw(FrameLayout.java:352)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1892)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewRoot.draw(ViewRoot.java:1237)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewRoot.performTraversals(ViewRoot.java:1045)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.view.ViewRoot.handleMessage(ViewRoot.java:1504)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.os.Handler.dispatchMessage(Handler.java:99)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.os.Looper.loop(Looper.java:123)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
android.app.ActivityThread.main(ActivityThread.java:3948)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
java.lang.reflect.Method.invokeNative(Native Method)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
java.lang.reflect.Method.invoke(Method.java:521)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
06-09 18:59:42.597: ERROR/AndroidRuntime(3992): at
dalvik.system.NativeStart.main(Native Method)


2010/6/9 Zsolt Vasvari zvasv...@gmail.com

 You are using a CharSequence, I see that from your stack trace.

 I have a similar modularity issue as you do.  Unfortunately, one of my
 in-tab activity is also used standalone, so it's not most practical to
 make it a View.  It's possible, but would involve some code
 duplication.  Luckily, for me, removing a couple of layers combined
 with the .toString() trick was enough to prevent the crash on 1.5.


 On Jun 8, 3:45 pm, Thierry Legras tleg...@gmail.com wrote:LuLu
  Thanks all for your help.
 
  Indeed, i am using Tabs with activities! I don't like the idea to switch
 to
  views-in-tabs design :( i found that the activities-in-tab approach
 allows
  to have a better modularity as my tabs are managing different data. Also
 tab
  content does not need to be initialized as long as the tab is not
 selected.
 
  I am first trying to follow your advice to pass only string in setText,
 and
  found only one use of CharSequence:
 
  setText(getText(aResID) + anotherString)
 
  Does toString() will help here? I admit it is not clear to me what
 happens
  when a String is added to a CharSequence.
 
  Anothing that might help, at some time i want to switch from one tab to
  another. So far i made a little hack: i started a new instance of my
  tabactivity on top (with target tab selected), and finish the current
  activity. I noticed the crashes often happens after that. Maybe changing
  that design will also help to reduce stackoverflow risks.
 
  Thierry.
 
  2010/6/8 Zsolt Vasvari zvasv...@gmail.com
 
 
 
 
 
   Are you using the tab widget by any chance?  Because adding activities
   inside tabs will take up at least 5 layers in your UI hierarchy.  I am
   struggling with the same issue which only crashes on 1.5, 1.6+ is
   fine.
 
   On Jun 7, 9:16 pm, Thierry Legras tleg...@gmail.com wrote:
Hi,
 
I am facing rare StackOverflowError in my application during UI
 redraw.
   Does
it mean memory is exhausted? How can i fix this? And finally how can
 i be
sure the issue will be definitevly fixed??
 
Any advice would be welcome :)
Thierry.
 
Here is the backtrace:
 
06-07 15:11:20.318 E/AndroidRuntime(22775):
 java.lang.StackOverflowError
06-07 15:11:20.318 E/AndroidRuntime(22775): at android.text.method.
 
  
 ReplacementTransformationMethod$ReplacementCharSequence.getChars(Replacemen­­tTransformationMethod.java:151)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.TextUtils.getChars(TextUtils.java:69)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.Layout$Ellipsizer.getChars(Layout.java:1778)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.TextUtils.getChars(TextUtils.java:69)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.graphics.Paint.measureText(Paint.java:1016)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.Styled.each(Styled.java:124)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.Styled.foreach(Styled.java:249)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.Styled.measureText(Styled.java:371)
06-07 15:11:20.318 E/AndroidRuntime(22775

[android-developers] How can i vertically align items in RelativeLayout?

2010-06-09 Thread Thierry Legras
Hi,

As i am facing limitation of layout depth in my application, i am replacing
some LinearLayout with RelativeLayout.
However i am stopped by a supposely very simple issue (but apparantly
without clean solution regarding that
http://stackoverflow.com/questions/1499555/android-layout-centering-in-relativelayout-for-custom-listview,
nor in the ApiDemos sample where RelativeLayout are too simple):

How can i align vertically 3 items (in a simple way!) which are on a
horizontal line with RelativeLayout without ???

does not seem to have any effect at all.

Here is the xml; in this example i would like an icon at left (fixed width),
a text label in the middle (fixed width) and an edit text on the right
(remaining space). the problem is that the TextView seems to ignore the
parameter android:layout_gravity=center_vertical, and seems to be top
aligned with parent

?xml version=1.0 encoding=utf-8?
RelativeLayout
xmlns:android=http://schemas.android.com/apk/res/android;
android:layout_height=wrap_content android:layout_width=fill_parent

ImageView
android:id=@+id/Add_ImageView_name
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_gravity=center_vertical
android:maxWidth=35dip
android:adjustViewBounds=true
android:scaleType=fitXY
android:src=@android:drawable/ic_menu_edit
/
TextView
android:id=@+id/Add_TextView_name
android:text=blabla
android:layout_toRightOf=@+id/Add_ImageView_name
android:layout_gravity=center_vertical
android:layout_width=50dip
android:layout_height=wrap_content
/
EditText
android:id=@+id/Add_EditText_name
android:text=sometext
android:layout_toRightOf=@+id/Add_TextView_name
android:layout_alignBaseline=@+id/Add_TextView_name
android:layout_alignParentRight=true
android:layout_width=wrap_content
android:layout_height=wrap_content
/
/RelativeLayout


Of course i can use marginTop/Bottom and alignTop/Bottom on each single item
but that's not very clean :(

Any idea?

-- 
Thierry.

-- 
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] Re: StackOverflowError in UI redraw

2010-06-08 Thread Thierry Legras
Thanks all for your help.

Indeed, i am using Tabs with activities! I don't like the idea to switch to
views-in-tabs design :( i found that the activities-in-tab approach allows
to have a better modularity as my tabs are managing different data. Also tab
content does not need to be initialized as long as the tab is not selected.

I am first trying to follow your advice to pass only string in setText, and
found only one use of CharSequence:

setText(getText(aResID) + anotherString)

Does toString() will help here? I admit it is not clear to me what happens
when a String is added to a CharSequence.

Anothing that might help, at some time i want to switch from one tab to
another. So far i made a little hack: i started a new instance of my
tabactivity on top (with target tab selected), and finish the current
activity. I noticed the crashes often happens after that. Maybe changing
that design will also help to reduce stackoverflow risks.

Thierry.


2010/6/8 Zsolt Vasvari zvasv...@gmail.com

 Are you using the tab widget by any chance?  Because adding activities
 inside tabs will take up at least 5 layers in your UI hierarchy.  I am
 struggling with the same issue which only crashes on 1.5, 1.6+ is
 fine.

 On Jun 7, 9:16 pm, Thierry Legras tleg...@gmail.com wrote:
  Hi,
 
  I am facing rare StackOverflowError in my application during UI redraw.
 Does
  it mean memory is exhausted? How can i fix this? And finally how can i be
  sure the issue will be definitevly fixed??
 
  Any advice would be welcome :)
  Thierry.
 
  Here is the backtrace:
 
  06-07 15:11:20.318 E/AndroidRuntime(22775): java.lang.StackOverflowError
  06-07 15:11:20.318 E/AndroidRuntime(22775): at android.text.method.
 
 
 ReplacementTransformationMethod$ReplacementCharSequence.getChars(Replacemen­tTransformationMethod.java:151)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.text.TextUtils.getChars(TextUtils.java:69)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.text.Layout$Ellipsizer.getChars(Layout.java:1778)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.text.TextUtils.getChars(TextUtils.java:69)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.graphics.Paint.measureText(Paint.java:1016)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.text.Styled.each(Styled.java:124)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.text.Styled.foreach(Styled.java:249)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.text.Styled.measureText(Styled.java:371)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.text.Layout.measureText(Layout.java:1600)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.text.Layout.getLineMax(Layout.java:654)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.text.Layout.getLineMax(Layout.java:628)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.text.Layout.getHorizontal(Layout.java:552)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.text.Layout.getHorizontal(Layout.java:513)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.text.Layout.getPrimaryHorizontal(Layout.java:498)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.widget.TextView.getFocusedRect(TextView.java:3962)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.view.FocusFinder.findNextFocus(FocusFinder.java:72)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.view.ViewGroup.focusSearch(ViewGroup.java:473)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.view.ViewGroup.focusSearch(ViewGroup.java:475)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.view.ViewGroup.focusSearch(ViewGroup.java:475)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.view.ViewGroup.focusSearch(ViewGroup.java:475)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.view.ViewGroup.focusSearch(ViewGroup.java:475)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.view.ViewGroup.focusSearch(ViewGroup.java:475)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.view.View.focusSearch(View.java:3032)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.widget.TextView.onCreateInputConnection(TextView.java:4342)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
 
 android.view.inputmethod.InputMethodManager.startInputInner(InputMethodMana­ger.java:933)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
 
 android.view.inputmethod.InputMethodManager.checkFocus(InputMethodManager.j­ava:1105)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
 
 android.view.inputmethod.InputMethodManager.isActive(InputMethodManager.jav­a:530)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.widget.TextView.onDraw(TextView.java:3893)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.view.View.draw(View.java:5838)
  06-07 15:11:20.318 E/AndroidRuntime(22775): at
  android.view.ViewGroup.drawChild(ViewGroup.java:1540)
  06-07 15:11:20.318 E/AndroidRuntime(22775

[android-developers] StackOverflowError in UI redraw

2010-06-07 Thread Thierry Legras
Hi,

I am facing rare StackOverflowError in my application during UI redraw. Does
it mean memory is exhausted? How can i fix this? And finally how can i be
sure the issue will be definitevly fixed??

Any advice would be welcome :)
Thierry.

Here is the backtrace:

06-07 15:11:20.318 E/AndroidRuntime(22775): java.lang.StackOverflowError
06-07 15:11:20.318 E/AndroidRuntime(22775): at android.text.method.

ReplacementTransformationMethod$ReplacementCharSequence.getChars(ReplacementTransformationMethod.java:151)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.TextUtils.getChars(TextUtils.java:69)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.Layout$Ellipsizer.getChars(Layout.java:1778)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.TextUtils.getChars(TextUtils.java:69)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.graphics.Paint.measureText(Paint.java:1016)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.Styled.each(Styled.java:124)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.Styled.foreach(Styled.java:249)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.Styled.measureText(Styled.java:371)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.Layout.measureText(Layout.java:1600)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.Layout.getLineMax(Layout.java:654)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.Layout.getLineMax(Layout.java:628)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.Layout.getHorizontal(Layout.java:552)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.Layout.getHorizontal(Layout.java:513)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.text.Layout.getPrimaryHorizontal(Layout.java:498)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.widget.TextView.getFocusedRect(TextView.java:3962)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.FocusFinder.findNextFocus(FocusFinder.java:72)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.focusSearch(ViewGroup.java:473)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.focusSearch(ViewGroup.java:475)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.focusSearch(ViewGroup.java:475)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.focusSearch(ViewGroup.java:475)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.focusSearch(ViewGroup.java:475)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.focusSearch(ViewGroup.java:475)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.View.focusSearch(View.java:3032)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.widget.TextView.onCreateInputConnection(TextView.java:4342)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.inputmethod.InputMethodManager.startInputInner(InputMethodManager.java:933)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.inputmethod.InputMethodManager.checkFocus(InputMethodManager.java:1105)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.inputmethod.InputMethodManager.isActive(InputMethodManager.java:530)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.widget.TextView.onDraw(TextView.java:3893)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.View.draw(View.java:5838)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.drawChild(ViewGroup.java:1540)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.drawChild(ViewGroup.java:1538)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.View.draw(View.java:5841)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.drawChild(ViewGroup.java:1540)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.drawChild(ViewGroup.java:1538)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.View.draw(View.java:5944)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.widget.FrameLayout.draw(FrameLayout.java:352)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.drawChild(ViewGroup.java:1540)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.View.draw(View.java:5841)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.drawChild(ViewGroup.java:1540)
06-07 15:11:20.318 E/AndroidRuntime(22775): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1282)
06-07 

Re: RE : Re: [android-developers] starting an application with Android 1.5

2010-05-12 Thread Thierry Legras
I see now, the method i would like to use in 1.5 is setPackage not
setComponent; sorry for the misunderstanding.
I don't want to use setComponent because i don't know the classname to use
(and i don't want to hardcode it as i guess it might change as it is an
external application). And setPackage is only available since API level 4 :(

I have used your Launchalot exemples to dynamically retrieve the classname.
Here is what i did that seems to work:

String packageName = com.foo.blabla;
Intent mainApps = new Intent(Intent.ACTION_MAIN);
mainApps.addCategory(Intent.CATEGORY_LAUNCHER);
ListResolveInfo activities =
act.getPackageManager().queryIntentActivities(mainApps, 0);
IteratorResolveInfo it = activities.iterator();
while (it.hasNext()) {
ResolveInfo info = it.next();
ActivityInfo activity=info.activityInfo;
if (activity.packageName.equalsIgnoreCase(packageName )) {
Intent intent=new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);

intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
ComponentName name = new
ComponentName(activity.packageName, activity.name);
intent.setComponent(name);
act.startActivity(intent);
return true;
}
}
// handle not found case


Any shorter and faster way (and compatible with 1.5) to do it is welcome :)


2010/5/12 Thierry Legras tleg...@gmail.com

 Hi Mark,
 Yes sorry, my mail was not clear but you got it.
 I was really sure this was available from 1.6. It seems I need to have a
 rest! I will try that tomorrow.

 Thanks you both for the lightning fast help :)
 Thierry

 Le 12 mai 2010, 12:32 AM, Mark Murphy mmur...@commonsware.com a
 écrit :

 Thierry Legras wrote:  How can i start an application just knowing the
 package name, not the  clas...
 There is no concept in Android of start an application. There is
 start an activity, even start an activity that appears in the Launcher.

  Ok, there is Intent.setComponent solution would be what i need ... if it
  was compatible with 1
 Not to mention the fact that this will not work by itself.

 BTW, setComponent() most certainly works with Android 1.5, since that
 method existed since API Level 1 (a.k.a., Android 1.0).

  I guess i have to play with getPackageManager() but how can i use it?
 Intent i=new Intent(Intent.ACTION_MAIN);

 i.addCategory(Intent.CATEGORY_LAUNCHER);

 i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
 i.setComponent(name);

 startActivity(i);

 See:


 http://github.com/commonsguy/cw-advandroid/tree/master/Introspection/Launchalot/

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

 Android Consulting: http://commonsware.com/consulting

 --

 You received this message because you are subscribed to the Google Groups
 Android Developers group...




-- 
Thierry.

-- 
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

[android-developers] starting an application with Android 1.5

2010-05-11 Thread Thierry Legras
Hi,

How can i start an application just knowing the package name, not the
classname?
Ok, there is Intent.setComponent solution would be what i need ... if it was
compatible with 1.5 :(

I guess i have to play with getPackageManager() but how can i use it?

Thanks for any help,
-- 
Thierry.

-- 
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 : Re: [android-developers] starting an application with Android 1.5

2010-05-11 Thread Thierry Legras
Hi Mark,
Yes sorry, my mail was not clear but you got it.
I was really sure this was available from 1.6. It seems I need to have a
rest! I will try that tomorrow.

Thanks you both for the lightning fast help :)
Thierry

Le 12 mai 2010, 12:32 AM, Mark Murphy mmur...@commonsware.com a écrit :

Thierry Legras wrote:  How can i start an application just knowing the
package name, not the  clas...
There is no concept in Android of start an application. There is
start an activity, even start an activity that appears in the Launcher.

 Ok, there is Intent.setComponent solution would be what i need ... if it 
was compatible with 1
Not to mention the fact that this will not work by itself.

BTW, setComponent() most certainly works with Android 1.5, since that
method existed since API Level 1 (a.k.a., Android 1.0).

 I guess i have to play with getPackageManager() but how can i use it?
Intent i=new Intent(Intent.ACTION_MAIN);

i.addCategory(Intent.CATEGORY_LAUNCHER);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
i.setComponent(name);

startActivity(i);

See:

http://github.com/commonsguy/cw-advandroid/tree/master/Introspection/Launchalot/

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

Android Consulting: http://commonsware.com/consulting

--

You received this message because you are subscribed to the Google Groups
Android Developers group...

-- 
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] Re: SQLite concurrent access best practices

2010-05-09 Thread Thierry Legras
Thank you both for your answers.

Are you sure using synchronized is enough inside the insert or update? I
also got exceptions in call to getReadableDatabase while another thread was
being writing so i don't think it would work. I am already using transaction
for DB write but it did not seem to make any changes.

The way i do each time i need to read/write/update DB is something like
that:

OnRead() {
 db = new myDBHelperClass();
 db.getReadableDatabase
 db.query(...)
 db.close()
}


OnWrite() {
 db = new myDBHelperClass();
 db.getWriteableDatabase
 db.beginTransaction
 db.insert(...)
 db.endTransaction
}

I was rather thinking of using a synchronized in OnRead and OnWrite, but has
such methods exists in differents Activities and Task, i am pretty reluctant
to do that.

I also so design were DB is open in Activity onCreate and closed in
onDestroy, but i guess i will not work when a task also needs write in the
DB while the DB is open by the activity.


2010/5/9 Evgeny V evgen...@gmail.com

 I believe you can provide the safe concurrency managment by using DB
 transactions. Since you don't care about sequence between separate
 activities you can run following snippet:

 try
 db.BeginTransaction
  db.RunCommand(insert or update etc.)
 db.CommitTransaction
 catch
 db.RollbackTransaction

 Evgeny

 On Sun, May 9, 2010 at 8:18 AM, Senthil ACS acs@gmail.com wrote:

 For insert() and update(), have it under synchronized blocks.

 On May 8, 5:40 pm, Thierry Legras tleg...@gmail.com wrote:
  Hi,
 
  I have an application with several tables, each being updated by
 AsyncTask
  fired by different Activities and used by UI with SimpleCursorAdapter.
  Though i am not developping a game, I would like to avoid to interrupt
 the
  user as mush as possible.
  Has SQLite is not multiaccess proof, what is the best way of handling
 such
  situation?
 
  - I consider adding lock from each DB open and to each close sequence
 but
  this seems quite subject to bugs
  - The solution i am using now is that each DB access (read/write) is
 done in
  UI thread (when AsyncTask completes, DB write is done typically in
  onPostExecute), but that means user is blocked for several seconds
 during
  the DB write.
 
  Is there any better solution for that? Should i use a ContentProvider?
 when
  i read Content providers store and retrieve data and make it accessible
 to
  all applications, this does not seems to be what i need. Any idea?
 
  --
  Thierry.


(snip)

-- 
Thierry.

-- 
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

[android-developers] SQLite concurrent access best practices

2010-05-08 Thread Thierry Legras
Hi,

I have an application with several tables, each being updated by AsyncTask
fired by different Activities and used by UI with SimpleCursorAdapter.
Though i am not developping a game, I would like to avoid to interrupt the
user as mush as possible.
Has SQLite is not multiaccess proof, what is the best way of handling such
situation?

- I consider adding lock from each DB open and to each close sequence but
this seems quite subject to bugs
- The solution i am using now is that each DB access (read/write) is done in
UI thread (when AsyncTask completes, DB write is done typically in
onPostExecute), but that means user is blocked for several seconds during
the DB write.

Is there any better solution for that? Should i use a ContentProvider? when
i read Content providers store and retrieve data and make it accessible to
all applications, this does not seems to be what i need. Any idea?

-- 
Thierry.

-- 
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] is charset decoding terminal dependant?? (UTF8/iso-8859-1 question)

2010-04-06 Thread Thierry Legras
Hi,

After having banged my heads for weeks, i found the problems:

The issue was not device dependant, but network access dependant.

For some reason the pages encoding when accessed using my mobile operator
access are changed to UTF-8, as showed in the ContentType HTTP header
(ContentType: text/html; Charset=UTF-8) whereas the HTTP content still
specifies ISO-8859-1 in meta
tag.


So the final solution is to :
1) grab encoding in the HTTP ContentType header if any
2) if so set the feature
http://cyberneko.org/html/features/scanner/ignore-specified-charset to false
3) in the XMLInputSource constructor, pass ISO-8859-1 by default or the
charset found in ContentType header if any
4) in the filter characters function, no decoding/encoding/getByte or
whatsoever charset change is further required; XMLString.toString() will
directly gives correct :)

Hope this will oneday help another charset-newbie ;)

Thierry.


2010/2/13 Thierry Legras tleg...@gmail.com

 Thanks for your reply.

 yes this is a java.lang.String. Indeed all i want to do is to correctly
 display the string in some View.

 Ok i got the point about java String being 16 bits. If so, and as it is not
 well displayed, i guess this means it was not properly created at first.

 Maybe this issue is more related to my (bad) use of xerces when i
 initialize the xerces XMLDocumentFilter object.

 XMLParserConfiguration parser = new HTMLConfiguration();
 parser.setDocumentHandler(filter); // filter is a
 XMLDocumentFilter
 XMLInputSource source = new XMLInputSource(null, null,
 null,myHttpResponse.getEntity().getContent(), iso-8859-1);
 parser.parse(source);

 I will check more in detail in xerces ressources, this probably is not an
 Android related topic after all.

 Thierry.


 2010/2/13 Frank Weiss fewe...@gmail.com

 First, some clarifications. Locale has nothing to do with character
 encoding. Java stores all character data internally as 16-bit Unicode,
 regardless of locale.

 I suspect that myString.getBytes(iso-8859-1) is erroneous. I'm assuming
 that myString is of type java.lang.String. What are you doing with the
 result and why do you want to encode a sequence of Unicode characters back
 to ISO-8859-1 (Latin1)?

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





-- 
Thierry.

-- 
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] How to prevent animation when starting new task?

2010-03-08 Thread Thierry Legras
Hi,

I have the same issue as you but did not find any solution either :( .

In my case i use a TabHost where each tab has its own activity and at some
point i need to switch to another tab from one tab activity. As it is not
possible to do that from a tab activity, the best way i found is to restart
a new instance of the tabactivity and to finish the current one (ugly i
know...). I specified the NO_ANIMATION flag as well with no success, i still
have a animation.

Thierry.


2010/3/5 greenrobot kont...@greenrobot.de

 We are currently looking into methods how to implement tabs. TabHost
 has serious limitations and is no option. Instead, we are
 experimenting with our own tab solution, which has its own task
 (activity stack) for each tab.

 It's working well except that there's transition animation performed
 by the system when launching a new task the first time. The
 NO_ANIMATION parameter passed to startActivity has no effect in this
 case. The animation breaks the app visually - is there a way to
 prevent it?

 Thanks,
 Markus

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




-- 
Thierry.

-- 
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

[android-developers] is charset decoding terminal dependant?? (UTF8/iso-8859-1 question)

2010-02-13 Thread Thierry Legras
Hello,

I'm having troubles to correctly display strings with é è ... characters
extracted from an html page (iso-8859-1).
I am reading the html page as iso-8859-1 (using xerces XMLInputSource(null,
null, null, myHTTPRequestContent, iso-8859-1), searching and extracting
some specific strings with a nekohtml sax filter, then display the result in
some view with something like:

myString.getBytes(iso-8859-1)

This is working pretty good on some devices, but in some other, like all my
AVD, the french é è etc. characters are incorrectly displayed. More
strangely, it is working on my HTC Hero, but not on my wife's own HTC Hero
(not bought at same place). I tried to change the locale to french on the
AVD but it did not changed anything.

On these devices, it seems that using directly myString ( or
myString.getBytes(UTF8) ) is correct.

I see other applications that seems to handle this issue by providing an
option force UTF8, but i would prefer definitly a generic one!

Any clue?
-- 
Thierry.

-- 
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] Re: Help needed with parsing some XML data !

2010-02-13 Thread Thierry Legras
Hi,

I have a similar problem. I am parsing iso-8859-1 html page with a sax
parser but having trouble to display it on _some_ devices (characters é è
... are replaced by random symbols).
On some devide i have to use myString.getBytes(iso-8859-1) to display it
correctly, and on some other devices, myString will be displayed correctly.

The best solution i cold ifnd so far is to provide a user option like force
utf8 or force iso-8859-1 that the user can check if having problem.

Thierry.


2010/2/4 MobDev developm...@mobilaria.com

 Well,
 to be honest your first idea was also mine :P So I already looked via
 Google but to be honest I haven't found that many clear discussions/
 explanations...
 I also tried idea 2 and this is what I got :

 Congratulations

 The document located at http://x was successfully checked as
 well-formed XML. This means that we were not able to determine the
 exact document type, but that the document passed the XML well-
 formedness syntax check. If you wish to wish to perform formal
 validation of the document, you can use the Document Type: option of
 the validator. 

 But also this has been found, even though I do not know how important
 this is :
 The DOCTYPE Declaration was not recognized or is missing. This
 probably means that the Formal Public Identifier contains a spelling
 error, or that the Declaration is not using correct syntax, or that
 your XML document is not using a DOCTYPE Declaration.

 Validation of the document has been skipped, and a simple check of the
 well-formedness of the XML syntax has been performed instead. 

 Als, just to point out, at this point i CAN read out the XML stream by
 using the
 Xml.parse(is, Xml.Encoding.ISO_8859_1, new ExampleHandler(myAdapter));
 method...
 The only problem that remains is when I try to write on-screen the
 values...
 Btw, is there a way to trasform such a String (for example from a
 Country ID=2 CName=Åland eilanden/  tag) to utf-8 ?
 I have experienced such a problem on the iPhone some time ago, it also
 received the data as ISO-8859-1 but the STring had to be encoded to
 UTF8 to be shown correctly onscreen

 On 4 feb, 11:47, Frank Weiss fewe...@gmail.com wrote:
  I have two ideas for you, Mobdev:
 
  1) Google for not well-formed (invalid token) and see what other people
  have found regarding this error.
  2) Go to validator.w3.org and see if the XML file in question is indeed
  valid or not.
 
  Please let us know what you find 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Thierry.

-- 
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] is charset decoding terminal dependant?? (UTF8/iso-8859-1 question)

2010-02-13 Thread Thierry Legras
Thanks for your reply.

yes this is a java.lang.String. Indeed all i want to do is to correctly
display the string in some View.

Ok i got the point about java String being 16 bits. If so, and as it is not
well displayed, i guess this means it was not properly created at first.

Maybe this issue is more related to my (bad) use of xerces when i initialize
the xerces XMLDocumentFilter object.

XMLParserConfiguration parser = new HTMLConfiguration();
parser.setDocumentHandler(filter); // filter is a
XMLDocumentFilter
XMLInputSource source = new XMLInputSource(null, null,
null,myHttpResponse.getEntity().getContent(), iso-8859-1);
parser.parse(source);

I will check more in detail in xerces ressources, this probably is not an
Android related topic after all.

Thierry.


2010/2/13 Frank Weiss fewe...@gmail.com

 First, some clarifications. Locale has nothing to do with character
 encoding. Java stores all character data internally as 16-bit Unicode,
 regardless of locale.

 I suspect that myString.getBytes(iso-8859-1) is erroneous. I'm assuming
 that myString is of type java.lang.String. What are you doing with the
 result and why do you want to encode a sequence of Unicode characters back
 to ISO-8859-1 (Latin1)?

 --
 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.comandroid-developers%2bunsubscr...@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

[android-developers] Re: bug in Spinner.setSelection when called twice?

2010-02-06 Thread Thierry Legras
Hi,

I think i found the solution: a call to
ArrayAdapterCharSequence.notifyDataSetChanged fixed the problem.

Thierry.


2010/2/3 Thierry Legras tleg...@gmail.com

 Hi,

 I saw several people reporting an issue with Spinner.setSelection that does
 not seem to work as expected on the second call: the item selection is
 correctly updated in the list subframe, but not in the text displayed when
 the spinner is closed

 Anbody knows a workarround?

 Thierry.



 On 4 juin 2009, 21:46, Ben Roberts divestocl...@gmail.com wrote:
  There are at least two other people who have encountered this problem:
 http://groups.google.com/group/android-beginners/browse_thread/thread...http://groups.google.com/group/android-developers/browse_thread/threa.
 ..
 
  Any ideas? Is it a bug?
 
  At the very least, does anyone know of an open source app that uses a
  Spinner on a layout from which another Activity can be launched?
 
  On Jun 1, 9:17 pm, Ben Roberts divestocl...@gmail.com wrote:
 
   I'm quoting an old message from last year because it's EXACTLY the
   problem I'm having:
 
Hi all,
I have a spinner in a dialog. Calling spinner.setSelection(int)
correctly sets the spinner just after opening the app. If I reopen
 the
dialog after making another spinner.setSelection(int) call, the
spinner shows the first item regardless of the selection being set,
BUT...
 
clicking on the spinner shows that the correct value is selected in
the list of options (green dot next to the item). Weird huh?
 Sometimes
when this happens, the spinner is cutting off parts of the text. Has
anyone else seen this happen?
 
   Since the last guy got no response, I'll give as much detail as I
   can... this is driving me nuts.
 
   I built a class to help me build a Spinner in a consistent manner to
   display a list of categories. After the objects are initialized, my
   Activity calls a method initCatSpinner which builds the ArrayAdapter
   and finishes initializing my Spinner.
 
   Called from onCreate and onActivityResult:
   mCategorySpinner = mCatSpinHelper.initCatSpinner(mCategoryId,
   catcursor);
 
   public Spinner initCatSpinner(long initial_category, Cursor
   all_categories) {
   LinkedListCategorySpinnerItem categories = new
   LinkedListCategorySpinnerItem();
 
   // Code to build this linked list from all_Categories is here,
   removed for brevity
   // Code adds an All item to the top, builds a list of
 categories
   using catcursor, then adds a Edit Categories option to the end of
   the list
 
   if(initial_category == ID_ALL) {
   mLastCategoryPosition=0;
   }
 
   // Build the spinner adapter and set up the Spinner
   ArrayAdapterCategorySpinnerItem spinadapter = new
   ArrayAdapterCategorySpinnerItem(mCtx,
   android.R.layout.simple_spinner_item,
   android.R.id.text1,
   categories);
 
   spinadapter.setDropDownViewResource
   (android.R.layout.simple_spinner_dropdown_item);
   mCatSpinner.setAdapter(spinadapter);
   mCatSpinner.setSelection(mLastCategoryPosition);
   mCatSpinner.setPrompt(mCtx.getResources().getString
   (R.string.choose_category));
 
   return mCatSpinner;
 
   }
 
   This works fine on two different activities when they are launched.
   One activity launches to show a list of all items in the category
   chosen by this spinner. From there I can launch another activity in a
   dialog to change the category of a selected item, and when I do this
   and return to the original activity I get the above symptoms. I still
   see a list of the items in the proper category, if I open the spinner
   the category that was originally selected is still selected, but the
   spinner item that's displayed on the widget itself is always the first
   one in the list! It also happens if I switch to another Activity then
   come back to this one.
 
   I've checked with Log output and mLastCategoryPosition IS being set
   correctly, so the setSelection call is passing the right data. I even
   tried calling SystemClock.sleep for a few hundred milliseconds
   thinking it might be a race condition, with no change. What's going on
   here? I'm using the 1.5r2 SDK.

 --
 Thierry.




-- 
Thierry.

-- 
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

[android-developers] bug in Spinner.setSelection when called twice?

2010-02-03 Thread Thierry Legras
Hi,

I saw several people reporting an issue with Spinner.setSelection that does
not seem to work as expected on the second call: the item selection is
correctly updated in the list subframe, but not in the text displayed when
the spinner is closed

Anbody knows a workarround?

Thierry.



On 4 juin 2009, 21:46, Ben Roberts divestocl...@gmail.com wrote:
 There are at least two other people who have encountered this problem:
http://groups.google.com/group/android-beginners/browse_thread/thread...http://groups.google.com/group/android-developers/browse_thread/threa.
..

 Any ideas? Is it a bug?

 At the very least, does anyone know of an open source app that uses a
 Spinner on a layout from which another Activity can be launched?

 On Jun 1, 9:17 pm, Ben Roberts divestocl...@gmail.com wrote:

  I'm quoting an old message from last year because it's EXACTLY the
  problem I'm having:

   Hi all,
   I have a spinner in a dialog. Calling spinner.setSelection(int)
   correctly sets the spinner just after opening the app. If I reopen the
   dialog after making another spinner.setSelection(int) call, the
   spinner shows the first item regardless of the selection being set,
   BUT...

   clicking on the spinner shows that the correct value is selected in
   the list of options (green dot next to the item). Weird huh? Sometimes
   when this happens, the spinner is cutting off parts of the text. Has
   anyone else seen this happen?

  Since the last guy got no response, I'll give as much detail as I
  can... this is driving me nuts.

  I built a class to help me build a Spinner in a consistent manner to
  display a list of categories. After the objects are initialized, my
  Activity calls a method initCatSpinner which builds the ArrayAdapter
  and finishes initializing my Spinner.

  Called from onCreate and onActivityResult:
  mCategorySpinner = mCatSpinHelper.initCatSpinner(mCategoryId,
  catcursor);

  public Spinner initCatSpinner(long initial_category, Cursor
  all_categories) {
  LinkedListCategorySpinnerItem categories = new
  LinkedListCategorySpinnerItem();

  // Code to build this linked list from all_Categories is here,
  removed for brevity
  // Code adds an All item to the top, builds a list of
categories
  using catcursor, then adds a Edit Categories option to the end of
  the list

  if(initial_category == ID_ALL) {
  mLastCategoryPosition=0;
  }

  // Build the spinner adapter and set up the Spinner
  ArrayAdapterCategorySpinnerItem spinadapter = new
  ArrayAdapterCategorySpinnerItem(mCtx,
  android.R.layout.simple_spinner_item,
  android.R.id.text1,
  categories);

  spinadapter.setDropDownViewResource
  (android.R.layout.simple_spinner_dropdown_item);
  mCatSpinner.setAdapter(spinadapter);
  mCatSpinner.setSelection(mLastCategoryPosition);
  mCatSpinner.setPrompt(mCtx.getResources().getString
  (R.string.choose_category));

  return mCatSpinner;

  }

  This works fine on two different activities when they are launched.
  One activity launches to show a list of all items in the category
  chosen by this spinner. From there I can launch another activity in a
  dialog to change the category of a selected item, and when I do this
  and return to the original activity I get the above symptoms. I still
  see a list of the items in the proper category, if I open the spinner
  the category that was originally selected is still selected, but the
  spinner item that's displayed on the widget itself is always the first
  one in the list! It also happens if I switch to another Activity then
  come back to this one.

  I've checked with Log output and mLastCategoryPosition IS being set
  correctly, so the setSelection call is passing the right data. I even
  tried calling SystemClock.sleep for a few hundred milliseconds
  thinking it might be a race condition, with no change. What's going on
  here? I'm using the 1.5r2 SDK.

-- 
Thierry.

-- 
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

[android-developers] ContextMenu on TableLayout: how to get selected item position?

2010-01-22 Thread Thierry Legras
Hi,

ContextMenu seems quite handy as long as we are using an AdapterView as we
can easily get selected item position in onContextItemSelected from
AdapterContextMenuInfo.position

Any idea how we can achieve something similar in a TableLayout?
In my TableLayout, i have some TableRow and i would like to get the row
index in the onContextItemSelected callback like i would do with a simple
ListView.

I guess i will have to register the contextmenu for each row? but how can
tie the row index with the menu? i see no way to do it with
registerForContextMenu.

Thks,
Thierry.

-- 
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] Re: applying style to textview

2010-01-11 Thread Thierry Legras
Thanks for your answer

indeed i was a bit imprecise; in the xml way only setting the background
color does not work. i tried also to use this way

item name=android:colorBackground@color/myblue/item
item name=android:windowBackground@color/myblue/item

like mentionned in your link with no luck. whereas in the java code this
works fine:

mytextview.setBackgroundColor(myBackgroundColor);

For the programmatical way to apply style to view, indeed i realized my
style is completly ignored.
it seems that line is not right:
TextView nametv = new TextView(this,null,R.style.ListName);
the 3rd parameter is ignored.

So, so far i am stick both to use default background color (or to change
everything from code), and to set my text settings programmatically
whereever i have to create new textview in the code :(

Thierry.


On Mon, Jan 11, 2010 at 1:58 AM, joebowbeer joe.bowb...@gmail.com wrote:

 Have you tried customizing the textAppearance? That may avoid the
 issue you're seeing - and may also be a better approach.


 http://brainflush.wordpress.com/2009/03/15/understanding-android-themes-and-styles/

 On Jan 10, 10:58 am, tlegras tleg...@gmail.com wrote:
  Hi,
 
  I am trying to apply common style to different textview that can be
  either defined in a layout xml file or programmatically and that does
  not seem to work for some attributes:
  My style in styles.xml is:
 
  style name=ListName
  item name=android:colorForeground#f0f/item
  item name=android:padding4sp/item
  item name=android:textSize30sp/item
  item name=android:textColor#CCC/item
  item name=android:gravityleft/item
  item name=android:typefaceserif/item
  item name=android:textStylebold/item
  item name=android:colorBackground#999/item
  /style
 
  In my layout xml i have TextView style=@style/ListName .../
  TextView
  and in my activity java class i have:
 
  TextView nametv = new TextView(this,null,R.style.ListName);
 
  However some parameters does not seem to work very well:
  - textStyle to bolditalic does not seems to be recognized
  - textColor/colorForeground/colorBackground does not work at all
 
  I have been through the documentation, but could not find precise
  reference documentation for that attributes, nor sample for the color
  setting.
 
  Thanks for any help.
  Thierry.

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




-- 
Thierry.
-- 
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