Skip to content
Snippets Groups Projects
Commit d3627bde authored by Shaobo Xu (shx863)'s avatar Shaobo Xu (shx863)
Browse files

Delete viewevent.java

parent 0128bcab
No related branches found
No related tags found
No related merge requests found
package com.example.event36;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.res.ResourcesCompat;
import android.app.Application;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.icu.util.GregorianCalendar;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
public class viewevent extends AppCompatActivity {
protected String name, Stringdate, startTime, endTime, location, description,event="0";
protected String day = "", month="", year="";
protected Button confirm, cancel;
protected List<String> time_list;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_viewevent);
TextView tvname = findViewById(R.id.event_name);
TextView tvdate = findViewById(R.id.event_date);
TextView tvstartTime = findViewById(R.id.event_start_time);
TextView tvendTime = findViewById(R.id.event_end_time);
TextView tvlocation = findViewById(R.id.event_location);
TextView tvdescription = findViewById(R.id.event_description);
name = getIntent().getStringExtra("name");
Stringdate = getIntent().getStringExtra("date");
startTime = getIntent().getStringExtra("startTime");
endTime = getIntent().getStringExtra("endTime");
location = getIntent().getStringExtra("location");
description = getIntent().getStringExtra("description");
tvname.setText(name);
tvdate.setText(Stringdate);
tvstartTime.setText(startTime);
tvendTime.setText(endTime);
tvlocation.setText(location);
tvdescription.setText(description);
//Add activity for two buttons
confirm = (Button) findViewById(R.id.button_confirm);
cancel =(Button) findViewById(R.id.button_cancel);
confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//time_list=get_date(Stringdate);
Intent intent =new Intent(viewevent.this,MainActivity.class);
intent.putExtra("new_event_name",name);
intent.putExtra("new_year", time_list.get(2));
intent.putExtra("new_month", time_list.get(1));
intent.putExtra("new_day", time_list.get(0));
intent.putExtra("new_location",location);
intent.putExtra("new_description",description);
intent.putExtra("new_event", event );
startActivity(intent);
}
});
}
//covert date from string to GregorianCalendar
public List<String> get_date(String date){
for (int i= 0; i<date.length(); i++){
char ch=date.charAt(i);
year = year + ch;
if(date.charAt(i)=='/'&&i<=2){
day=day+year;
year="";
}
if (date.charAt(i)=='/'&&i<=5){
month=month+year;
year="";
}
year = year + ch;
if(Stringdate.charAt(i)=='/'){
year="";
}
}
List<String> dat_l= new ArrayList<>();
dat_l.add(day);
dat_l.add(month);
dat_l.add(year);
return dat_l;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment