[android-developers] Re: Android widget layout doesn't change after rotation

2013-05-19 Thread zhiyazw
The example uses the way of creating extending class, I know that could 
accomplish this, I have statemented that I want to see if somebody know a 
light way.
 
The rotating method is contained in the layout xml. Thank you anyway to pay 
your attention .

On Monday, May 13, 2013 3:05:05 PM UTC+8, Piren wrote:

> you never said how you rotated it...
>
> either way, you could have spent this week googling instead of crying out 
> for help and bumping the topic.
> it took me less than 5 seconds to find this:
>
> http://stackoverflow.com/questions/1258275/vertical-rotated-label-in-android
>
> On Monday, May 6, 2013 4:35:31 AM UTC+3, zhiyazw wrote:
>>
>> This is still not resolved, pls someone help. 
>>
>> On Apr 26, 4:10 pm, zhiyazw  wrote: 
>> > See the layout xml: 
>> > 
>> > http://schemas.android.com/tools"; 
>> > android:layout_width="match_parent" 
>> > android:layout_height="match_parent" 
>> > android:orientation="vertical" 
>> > tools:context=".MainActivity" xmlns:android="
>> http://schemas.android.com/apk/res/android";> 
>> > 
>> > > > android:layout_width="wrap_content" 
>> > android:layout_height="wrap_content" 
>> > android:layout_gravity="center_horizontal" 
>> > android:layout_marginBottom="10dp" 
>> > android:layout_marginTop="10dp" 
>> > android:text="Temperature Chart" 
>> > android:textAppearance="?android:attr/textAppearanceLarge" /> 
>> > 
>> > > > android:id="@+id/chartContainer" 
>> > android:layout_width="match_parent" 
>> > android:layout_height="wrap_content" > 
>> > 
>> > > > android:id="@+id/textTemperature" 
>> > android:layout_width="wrap_content" 
>> > android:layout_height="wrap_content" 
>> > android:layout_gravity="center_vertical" 
>> > android:transformPivotX="0sp" 
>> > android:translationY="0sp" 
>> > android:rotation="-90" 
>> > android:text="Temperature" /> 
>> > 
>> >  
>> >  
>> > 
>> > then I insert a chart view into the "chartContainer" LinearLayout. The 
>> > executing result is as the following picture: 
>> > you can see the problem is, after "textTemperature" is rotated, it 
>> still 
>> > occupy the room as before it rotated, bellow layout view confirmed 
>> this. 
>> > 
>> > <
>> https://lh4.googleusercontent.com/-qw0ryGAA_6A/UXo1t4C2RjI/AA...> 
>>
>> > 
>> > My question is how can I make the "textTemperature" widget only occupy 
>> the 
>> > width as it is looked like? that's, there is no additional blank 
>> between 
>> > "textTemperature" and the chart. 
>> > I know writing a customized widget or putting the rotated widget in an 
>> > individual FrameLayout could accomplish this, I mean to seek there is 
>> any 
>> > lighter way, such as a property, etc. 
>>
>

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




[android-developers] Re: Android widget layout doesn't change after rotation

2013-05-12 Thread zhiyazw
UP!!!

On Tuesday, May 7, 2013 11:20:02 AM UTC+8, zhiyazw wrote:

> up!
>
> On Friday, April 26, 2013 10:06:14 PM UTC+8, bob wrote:
>
>> Maybe make the chart view wider?
>>
>>
>> What did you set the width of the chart view to?  If it is wrap_content, 
>> I would at least try match_parent.
>>
>>
>> Thanks.
>>
>>
>>
>> On Friday, April 26, 2013 3:10:39 AM UTC-5, zhiyazw wrote:
>>>
>>> See the layout xml:
>>>
>>> http://schemas.android.com/tools";
>>> android:layout_width="match_parent"
>>> android:layout_height="match_parent"
>>> android:orientation="vertical"
>>> tools:context=".MainActivity" xmlns:android="
>>> http://schemas.android.com/apk/res/android";>
>>>
>>> >> android:layout_width="wrap_content"
>>> android:layout_height="wrap_content"
>>> android:layout_gravity="center_horizontal"
>>> android:layout_marginBottom="10dp"
>>> android:layout_marginTop="10dp"
>>> android:text="Temperature Chart"
>>> android:textAppearance="?android:attr/textAppearanceLarge" />
>>>
>>> >> android:id="@+id/chartContainer"
>>> android:layout_width="match_parent"
>>> android:layout_height="wrap_content" >
>>>
>>> >> android:id="@+id/textTemperature"
>>> android:layout_width="wrap_content"
>>> android:layout_height="wrap_content"
>>> android:layout_gravity="center_vertical"
>>> android:transformPivotX="0sp"
>>> android:translationY="0sp"
>>> android:rotation="-90"
>>> android:text="Temperature" />
>>>
>>> 
>>> 
>>>  
>>> then I insert a chart view into the "chartContainer" LinearLayout. The 
>>> executing result is as the following picture:
>>> you can see the problem is, after "textTemperature" is rotated, it still 
>>> occupy the room as before it rotated, bellow layout view confirmed this.
>>>
>>>
>>> <https://lh4.googleusercontent.com/-qw0ryGAA_6A/UXo1t4C2RjI/AA8/Buvso--p66I/s1600/chart1.png>
>>>
>>>
>>> My question is how can I make the "textTemperature" widget only occupy 
>>> the width as it is looked like? that's, there is no additional blank 
>>> between "textTemperature" and the chart.
>>> I know writing a customized widget or putting the rotated widget in an 
>>> individual FrameLayout could accomplish this, I mean to seek there is any 
>>> lighter way, such as a property, etc.
>>>
>>>  
>>>
>>

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




[android-developers] Re: Android widget layout doesn't change after rotation

2013-05-06 Thread zhiyazw
up!

On Friday, April 26, 2013 10:06:14 PM UTC+8, bob wrote:

> Maybe make the chart view wider?
>
>
> What did you set the width of the chart view to?  If it is wrap_content, I 
> would at least try match_parent.
>
>
> Thanks.
>
>
>
> On Friday, April 26, 2013 3:10:39 AM UTC-5, zhiyazw wrote:
>>
>> See the layout xml:
>>
>> http://schemas.android.com/tools";
>> android:layout_width="match_parent"
>> android:layout_height="match_parent"
>> android:orientation="vertical"
>> tools:context=".MainActivity" xmlns:android="
>> http://schemas.android.com/apk/res/android";>
>>
>> > android:layout_width="wrap_content"
>> android:layout_height="wrap_content"
>> android:layout_gravity="center_horizontal"
>> android:layout_marginBottom="10dp"
>> android:layout_marginTop="10dp"
>> android:text="Temperature Chart"
>> android:textAppearance="?android:attr/textAppearanceLarge" />
>>
>> > android:id="@+id/chartContainer"
>> android:layout_width="match_parent"
>> android:layout_height="wrap_content" >
>>
>> > android:id="@+id/textTemperature"
>> android:layout_width="wrap_content"
>> android:layout_height="wrap_content"
>> android:layout_gravity="center_vertical"
>> android:transformPivotX="0sp"
>> android:translationY="0sp"
>> android:rotation="-90"
>> android:text="Temperature" />
>>
>> 
>> 
>>  
>> then I insert a chart view into the "chartContainer" LinearLayout. The 
>> executing result is as the following picture:
>> you can see the problem is, after "textTemperature" is rotated, it still 
>> occupy the room as before it rotated, bellow layout view confirmed this.
>>
>>
>> <https://lh4.googleusercontent.com/-qw0ryGAA_6A/UXo1t4C2RjI/AA8/Buvso--p66I/s1600/chart1.png>
>>
>>
>> My question is how can I make the "textTemperature" widget only occupy 
>> the width as it is looked like? that's, there is no additional blank 
>> between "textTemperature" and the chart.
>> I know writing a customized widget or putting the rotated widget in an 
>> individual FrameLayout could accomplish this, I mean to seek there is any 
>> lighter way, such as a property, etc.
>>
>>  
>>
>

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




[android-developers] Re: Android widget layout doesn't change after rotation

2013-05-05 Thread zhiyazw
This is still not resolved, pls someone help.

On Apr 26, 4:10 pm, zhiyazw  wrote:
> See the layout xml:
>
>     http://schemas.android.com/tools";
>     android:layout_width="match_parent"
>     android:layout_height="match_parent"
>     android:orientation="vertical"
>     tools:context=".MainActivity" 
> xmlns:android="http://schemas.android.com/apk/res/android";>
>
>              android:layout_width="wrap_content"
>         android:layout_height="wrap_content"
>         android:layout_gravity="center_horizontal"
>         android:layout_marginBottom="10dp"
>         android:layout_marginTop="10dp"
>         android:text="Temperature Chart"
>         android:textAppearance="?android:attr/textAppearanceLarge" />
>
>              android:id="@+id/chartContainer"
>         android:layout_width="match_parent"
>         android:layout_height="wrap_content" >
>
>                      android:id="@+id/textTemperature"
>             android:layout_width="wrap_content"
>             android:layout_height="wrap_content"
>             android:layout_gravity="center_vertical"
>             android:transformPivotX="0sp"
>             android:translationY="0sp"
>             android:rotation="-90"
>             android:text="Temperature" />
>
>     
> 
>
> then I insert a chart view into the "chartContainer" LinearLayout. The
> executing result is as the following picture:
> you can see the problem is, after "textTemperature" is rotated, it still
> occupy the room as before it rotated, bellow layout view confirmed this.
>
> <https://lh4.googleusercontent.com/-qw0ryGAA_6A/UXo1t4C2RjI/AA...>
>
> My question is how can I make the "textTemperature" widget only occupy the
> width as it is looked like? that's, there is no additional blank between
> "textTemperature" and the chart.
> I know writing a customized widget or putting the rotated widget in an
> individual FrameLayout could accomplish this, I mean to seek there is any
> lighter way, such as a property, etc.

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




[android-developers] Re: Android widget layout doesn't change after rotation

2013-05-02 Thread zhiyazw
who can help, please!

On Apr 26, 4:10 pm, zhiyazw  wrote:
> See the layout xml:
>
>     http://schemas.android.com/tools";
>     android:layout_width="match_parent"
>     android:layout_height="match_parent"
>     android:orientation="vertical"
>     tools:context=".MainActivity" 
> xmlns:android="http://schemas.android.com/apk/res/android";>
>
>              android:layout_width="wrap_content"
>         android:layout_height="wrap_content"
>         android:layout_gravity="center_horizontal"
>         android:layout_marginBottom="10dp"
>         android:layout_marginTop="10dp"
>         android:text="Temperature Chart"
>         android:textAppearance="?android:attr/textAppearanceLarge" />
>
>              android:id="@+id/chartContainer"
>         android:layout_width="match_parent"
>         android:layout_height="wrap_content" >
>
>                      android:id="@+id/textTemperature"
>             android:layout_width="wrap_content"
>             android:layout_height="wrap_content"
>             android:layout_gravity="center_vertical"
>             android:transformPivotX="0sp"
>             android:translationY="0sp"
>             android:rotation="-90"
>             android:text="Temperature" />
>
>     
> 
>
> then I insert a chart view into the "chartContainer" LinearLayout. The
> executing result is as the following picture:
> you can see the problem is, after "textTemperature" is rotated, it still
> occupy the room as before it rotated, bellow layout view confirmed this.
>
> <https://lh4.googleusercontent.com/-qw0ryGAA_6A/UXo1t4C2RjI/AA...>
>
> My question is how can I make the "textTemperature" widget only occupy the
> width as it is looked like? that's, there is no additional blank between
> "textTemperature" and the chart.
> I know writing a customized widget or putting the rotated widget in an
> individual FrameLayout could accomplish this, I mean to seek there is any
> lighter way, such as a property, etc.

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




[android-developers] Re: Android widget layout doesn't change after rotation

2013-04-29 Thread zhiyazw
The chart view was match_parent. 
 
This problem happens due to the TextView which resides left to the chart 
view. From the layout picture I posted, we can see after rotaion, the 
TextView still occupy the room before it's rotated. So is there any way to 
make a widget to only occupy a necessary room after rotation? 
 
Alternatively, it's also a good solution to make the text aligning in the 
manner like it's rotated. Is it possible?
 
 

在 2013年4月26日星期五UTC+8下午10时06分14秒,bob写道:

> Maybe make the chart view wider?
>
>
> What did you set the width of the chart view to?  If it is wrap_content, I 
> would at least try match_parent.
>
>
> Thanks.
>
>
>
> On Friday, April 26, 2013 3:10:39 AM UTC-5, zhiyazw wrote:
>>
>> See the layout xml:
>>
>> http://schemas.android.com/tools";
>> android:layout_width="match_parent"
>> android:layout_height="match_parent"
>> android:orientation="vertical"
>> tools:context=".MainActivity" xmlns:android="
>> http://schemas.android.com/apk/res/android";>
>>
>> > android:layout_width="wrap_content"
>> android:layout_height="wrap_content"
>> android:layout_gravity="center_horizontal"
>> android:layout_marginBottom="10dp"
>> android:layout_marginTop="10dp"
>> android:text="Temperature Chart"
>> android:textAppearance="?android:attr/textAppearanceLarge" />
>>
>> > android:id="@+id/chartContainer"
>> android:layout_width="match_parent"
>> android:layout_height="wrap_content" >
>>
>> > android:id="@+id/textTemperature"
>> android:layout_width="wrap_content"
>> android:layout_height="wrap_content"
>> android:layout_gravity="center_vertical"
>> android:transformPivotX="0sp"
>> android:translationY="0sp"
>> android:rotation="-90"
>> android:text="Temperature" />
>>
>> 
>> 
>>  
>> then I insert a chart view into the "chartContainer" LinearLayout. The 
>> executing result is as the following picture:
>> you can see the problem is, after "textTemperature" is rotated, it still 
>> occupy the room as before it rotated, bellow layout view confirmed this.
>>
>>
>> <https://lh4.googleusercontent.com/-qw0ryGAA_6A/UXo1t4C2RjI/AA8/Buvso--p66I/s1600/chart1.png>
>>
>>
>> My question is how can I make the "textTemperature" widget only occupy 
>> the width as it is looked like? that's, there is no additional blank 
>> between "textTemperature" and the chart.
>> I know writing a customized widget or putting the rotated widget in an 
>> individual FrameLayout could accomplish this, I mean to seek there is any 
>> lighter way, such as a property, etc.
>>
>>  
>>
>

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




[android-developers] Android widget layout doesn't change after rotation

2013-04-26 Thread zhiyazw


See the layout xml:

http://schemas.android.com/tools";
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" xmlns:android="
http://schemas.android.com/apk/res/android";>









 
then I insert a chart view into the "chartContainer" LinearLayout. The 
executing result is as the following picture:
you can see the problem is, after "textTemperature" is rotated, it still 
occupy the room as before it rotated, bellow layout view confirmed this.




My question is how can I make the "textTemperature" widget only occupy the 
width as it is looked like? that's, there is no additional blank between 
"textTemperature" and the chart.
I know writing a customized widget or putting the rotated widget in an 
individual FrameLayout could accomplish this, I mean to seek there is any 
lighter way, such as a property, etc.

 

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




[android-developers] Re: Where can I catch a point that is assured to be called when a Service is destroied

2009-12-12 Thread zhiyazw
Up.

Anybody can help on this?



On 12月11日, 上午11时27分, zhiyazw  wrote:
> Thank you, Mark.
>
> I read your linked topic, But AlarmManager is not suitable to me.
>
> My service is not started periodically, it started by broadcast,
> Actually by "android.intent.action.PHONE_STATE".
>
> On each starting, the service should load a big database, this spend
> about serveral seconds, so I don't want to load it each time
> "android.intent.action.PHONE_STATE" arrive, I leave the service
> runing.
>
> For each "android.intent.action.PHONE_STATE", a UI should be present
> to user while calling, in order to show the UI in front of calling and
> not to interrupt the interaction with phone call, the UI should not be
> a activity, I user "WindowManager.LayoutParams.TYPE_SYSTEM_ALERT" with
> FLAG__NOT_FOCUSABLE.
>
> In above condition, except to Service, there is any better class I can
> use? pls advise me.
>
> If I have to user Service, Where should I do cleaning up and saving
> settings?
>
> Thank you!
>
> On Dec 10, 7:33 pm, "Mark Murphy"  wrote:
>
>
>
> > > I have a Service, it is started by StartService(...), my program never
> > > stop it. The service can be destroied in other cases, such as:
> > >   Stop it in Application->Running Services
> > >   run command: Kill 
> > >   System kill it in case of memory low
> > >   Phone shut down
> > >   other unlist condition...
>
> > > I want to clean up and save settings whenever the service is
> > > destroied. I tried do this in onDestroy() or finalize(), Neither
> > > satisfies my demand, onDestroy() is only called whe "Stop it in
> > > Application->Running Services", finalize() is never called in all
> > > above condition.
>
> > > Where is the rightpoint? pls help me, THANK YOU!
>
> > There is no "rightpoint" for those scenarios. Your code will not be
> > called. Hence, do not wait to be destroyed to "clean up and save
> > settings".
>
> > And, please do not leave your service running all of the time:
>
> >http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-a...
>
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com
> > Android App Developer Books:http://commonsware.com/books.html

-- 
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: Where can I catch a point that is assured to be called when a Service is destroied

2009-12-11 Thread zhiyazw
Who can help?

On 12月11日, 上午11时27分, zhiyazw  wrote:
> Thank you, Mark.
>
> I read your linked topic, But AlarmManager is not suitable to me.
>
> My service is not started periodically, it started by broadcast,
> Actually by "android.intent.action.PHONE_STATE".
>
> On each starting, the service should load a big database, this spend
> about serveral seconds, so I don't want to load it each time
> "android.intent.action.PHONE_STATE" arrive, I leave the service
> runing.
>
> For each "android.intent.action.PHONE_STATE", a UI should be present
> to user while calling, in order to show the UI in front of calling and
> not to interrupt the interaction with phone call, the UI should not be
> a activity, I user "WindowManager.LayoutParams.TYPE_SYSTEM_ALERT" with
> FLAG__NOT_FOCUSABLE.
>
> In above condition, except to Service, there is any better class I can
> use? pls advise me.
>
> If I have to user Service, Where should I do cleaning up and saving
> settings?
>
> Thank you!
>
> On Dec 10, 7:33 pm, "Mark Murphy"  wrote:
>
>
>
> > > I have a Service, it is started by StartService(...), my program never
> > > stop it. The service can be destroied in other cases, such as:
> > >   Stop it in Application->Running Services
> > >   run command: Kill 
> > >   System kill it in case of memory low
> > >   Phone shut down
> > >   other unlist condition...
>
> > > I want to clean up and save settings whenever the service is
> > > destroied. I tried do this in onDestroy() or finalize(), Neither
> > > satisfies my demand, onDestroy() is only called whe "Stop it in
> > > Application->Running Services", finalize() is never called in all
> > > above condition.
>
> > > Where is the rightpoint? pls help me, THANK YOU!
>
> > There is no "rightpoint" for those scenarios. Your code will not be
> > called. Hence, do not wait to be destroyed to "clean up and save
> > settings".
>
> > And, please do not leave your service running all of the time:
>
> >http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-a...
>
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com
> > Android App Developer Books:http://commonsware.com/books.html

-- 
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: Where can I catch a point that is assured to be called when a Service is destroied

2009-12-10 Thread zhiyazw
Thank you, Mark.

I read your linked topic, But AlarmManager is not suitable to me.

My service is not started periodically, it started by broadcast,
Actually by "android.intent.action.PHONE_STATE".

On each starting, the service should load a big database, this spend
about serveral seconds, so I don't want to load it each time
"android.intent.action.PHONE_STATE" arrive, I leave the service
runing.

For each "android.intent.action.PHONE_STATE", a UI should be present
to user while calling, in order to show the UI in front of calling and
not to interrupt the interaction with phone call, the UI should not be
a activity, I user "WindowManager.LayoutParams.TYPE_SYSTEM_ALERT" with
FLAG__NOT_FOCUSABLE.

In above condition, except to Service, there is any better class I can
use? pls advise me.

If I have to user Service, Where should I do cleaning up and saving
settings?

Thank you!

On Dec 10, 7:33 pm, "Mark Murphy"  wrote:
> > I have a Service, it is started by StartService(...), my program never
> > stop it. The service can be destroied in other cases, such as:
> >   Stop it in Application->Running Services
> >   run command: Kill 
> >   System kill it in case of memory low
> >   Phone shut down
> >   other unlist condition...
>
> > I want to clean up and save settings whenever the service is
> > destroied. I tried do this in onDestroy() or finalize(), Neither
> > satisfies my demand, onDestroy() is only called whe "Stop it in
> > Application->Running Services", finalize() is never called in all
> > above condition.
>
> > Where is the right point? pls help me, THANK YOU!
>
> There is no "right point" for those scenarios. Your code will not be
> called. Hence, do not wait to be destroyed to "clean up and save
> settings".
>
> And, please do not leave your service running all of the time:
>
> http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-a...
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> Android App Developer Books:http://commonsware.com/books.html

-- 
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] Where can I catch a point that is assured to be called when a Service is destroied

2009-12-10 Thread zhiyazw

Hello,

I have a Service, it is started by StartService(...), my program never
stop it. The service can be destroied in other cases, such as:
  Stop it in Application->Running Services
  run command: Kill 
  System kill it in case of memory low
  Phone shut down
  other unlist condition...

I want to clean up and save settings whenever the service is
destroied. I tried do this in onDestroy() or finalize(), Neither
satisfies my demand, onDestroy() is only called whe "Stop it in
Application->Running Services", finalize() is never called in all
above condition.

Where is the right point? pls help me, THANK YOU!

-- 
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 do some init operation immediately after install

2009-10-02 Thread zhiyazw

Anybody help?
--~--~-~--~~~---~--~~
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 do some init operation immediately after install

2009-09-29 Thread zhiyazw

There is a big database(15M) in my application,
it is too big to download the apk if I publish the source database in
myapp.apk.
So I encode the db to binary files(300k).

But the new problem is I should decode binary files and create the
database(with data), this procedure take about several minutes, so I
can NOT do this in SQLiteOpenHelper.onCreate(), this is too slow for
user experience(though it is a one time procedure, it is still
unacceptable).

My application has NO main activity entry in launcher, the main entry
is BroadcastReceiver.onReceive, the infomation should display to user
immediately when receiving the broadcast, so I have no chance to
display a several minutes "Initializing, please waiting..." UI.

The best chance to create database and init data immediately after
install, but how to do this, is there any broadcast? or is there any
AndroidManifest attribute?

pls help!

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