import java.util.ArrayList;
public class TimetableActivity extends AppCompatActivity {
RecyclerView recyclerView3;
MyRecyclerAdapter3 adapter;
ArrayList<S3List> arr = new ArrayList<S3List>();
String strS3id;
int s2id;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_timetable);
Intent intent = getIntent();
final String strS2id = intent.getExtras().getString("strS2id");
s2id = Integer.parseInt(strS2id);
String strS1name = intent.getExtras().getString("strS1name");
String strS2date = intent.getExtras().getString("strS2date");
ActionBar ab = getSupportActionBar();
ab.setTitle(strS1name + " > " + strS2date);
TextView textViewName = (TextView)findViewById(R.id.empty_view);
textViewName.setText("방문일정을 추가해주세요.");
recyclerView3 = (RecyclerView)findViewById(R.id.recyclerView3);
recyclerView3.setLayoutManager(new LinearLayoutManager(this));
recyclerView3.setItemAnimator(new DefaultItemAnimator());
adapter = new MyRecyclerAdapter3(arr, R.layout.list_s3);
rcViewUpdate(s2id);
recyclerView3.addOnItemTouchListener(new RecyclerViewOnItemClickListener(getApplicationContext(), recyclerView3, new RecyclerViewOnItemClickListener.OnItemClickListener() {
@Override
public void onItemClick(View v, int position) {
String strpid = arr.get(position).getPid();
Intent intent = new Intent(TimetableActivity.this, PlaceInformationActivity.class);
intent.putExtra("strpid", strpid);
startActivity(intent);
}
@Override
public void onItemLongClick(View v, int position) {
strS3id = arr.get(position).getS3id();
private void rcViewUpdate(int id) {
DBAccess access = new DBAccess(this);
access.openDataBase();
arr.clear();
Cursor c = access.dbS3Select(id);
while (c.moveToNext()) {
String s3id = c.getString(0);
String s2id = c.getString(1);
String pid = c.getString(2);
String stime = c.getString(3);
String etime = c.getString(4);
String pname = c.getString(5);
S3List s3List = new S3List();
s3List.setS3id(s3id);
s3List.setS2id(s2id);
s3List.setPid(pid);
s3List.setsTime(stime);
s3List.seteTiem(etime);
s3List.setPname(pname);
arr.add(s3List);
}
recyclerView3.setAdapter(adapter);
}
@Override
public void onResume() {
super.onResume();
rcViewUpdate(s2id);
}
}
배열을 받아와서 배열에 아무것도 저장이 되어있지 않을경우
방문 일정을 추가해주세요 라는 메세지를 띄워주고싶은데
이 부분을
TextView textViewName = (TextView)findViewById(R.id.empty_view);
textViewName.setText("방문일정을 추가해주세요.");
if(arr.size() == 0) or if(arr.isEmpty == true) 로 해도
전혀 인식을 못하고 메세지가 계속 나옵니다.
이런 경우에는 어떻게 조건을 넣어야할지 모르겠습니다 ㅠ


이런식으로 아예 텍스트가 고정이 되어있습니다.