我可以创建一个没有负或正按钮的对话框.具体行动后,它会自我毁灭吗?
AlertDialog.Builder dialog_detect= new AlertDialog.Builder(MainActivity.this);
dialog.setTitle("Detecting.....");
dialog.setMessage("Please Wait");
dialog.show();
Run Code Online (Sandbox Code Playgroud) 我有一个程序.第一个活动是启动画面,第二个是登录,第三个是列表视图菜单活动,然后是其他2个活动.启动画面在3秒后消失,如果登录复选框记住我,则会直接进入菜单页面.
我覆盖onBackPressed
菜单活动中的功能,以便在用户从菜单中单击后直接退出程序.但是,如果我经历了其他活动,它就不会退出; 它会转到堆栈中的上一个活动,并且对话框不会弹出,虽然它实际上确实会出现一秒钟并且立即消失.
这是我的 onBackPressed
功能
public void onBackPressed() {
// super.onBackPressed();
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you Sure want to close the Application..?")
.setCancelable(false)
.setTitle("EXIT")
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
});
AlertDialog alert = builder.create();
alert.show();
//super.onBackPressed();
}
Run Code Online (Sandbox Code Playgroud) List<MasterBook> listOfBooks = new List<MasterBook>();
Run Code Online (Sandbox Code Playgroud)
之后我把masterbook对象放入列表中,其中有3个字段(name,id和active)
GridView1.DataSource = listOfBooks;
GridView1.DataBind();
Run Code Online (Sandbox Code Playgroud)
在网络表单中
<Columns>
<asp:TemplateField HeaderText="Book Name">
<ItemTemplate>
<asp:Label ID="BookNameText" runat="server"
Text="<%#Container.DataItem%>">
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Run Code Online (Sandbox Code Playgroud)
问题是,我想在gridview列中显示bookmaster的名称,这个代码在列中打印bookmaster如何让它键入名称