Android日历和PhoneGap

时间:2012-03-24 14:59:07

标签: android mobile cordova

我想在android日历中导出一些数据,我正在使用此代码:

Intent calIntent = new Intent();
calIntent.setAction(Intent.ACTION_INSERT);
calIntent.setClass(this, StudysysActivity.class);

calIntent.setType("vnd.android.cursor.item/event");
calIntent.putExtra(Events.TITLE, "My House Party");
calIntent.putExtra(Events.EVENT_LOCATION, "My Beach House");
calIntent.putExtra(Events.DESCRIPTION, "A Pig Roast on the Beach");

GregorianCalendar calDate = new GregorianCalendar(2012, 7, 15);
calIntent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true);
calIntent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME,
    calDate.getTimeInMillis());
calIntent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME,
    calDate.getTimeInMillis());
startActivity(calIntent);

当我在我的主类中使用它时,这段代码很棒,但是如果我在第二课时使用这段代码,那么与javascript代码交互的内容 - 应用程序崩溃了。

第二类代码:

public class CustomNativeAccess extends DroidGap {
private WebView mAppView;
private Cursor mCursor = null;
private DroidGap mGap;
public static Context mContext;

public CustomNativeAccess(DroidGap gap, WebView view) {

    mAppView = view;
    mGap = gap;
}

public String getImeiNumber(String test) {
Intent calIntent = new Intent();
calIntent.setAction(Intent.ACTION_INSERT);
calIntent.setClass(this, StudysysActivity.class);

calIntent.setType("vnd.android.cursor.item/event");
calIntent.putExtra(Events.TITLE, "My House Party");
calIntent.putExtra(Events.EVENT_LOCATION, "My Beach House");
calIntent.putExtra(Events.DESCRIPTION, "A Pig Roast on the Beach");

GregorianCalendar calDate = new GregorianCalendar(2012, 7, 15);
calIntent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true);
calIntent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME,
        calDate.getTimeInMillis());
calIntent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME,
        calDate.getTimeInMillis());
startActivity(calIntent);
    String asd = test;
    return asd;
}
}

03-26 00:06:46.812: E/dalvikvm(30770): JNI ERROR (app bug): accessed stale local reference 0x35 (index 13 in a table of size 2)
03-26 00:06:46.820: E/dalvikvm(30770): VM aborting
03-26 00:06:46.820: A/libc(30770): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1)

0 个答案:

没有答案