I enclose my code:
Builder builder = new AlertDialog.Builder (this.Context); / / create dialog
builder.setTitle (R.string.tip); / / set the dialog title
builder.setMessage (R.string.not_setting_current_region); / / Settings dialog information
/ * Set dialog confirmation button * /
builder.setPositiveButton (R.string.confirm, new DialogInterface.OnClickListener ()
{
@ Override
public void onClick (DialogInterface dialog, int which)
{
dialog.dismiss ();
Intent intent = new Intent (Activity_SSGJ.this, Activity_select_City.class);
startActivity (intent);
Log.i (YangJ, "you click on the OK!");
}
});
I do not understand is why this jump was unsuccessful, click OK to stop? Great God seeking education<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
So write should be fine, ah, what's your problem?
Reply:
Intent intent = new Intent (Activity_SSGJ.this, Activity_select_City.class);
Activity_SSGJ.this.startActivity (intent);
Try this
Reply:
Error Log paste ~
Reply:

There is a null pointer exception.
Reply:
like this is not OK
Reply:
Builder builder = new AlertDialog.Builder (this); / / create dialog
builder.setTitle ("title"); / / Set the dialog title
builder.setMessage ("test"); / / Settings dialog information
/ * Set dialog confirmation button * /
builder.setPositiveButton ("OK", new DialogInterface.OnClickListener () {
public void onClick (DialogInterface dialog, int which) {
dialog.dismiss ();
Intent intent = new Intent (MainActivity.this, TwoActivity.class);
MainActivity.this.startActivity (intent);
}
.}) Show ();
I tried the normal jump ah. . .
Reply:
1, these two plus AlertDialog dialog = builder.create ();
dialog.show ();
Reply:
There is a list of files in your activity registered yet
Reply:
public class MainActivity extends Activity {
private Button btn;
@ Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);
btn = (Button) findViewById (R.id.button1);
btn.setOnClickListener (new OnClickListener ()
{
@ Override
public void onClick (View arg0)
{
AlertDialog.Builder builder = new Builder (MainActivity.this);
builder.setMessage ("Confirm Exit right?");
builder.setTitle ("Tip");
builder.setPositiveButton ("Confirm", new DialogInterface.OnClickListener () {
@ Override
public void onClick (DialogInterface dialog, int which) {
dialog.dismiss ();
Intent intent = new Intent (MainActivity.this, MainActivity2.class);
startActivity (intent);
}
});
builder.setNegativeButton ("Cancel", new DialogInterface.OnClickListener () {
@ Override
public void onClick (DialogInterface dialog, int which) {
dialog.dismiss ();
}
});
builder.create () show ();.
}
});
}
I wrote one, not being given ah
You refer to
Reply:
Builder builder = new AlertDialog.Builder (this.Context); / / create dialog
- "
Builder builder = new AlertDialog.Builder (this); / / create dialog
I do not know what your this.Context is combined with a test of children's shoes, 6th Floor, reckoned that the problem is
Reply:
my grass, and I built a project can be jump. Spicy next door
Reply:
registered estimated I have a problem code structure
Reply:
Get.

Reply:
This is how you solve the landlord, I also encountered the same problem
No comments:
Post a Comment