使用自带电子邮件与html源码获取工具的结合保存网页的方法

2016-08-12 06:28:58 -0400
package com.example.alertdialog;import com.example.alertdialog.*;import android.os.Bundle;import android.app.Activity;import android.app.AlertDialog;import android.content.DialogInterface;import android.content.Intent;import android.view.Menu;import android.view.View;publicclassMainActivityextendsActivity{@Overrideprotectedvoid onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);}publicvoid open(View view){AlertDialog.Builder alertDialogBuilder =newAlertDialog.Builder(this); alertDialogBuilder.setMessage(R.string.decision); alertDialogBuilder.setPositiveButton(R.string.positive_button,newDialogInterface.OnClickListener(){@Overridepublicvoid onClick(DialogInterface arg0,int arg1){Intent positveActivity =newIntent(getApplicationContext(),com.example.alertdialog.PositiveActivity.class); startActivity(positveActivity);}}); alertDialogBuilder.setNegativeButton(R.string.negative_button,newDialogInterface.OnClickListener(){@Overridepublicvoid onClick(DialogInterface dialog,int which){Intent negativeActivity =newIntent(getApplicationContext(),com.example.alertdialog.NegativeActivity.class); startActivity(negativeActivity);}});AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show();}@Overridepublicboolean onCreateOptionsMenu(Menu menu){// Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu);returntrue;}}下面是默认代码 src/com.yiibai.alertdialog/PositiveActivity.javapackage com.example.alertdialog;import android.os.Bundle;import android.app.Activity;import android.view.Menu;publicclassPositiveActivityextendsActivity{@Overrideprotectedvoid onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState); setContentView(R.layout.activity_positive);}@Overridepublicboolean onCreateOptionsMenu(Menu menu){// Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.positive, menu);returntrue;}}下面是默认代码 src/com.yiibai.alertdialog/NegativeActivity.javapackage com.example.alertdialog;import android.os.Bundle;import android.app.Activity;import android.view.Menu;publicclassNegativeActivityextendsActivity{@Overrideprotectedvoid onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState); setContentView(R.layout.activity_negative);}@Overridepublicboolean onCreateOptionsMenu(Menu menu){// Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.negative, menu);returntrue;}}这里是修改后的代码 res/layout/activity_main.xml这里是修改后的代码 res/layout/activity_positive.xml这里是修改后的代码res/layout/activity_negative.xml这里是修改后的代码 Strings.xmlAlertDialogSettingsHello world!PositiveActivityNegativeActivityPositive ActivityNegative ActivityAre you sure, you wanted to make this decision+ive-ive这里是默认的代码 AndroidManifest.xml从Android Studio 中运行应用程序,打开你的项目的活动文件中的一个,并在工具栏点击运行图标图标。启动应用程序之前会显示如下窗口,选择要运行 Android应用程序的选项。选择移动设备作为一个选项,然后查看移动设备将显示如下界面:现在,轻按按钮“hello world”看到警告框,这将是这样的现在,选择任意两个按钮中的一个,看到了各自的活动装载启动起来。如果选择"positve"按钮,此屏幕会出现现在按后退按钮,这一次从警告对话框中选择“negative”。下面的屏幕会出现在这个时间代码下载:http://pan.baidu.com/s/1GrnOU标签:Android Alertdialog 警告 对话框 本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动共创优秀实例教程转载请注明:文章转载自:易百教程[http:/www.yiibai.com]本文标题:Android Alertdialog(警告
«Newer      Older»
Comment:
Name:

Back to home

Subscribe | Register | Login | 中文 | N