时间影响两个textview android studio
The time affects both textview android studio
我有一个 question.I 有两个文本视图用于设置开始时间和结束时间 time.These 连接到日历 class 并获取日期。当我尝试获取开始时间时,我可以获取但它的放置日期都是 textview 。我如何将其分开?
TextView bastarihi,bittarihi;
String year,month,day,year1,month1,day1;
String a="a";
private TextView clickedTextview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_izin);
bastarihi=(TextView)findViewById(R.id.bastarihi);
bittarihi=(TextView)findViewById(R.id.bitistarihi);
bastarihi.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clickedTextview=(TextView)v;
Intent intent=new Intent(IzinActivity.this,Calendarr.class);
intent.putExtra("a",a);
startActivity(intent);
}
});
Intent intent1 = getIntent();
year=intent1.getStringExtra("year");
month = intent1.getStringExtra("month");
day = intent1.getStringExtra("day");
if (clickedTextview != null)
clickedTextview.setText(year + "-" + month + "-" + day );
bittarihi.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
clickedTextview = (TextView) view;
Intent intent=new Intent(IzinActivity.this,Calendarr.class);
intent.putExtra("a",a);
startActivity(intent);
}
});
Intent intent2 = getIntent();
year1=intent2.getStringExtra("year");
month1 = intent2.getStringExtra("month");
day1 = intent2.getStringExtra("day");
if (clickedTextview != null)
clickedTextview.setText(year + "-" + month + "-" + day );
CallBack callBack1 = new CallBack() {
您在 intent2
中的意图相同,请尝试将您的代码移至 OnClickListener
中。也许你应该看看这里:https://developer.android.com/training/basics/intents/result。您可以使用 onActivityResult(int requestCode, int resultCode, Intent resultIntent)
从 Calendarr
class 接收日期。希望对您有所帮助!
我有一个 question.I 有两个文本视图用于设置开始时间和结束时间 time.These 连接到日历 class 并获取日期。当我尝试获取开始时间时,我可以获取但它的放置日期都是 textview 。我如何将其分开?
TextView bastarihi,bittarihi;
String year,month,day,year1,month1,day1;
String a="a";
private TextView clickedTextview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_izin);
bastarihi=(TextView)findViewById(R.id.bastarihi);
bittarihi=(TextView)findViewById(R.id.bitistarihi);
bastarihi.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clickedTextview=(TextView)v;
Intent intent=new Intent(IzinActivity.this,Calendarr.class);
intent.putExtra("a",a);
startActivity(intent);
}
});
Intent intent1 = getIntent();
year=intent1.getStringExtra("year");
month = intent1.getStringExtra("month");
day = intent1.getStringExtra("day");
if (clickedTextview != null)
clickedTextview.setText(year + "-" + month + "-" + day );
bittarihi.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
clickedTextview = (TextView) view;
Intent intent=new Intent(IzinActivity.this,Calendarr.class);
intent.putExtra("a",a);
startActivity(intent);
}
});
Intent intent2 = getIntent();
year1=intent2.getStringExtra("year");
month1 = intent2.getStringExtra("month");
day1 = intent2.getStringExtra("day");
if (clickedTextview != null)
clickedTextview.setText(year + "-" + month + "-" + day );
CallBack callBack1 = new CallBack() {
您在 intent2
中的意图相同,请尝试将您的代码移至 OnClickListener
中。也许你应该看看这里:https://developer.android.com/training/basics/intents/result。您可以使用 onActivityResult(int requestCode, int resultCode, Intent resultIntent)
从 Calendarr
class 接收日期。希望对您有所帮助!