我是一名java初学者,我一直在思考如何
为了解决这个问题,我希望我的TextView
钱可以得到
号码EditText
进入AlertDialog
,我该怎么办?
package com.example.user123.income;
import android.app.DatePickerDialog;
import android.content.DialogInterface;
import android.app.AlertDialog;
import java.util.Calendar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
public class Income extends AppCompatActivity implements
AdapterView.OnClickListener,
AdapterView.OnItemClickListener,
DialogInterface.OnClickListener,DatePickerDialog.OnDateSetListener{
final java.util.Calendar c= java.util.Calendar.getInstance();
TextView date,money;
ImageButton food,drinks,transport,games,housing,medical,pet,others;
EditText edit,view;
AlertDialog entermoney;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_income);
date=(TextView)findViewById(R.id.date);
date.setOnClickListener(this);
date.setText(c.get(Calendar.YEAR)+"/"+(c.get(Calendar.MONTH))+1+"/"+c.get(Calendar.DAY_OF_MONTH));
money=(TextView)findViewById(R.id.money);
food=(ImageButton)findViewById(R.id.food);
drinks=(ImageButton)findViewById(R.id.drinks);
transport=(ImageButton)findViewById(R.id.transport);
games=(ImageButton)findViewById(R.id.games);
housing=(ImageButton)findViewById(R.id.housing);
medical=(ImageButton)findViewById(R.id.medical);
pet=(ImageButton)findViewById(R.id.pets);
others=(ImageButton)findViewById(R.id.others);
edit=(EditText)findViewById(R.id.edit);
entermoney=new AlertDialog.Builder(this)
.setTitle("Enter the amount")
//.setMessage("???")
.setPositiveButton("OK",null)
.show();
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
}
@Override
public void onClick(DialogInterface dialog, int which) {
}
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
}
@Override
public void onClick(View v) {
if(v==date){
new DatePickerDialog(this,this,
c.get(Calendar.YEAR),
c.get(Calendar.MONTH),
c.get(Calendar.DAY_OF_MONTH)).show();
}
}
}