Radio buttons' and checkboxes' text goes behind the buttons themselves?

by Romain Guy » Mon, 07 Apr 2008 01:01:00 GMT


Sponsored Links
 >  And, if I have a horizontal LinearLayout and put an element in the

It's not a workaround, it is how it is supposed to work.

-- 
Romain Guy
www.curious-creature.org

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Problem when coming back to activity after changing font in Galaxy S

Hi All,
 I am going through a strange behaviour. I have Two activities in my
application - ActivityOne and ActivityTwo. Both are very simple
activities and have only basic lifecycle methods overrridden.

Steps to reproduce this are as follows:
1. I am launching ActivityTwo by clicking on a button on ActivityOne.
For this I am using startActivityForResult() method.
2. Now when I am on ActivityTwo, I long press home key and go to
Settings > Display > Font Style. and change fonts.
3. Now I go back to ActivityTwo by pressing back button.
4. On ActivityTwo I press again back key.

Ideally while pressing back on ActivityTwo, It should call
AcitivityOne's onActivityResult() method.
But Here I saw, that first iActivityOne's onDestroy(), then onCreate()
and then onActivityResult() is called.
Because onCreate() is getting called it again launches ActivityTwo and
hence it feels to user that ActivityTwo is coming twice while pressing
back and user has to press back button twice for going to
ActivityOne.

This is a very strange behavoiur.

On digging more i found out that when font are getting changed, they
are restarting all packages. Hence all the activities are getting
created(instantiated) again. Because of this the first instance of
ActivityOne is getting killed and a new instance is getting created.
Because of this onCreate method is called and it again launches
ActivityTwo.

Here my problem is that, I can not make my activities singleinstance
or singletask. This is a requirement.

I also found that the same situation occurs in many of the pre-
installed applications or any of the newly created method.

My questions are:
1. Is there any config attribute for font changes? I tried to find out
in android docs and in google also but no luck yet.
2. If there is no config attribute, then please tell me the ways to
handle this situation. Its very weired situation for the user

ActivityOne Code is

public class ActivityOne extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button button = (Button) findViewById(R.id.btn_launch);
        button.setOnClickListener(new View.OnClickListener() {

                        public void onClick(View v) {
                                Log.d("ActivityOne", "<SURESH> 
setOnClickListener()");
                                Intent intent = new Intent();
                                intent.setComponent(new 
ComponentName("com.demo.backpress",
"com.demo.backpress.ActivityTwo"));
                                startActivityForResult(intent, 1);
                        }
                });
    }

        @Override
        protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
                super.onActivityResult(requestCode, resultCode, data);

                if(resultCode == RESULT_CANCELED) {
                        Toast.makeText(this, "First activity cancelled",
Toast.LENGTH_LONG);
                }
                Log.d("ActivityOne", "<SURESH> onActivityResult() resultCode 
==> " +
resultCode + " -:- requestCode ==> " + requestCode + " -:- data ==> "
+ data);
        }
}

ActivityTwo Code is :

public class ActivityTwo extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d("ActivityTwo", "<SURESH> onCreate()");
        setContentView(R.layout.main_two);
    }

        @Override
        protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
                super.onActivityResult(requestCode, resultCode, data);
                Log.d("ActivityTwo", "<SURESH> onActivityResult() resultCode 
==> " +
resultCode + " -:- requestCode ==> " + requestCode + " -:- data ==> "
+ data);
        }
}

-- 

2. Syntax error: Unterminated quoted string

I'm following the basic instructions for setting up an Android
application with Eclipse and just after creating a new project,
without modifying any sources, I get the following error when I try to
run it in the emulator:

[2011-05-20 00:02:13 - bla] Device API version is 10 (Android 2.3.3)
[2011-05-20 00:02:13 - bla] Uploading bla.apk onto device
'emulator-5554'
[2011-05-20 00:02:13 - bla] Installing bla.apk...
[2011-05-20 00:02:13 - bla] Success!
[2011-05-20 00:02:13 - bla] Starting activity com.bla.bla.bla on
device emulator-5554
[2011-05-20 00:02:13 - bla] ActivityManager: am: 1: Syntax error:
Unterminated quoted string

I fail to see any problem in any of the sources, and my attempts to
find that unterminated string anywhere in the generated sources have
failed so far. This happens to me with the following version:

Eclipse Eclipse IDE for Java Developers
Version: Helios Service Release 2
Build id: 20110218-0911

SDK Platform Android 2.3.3, API 10, revision 1
Android SDK Tools, revision 11

Mac OS X 10.6.7

Can anyone explain that error? If you need more information, please
let me know.

And please Cc: my on answers.

Thanks,
Daniel

-- 

3. Java Guru needed -- compiler bug?

4. Specific drawable not working?????

5. Devs with paid apps -- check your enabled countries

6. I connect Acer iconia a500 with ddms

7. Orientation change and setRender