I use appcompat library and support library v4 to host some fragments for
tabs. In a specific fragment A, I need to do network operation. In order
not to block the UI thread, I execute an AsyncTask in fragment A and do the
network operation in doInBackGround() of the AsyncTask.
To prevent
I use appcompat library to host some fragments for tabs. In a specific
fragment A, I need to do network operation. In order not to block the UI
thread, I use an AsyncTask and do the network operation in
doInBackGround().
To prevent messing around keep AsyncTask to survive rotation in the
15, 2013 1:52:22 PM UTC+3, Greenhand wrote:
Thanks for pointing out the mistakes. The whole code is too long to post
and maintain readability so I just put some snippet. The MyAsyncTask
having a constructor named GetTokenAsyncTask is a typo, the constructor
should named MyAsyncTask
I followed the way that
http://developer.android.com/guide/topics/ui/actionbar.html#Tabs says to
use appcompat actionbar to add tabs.
However, I found that the added fragments oncreateview() will be called
twice.
After searching the web, I found there is a workaround solution at
I followed the way that
http://developer.android.com/guide/topics/ui/actionbar.html#Tabs says to
use appcompat actionbar to add tabs.
However, I found that the oncreateview() of added fragments will be called
twice.
After searching the web, I found there is a workaround solution at
Same.
Although it is an old thread, I encounter the same issue, too. I find the
thread
http://stackoverflow.com/questions/11001475/listfragment-is-inflated-twice.
It says put initLoader in onCreate() according to Fragment lifecycle (
I read https://developer.android.com/training/basics/actionbar/styling.html and
use
style name=MyActionBar
parent=@style/Widget.Holo.Light.ActionBar.Solid.Inverse
*item name=android:background@drawable/actionbar_background
/item*
/style
to set the ActionBar background.
launcher icon: 1
action bar logo: 1
The Android 2.2 emulator behaves strangely. Why? Is it a bug?
On Thursday, August 22, 2013 12:22:25 AM UTC+8, TreKing wrote:
On Wed, Aug 21, 2013 at 11:06 AM, Greenhand coopera...@gmail.comjavascript:
wrote:
Is there a correct code snippet
4.1.2
launcher icon: 1
action bar logo: 1
The Android 2.2 emulator behaves strangely. Why? Is it a bug?
On Thursday, August 22, 2013 12:22:25 AM UTC+8, TreKing wrote:
On Wed, Aug 21, 2013 at 11:06 AM, Greenhand coopera...@gmail.comjavascript:
wrote:
Is there a correct code snippet
4.1.2
launcher icon: 1
action bar logo: 1
The Android 2.2 emulator behaves strangely. Why? Is it a bug?
On Thursday, August 22, 2013 12:22:25 AM UTC+8, TreKing wrote:
On Wed, Aug 21, 2013 at 11:06 AM, Greenhand coopera...@gmail.comjavascript:
wrote:
Is there a correct code snippet
I read http://developer.android.com/guide/topics/ui/actionbar.html and it
says
Using a logo instead of an icon
By default, the system uses your application icon in the action bar, as
specified by the
I have read about the TabHost (
http://developer.android.com/reference/android/widget/TabHost.html).
However, I still do not know how to make a custom style tab like the
attachment. Is there a way to do so?
--
--
You received this message because you are subscribed to the Google
Groups
For asynctask to deal with activity rotation, I find this solution:
https://github.com/commonsguy/cw-android/blob/master/Rotation/RotationAsync/src/com/commonsware/android/rotation/async/RotationAsync.java
.
However, getlastnonconfigurationinstance() is deprecated in API level 13 (
Although I can keep the ratio, I do not know what my background height is
from parameters.
Could you give me some code snippetss?
lbendlin於 2013年1月26日星期六UTC+8下午7時33分50秒寫道:
Now that you have extended the object you can change the calculations for
measure to achieve your desired effect while
上午3時57分31秒寫道:
The quickest solution would be to create a custom imageview that extends
imageview, and then handle the onLayout and onMeasure yourself.
On Friday, January 25, 2013 12:59:38 AM UTC-5, Greenhand wrote:
Because if I changed the two inner image views to match_parent
In my scenario, I have a task to run but I do not want it to block my UI
thread. Therefore, I adopt AsyncTask. IntentService can run a task at a
time on another Thread but I do not know how to cancel it as mentioned
earlier.
The problem I would like to deal with is that when user press back
, at which point the Activity will be thrown away: along
with its contents. Of course, if you're holding onto Views elsewhere
that's bad (i.e., don't hold static refs).
kris
On Mon, Jan 14, 2013 at 1:42 AM, Greenhand
coopera...@gmail.comjavascript:
wrote:
I read
http://android
the fact that I proposed it myself, at one
point) are just Voodoo.
G. Blake Meike
Marakana
Programming Android 2ed is now in stores:
http://bit.ly/programmingandroid
On Monday, January 14, 2013 1:10:52 AM UTC-8, Greenhand wrote:
Thank you.
Another related question, in section 5
I read
http://android-developers.blogspot.tw/2009/01/avoiding-memory-leaks.html about
avoiding memory leaks.
I would like to know whether I should null out all member variables, such
as TextView and Button in onDestroy()? Or, unregistering listener,
unbinding service and etc.in onDestroy() are
I would like to ask about the
com.example.android.apis.app.FragmentRetainInstance.java in android api
demo 4.0.3, which demos how to use fragment to handle configuration changes
such as rotation.
At line 44-47
if (savedInstanceState == null) {
I followed the steps in
http://mavenlog.wordpress.com/2012/01/22/how-to-adding-a-calendar-in-the-android-ics-emulator/
to
add my Gmail account to the built in Calendar app in Android 4.0.3 emulator.
Then, I adpated the code snippet in
At http://developer.android.com/guide/components/fragments.html, it
mentions If you provide neither of the previous two, the system uses the
ID of the container view. in the section of Adding a fragment to an
activity. What does the ID of the container view means?
--
You received this message
I think I am confused.
If the entire Android UI is completely thread safe and the events are
queued, the event should be processed one by one. I would like to know why
an inconsistent state can be seen during the execution even if I do not
start a new thread in my code.
G. Blake Meike於
In my project, I has a layout as follows:
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:layout_width=fill_parent
android:layout_height=fill_parent
android:orientation=vertical
Button
android:id=@+id/startButton
at 11:30 AM, Greenhand cooperateonl...@gmail.com wrote:
If I use startService(), can theActivitycommunicate with theService
and vice versa?
startService() uses a variation of the command pattern: you
communicate with theservicevia extras on the Intent passed to
startService() as the command
the new one. more
clearly, such as some code fragments?
I have never used a fragement. Is it different from Activity when it
comes to handling bound service on rotation?
On 6月3日, 下午10時08分, Mark Murphy mmur...@commonsware.com wrote:
On Sun, Jun 3, 2012 at 10:04 AM, Greenhand cooperateonl
has leaked ServiceConnection that
was originally bound here at the line with !!! mark.
On 6月4日, 下午5時45分, Kostya Vasilyev kmans...@gmail.com wrote:
04.06.2012 13:06, Greenhand написал:
I modify my code and use bindService(new
Intent(getApplicationContext(), MessengerService.class
In onDestroy(), I checked whether the Activity is finishing and bound.
If so, I unbindService().
if(isFinishing() serviceBound){
unbindService(serviceConnection);
Log.d(MyMediaPlayerActivity,Activity: unbindService());
}
On 6月4日, 下午9時04分, Greenhand cooperateonl...@gmail.com wrote:
I
if (!mBound) return; to prevent
null pointer exception but user will perceived that the button is not
working before the callback is called. Is there a better way to solve
it?
On 6月4日, 下午9時20分, Mark Murphy mmur...@commonsware.com wrote:
On Mon, Jun 4, 2012 at 9:17 AM, Greenhand cooperateonl
Thank you!
On 6月4日, 下午10時05分, Mark Murphy mmur...@commonsware.com wrote:
Disable the button until it is usable.
On Mon, Jun 4, 2012 at 9:57 AM, Greenhand cooperateonl...@gmail.com wrote:
It works! The context is so mysterious in Android.
Another question, in the tutorial (http
If I change the MessengerService into an media player service, a user
can control the media player by the ServiceConnection in the Activity
and the media player service can update the UI according to the state
of media player. The downside is that the playback will be stopped
when a user leaves
If I use startService(), can the Activity communicate with the Service
and vice versa?
On 6月4日, 下午11時15分, Mark Murphy mmur...@commonsware.com wrote:
Don't use bindService(). Use startService().
On Mon, Jun 4, 2012 at 11:11 AM, Greenhand cooperateonl...@gmail.com wrote:
If I change
For the communication between Activity and Service, I followed the
http://developer.android.com/guide/topics/fundamentals/bound-services.html#Messenger
to implement an Activity that binds a Service.
However, the Service will be killed and created when the Activity is
rotating. Is there a way to
Thank you!
On 5月24日, 上午12時59分, Kostya Vasilyev kmans...@gmail.com wrote:
Androidsources are available here:
http://source.android.com/
For quickly jumping from docs to source, I often use this:
https://chrome.google.com/webstore/detail/hgcbffeicehlpmgmnhnkjbjoldk...
AndroidSDK Reference
Handler() from an activty's callback such
as onCreate will be connected to the same message loop as well.
-- K
On 05/22/2012 07:00 PM, Greenhand wrote:
But if we use an Activity reference directly (i.e. call a method in
the Activity), will it also send a message to the message loop? I
treking...@gmail.com wrote:
On Mon, May 21, 2012 at 8:48 AM, Greenhand cooperateonl...@gmail.comwrote:
I would like to know further about no messages will be processed between
onRetainNonConfigurationInstance() to the following onCreate() under the
hood, replied by Dianne Hackborn.
You might
But if we use an Activity reference directly (i.e. call a method in
the Activity), will it also send a message to the message loop? I am
afraid that the method called by Activity reference and the
configuration change may happen concurrently.
Does the message loop mentioned here is the same as
I read the thread AsyncTask and screen rotation in this group. I
would like to know further about no messages will be processed
between onRetainNonConfigurationInstance() to
the following onCreate() under the hood, replied by Dianne Hackborn.
If reading some Android source code is needed,
I followed the section named Adding a UI test of the
tutorial at
http://developer.android.com/resources/tutorials/testing/activity_test.html.
I was confused about why it wanted to interact with UI by UI-thread
and send keys via instrumentation at the same test testSpinnerUI()
method. I think
I would like to write an application which can scan Bluetooth devices
around it, log their location and do periodically upload to server. To
save energy, I hope to turn off location update when there are no
Bluetooth devices detected.
My current design is use an Activity and an IntentService
40 matches
Mail list logo