/*packages and imports*/
public class BookmarkDialoge extends Activity
{
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.bookmarksaver);
}
public void bookmarking(View v)
{
EditText bookmarking=(EditText)findViewById(R.id.bookmarkname);
final String bookMarkname=bookmarking.getText().toString();
String pathdir= getIntent().getExtras().getString("bookpath");
String address=getIntent().getExtras().getString("chapterAddress");
System.out.println("book directory in bookmark class is "+ pathdir);
SQLiteDatabase db;
db=openOrCreateDatabase("epub.db",SQLiteDatabase.CREATE_IF_NECESSARY,null);
db.setLocale(Locale.getDefault());
db.setLockingEnabled(true);
db.setVersion(1);
try
{
String updateQuery1 = "UPDATE BookMark SET addresname=? WHERE bookdir=? AND lastaddress=?";
db.execSQL(updateQuery1, new String[] { bookMarkname, pathdir,address });
System.out.println("Bookmark table updated with name");
}
catch(Exception e)
{
System.out.println(e);
}
finally
{
db.close();
}
}
}
并且在清单中我将此活动视为
<activity android:theme="@android:style/Theme.Holo.Dialog" >
它显示为一个对话
这是我的班级一切运作良好,但我需要在点击按钮后关闭dialogebox,意味着它应该消失,(它作为一个弹出框) 我该怎么办?请帮忙
答案 0 :(得分:1)
您只需finish()
关闭按钮Activity
活动中的onClick()