小编Gab*_*aby的帖子

月份名称为字符串

我试图将月份的名称作为字符串返回,例如"May","September","November".

我试过了:

int month = c.get(Calendar.MONTH);
Run Code Online (Sandbox Code Playgroud)

但是,这会返回整数(分别为5,9,11).我怎样才能获得月份名称?

android calendar

76
推荐指数
8
解决办法
11万
查看次数

Android中的空光标

我的应用程序中存在问题.我有一些列表,每个都有一个日期.如果列表的日期是今天我发了通知,并在我的通知中我放了该列表中的项目.问题是,如果我的列表为空,我会强制关闭.我把条件只在光标不为空时发出通知,但似乎这不起作用.你能帮我找到问题所在吗?

这是代码的一部分:

cr = db.fetchListId(id);
startManagingCursor(cr);

s = new StringBuilder(100);
if (cr != null) {
  do {
    String myList = "";
    myList += cr.getString(2) + " " + cr.getString(3)
      + cr.getString(4) + "," + "\n";
    s.append(myList);

  } while (cr.moveToNext());
  s.append('.');
  System.out.println("!!heyeheeye!" + s + "!!!!");
  hey(list);
}

where hey(list) is a function where is made the notification.

  private void hey(String list) {
  notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
  CharSequence NotificationTicket = "Hey";

  long when = System.currentTimeMillis();

  Notification notification = new Notification(R.drawable.icon,
                                               NotificationTicket, …
Run Code Online (Sandbox Code Playgroud)

notifications android

5
推荐指数
1
解决办法
1991
查看次数

标签 统计

android ×2

calendar ×1

notifications ×1