switch / if statement, efficiency question

by Kent Yip » Thu, 30 Apr 2009 01:44:23 GMT


Sponsored Links
 a switch statement is made for nested if statements.

switch statement is greate if you have a bunch of selections, to make a
switch statement perform better you have to look at what user will likely
selection the most, and implement that case on the top most case in the
switch. Accessing that case will be faster than accessing cases at lower end
of the switch statement.








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



switch / if statement, efficiency question

by Kent Yip » Thu, 30 Apr 2009 04:35:45 GMT


 thx fadden for the info.






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


Sponsored Links


Other Threads

1. What would an intent URI look like for numeric data?

Does it need to be in the data field? Normally you'd use
Intent.putExtra() for this.






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

2. PreferenceActivity with blur behind?

I'm trying to use a PreferenceActivity with prefs inflated from XML
and at the same time I'd like the window to blur whatever was behind
(i.e. my previous activity where I invoked the settings from.) I tried
something like this below but the background is always black (or
whatever color I select) without any blur/transparency.

Is it possible? what am I doing wrong?

public class PrefsActivity extends PreferenceActivity {

    @Override
        protected void onCreate(Bundle savedInstanceState) {
        // Have the system blur any windows behind this one.
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
                WindowManager.LayoutParams.FLAG_BLUR_BEHIND);

                super.onCreate(savedInstanceState);
                
                setTitle(R.string.prefs_title);
                addPreferencesFromResource(R.xml.prefs);

            View content = findViewById(android.R.id.content);
            content.setBackgroundColor(0x7F000000);
        
            getListView().setBackgroundColor(0x7F000000);
            getListView().setCacheColorHint(0x7F000000);
        }
}

R/

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

3. adding Textviews and radio button in code

4. What would an intent URI look like for numeric data?

5. Where can i find a (complete) reference of XML files for layouts/drawables/etc

6. Will it work if I setListViewAdapter dynamically?

7. Poll activity state?