tags:

views:

25

answers:

1

My first screen has the alert message when I accept the alert I have to show the next screen and pass some values to that screen to show that values.I am very new to android.

new AlertDialog.Builder(this)
    .setTitle("File accept!")
    .setMessage("Do you Want to open "+name+" file !!")
    .setPositiveButton("Open", new DialogInterface.OnClickListener()
    {
        public void onClick(DialogInterface dlg,int acc)
        {
            //here i need to open a new screen
        }
    })
    .setNegativeButton("Close", new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dlg, int sumthin) {

    // do nothing – it will close on its own
    }
    })    
    .show();
    }   

--Thanks in advance

A: 

You want to create an Intent with the constructor that takes a context and a Class object. In this Intent you have to specify the class that handles the new screen. This class has to extend Activity.

To get the file name to the new screen use intent.putExtra to attach a data bundle to that intent. In your new activity you can use getIntent.getExtras() to retrieve the data attached to the Intent.

Janusz