是否可以在不必点击/设置PositiveButton / NegativeButton的情况下关闭AlertDialog?
val hiveContext = new org.apache.spark.sql.hive.HiveContext(sc)
import hiveContext.implicits._
val lst = List(Seq("Hello","Hyd","Hello","Mumbai"),Seq("Hello","Mumbai"),Seq("Hello","Delhi","Hello","Banglore"))
case class Tweets(filtered: Seq[String])
val df = sc.parallelize(lst).map(x=>Tweets(x)).toDF
import org.apache.spark.sql.expressions.Window
import org.apache.spark.sql.functions._
val w = org.apache.spark.sql.expressions.Window.orderBy('cnt.desc)
df.select(explode($"filtered").as("value")).groupBy("value").agg(count("*").alias("cnt")).withColumn("filteredrank", rank.over(w)).filter(col("filteredrank") <= 20).show()
使用添加到我的布局的自定义按钮,我想点击它并让它关闭AlertDialog。
我目前共有3个按钮
我在布局中添加了另外两个,所以我可以使用Snackbar警报,我知道我可以通过使用setNeutralButton来实现这一点,但它不会显示SnackBar警报。
答案 0 :(得分:0)
我这个代码会起作用 -
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
final FrameLayout customView= (FrameLayout) View.inflate(this, R.layout.custome_view, null);
final Button button = (Button) customView.findViewById(R.id.my_button);
button.setText(mTvEmail.getText().toString());
builder.setView(customView);
final AlertDialog alertDialog = builder.create();
alertDialog.show();
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
alertDialog.dismiss();
}
});
答案 1 :(得分:0)
为了使这更容易,这就是整个事情
BioPython