Dialo

by Fluckysan » Tue, 09 Jun 2009 01:19:04 GMT


Sponsored Links
 Hello everybody,
i just begin with the SDK so I play around but I'm stuck with a really
simple Dialog.show() ...
It maybe is because it'es really late or something but here my code :

public class entry extends Activity {
        static final int CREATE_DIALOG = 0;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.entry);
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();

        inflater.inflate(R.menu.menu_bottom, menu);
        return true;
    }

    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
                case R.id.create:
                    this.showDialog(CREATE_DIALOG);

                return true;
            }

            return false;
    }

        protected Dialog onCreateDialog(int id) {
                Dialog dialog;

                switch(id) {
                    case CREATE_DIALOG:
                        dialog = new Dialog(this.getApplicationContext());

                        dialog.setContentView(R.layout.create_dialog);
                        dialog.setTitle("Pwals");
                    break;

                    default:
                        dialog = null;
                    break;
            }

            return dialog;
        }
}

The XMLs are just as simple as this code and they are running good
It crash when I it the menu button "create"
What I haven't understand :s ?

Thx for your answer

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



Other Threads

1. OnTouchListener: return true or false?

Hi all,

Whe you try to manage the event on an element using OnTouchListener
you have 3 states:
DOWN, MOVE and UP.

The implement of this method must return a boolean value.

If in my MOVE case, I return true...the method continues to be parse
until the last return value. Why?

What is the normal behaviour when I return true? false?

Thanks for your help
--~--~---------~--~----~------------~-------~--~----~

2. Can not build android source code in Fedora 10

I do exactly as the guild in the http://source.android.com

But when I use make to build, it complained no javac, so I add sun jdk
1.6's bin to the PATH.

And it now complained there is no g++....

I search the whole repo of fedora 10 and there is no such a thing. the
most likely one comes from android's source code... So I add

android/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/arm-eabi/bin/

to the $PATH.

and this time,  error for cc1plus....

It looked everyone's build go smooth... Am I doomed?

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

3. 1.5 and maps.jar

4. How to delete textfiles from the device.

5. String comparison with Text in EditText with online data.

6. Maps API

7. Changing ringer volume