如何添加位置不仅仅是NSString而且还有纬度和经度,所以它在日历中也显示了一个地图?
<EKCalendarItem>
Run Code Online (Sandbox Code Playgroud)
@property(nonatomic, copy) NSString *location;
Run Code Online (Sandbox Code Playgroud)
代码:
EKEventStore *store = [[EKEventStore alloc] init];
[store requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
if (!granted) { return; }
EKEvent *event = [EKEvent eventWithEventStore:store];
event.title = @"Event Title";
event.startDate = [NSDate date]; //today
event.endDate = [event.startDate dateByAddingTimeInterval:60*60]; //set 1 hour meeting
event.notes=@"Note";
event.location=@"Eiffel Tower,Paris"; //how do i add Lat & long / CLLocation?
event.URL=[NSURL URLWithString:shareUrl];
[event setCalendar:[store defaultCalendarForNewEvents]];
NSError *err = nil;
[store saveEvent:event span:EKSpanThisEvent commit:YES error:&err];
NSString *savedEventId = event.eventIdentifier; //this is …
Run Code Online (Sandbox Code Playgroud) 我使用gridview显示数字,所以如果我点击任何数字,下一个活动应该开始.我尝试了这段代码,但应用程序崩溃了
private GridView gridView = null;
gridView.setOnClickListener(new OnClickListener()
{
public void onClick(View v5)
{
setContentView(R.layout.Abc);
Intent myIntent = new
Intent(getApplicationContext(),Abc.class);
startActivity(myIntent);
}
});
Run Code Online (Sandbox Code Playgroud)
这是gridview的xml代码
<GridView
android:id="@+id/month_gridView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/calendar_days"
android:layout_marginLeft="7dp"
android:layout_marginRight="8dp"
android:background="@color/grid_background"
android:fadingEdge="none"
android:gravity="top|left"
android:horizontalSpacing="2dp"
android:listSelector="@android:color/transparent"
android:numColumns="7"
android:padding="1dp"
android:stretchMode="columnWidth"
android:verticalSpacing="2dp">
</GridView>
Run Code Online (Sandbox Code Playgroud)
logcat文件日志
02-04 00:10:50.603: D/AndroidRuntime(341): Shutting down VM
02-04 00:10:50.603: W/dalvikvm(341): threadid=1: thread exiting with uncaughtexception(group=0x40015560)
02-04 00:10:50.635: E/AndroidRuntime(341): FATAL EXCEPTION: main
02-04 00:10:50.635: E/AndroidRuntime(341): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.indianic.demo.calendark/com.indianic.demo.calendark.CalendarActivity}: java.lang.RuntimeException: Don't call setOnClickListener for an AdapterView. You probably …
Run Code Online (Sandbox Code Playgroud) 我想\ ,,/
在Java中显示 为字符串,但我得到无效的转义序列.
尝试了所有可能的方法
String Metal= "'\'"+",,/";
Toast a= Toast.makeText(getApplicationContext(), Metal, Toast.LENGTH_LONG);
a.show();
String Metal= "\"+",,/";
Run Code Online (Sandbox Code Playgroud)
得出结论 ",,/
我怎样才能做到这一点?
android ×2
java ×2
ekevent ×1
ekeventkit ×1
ekeventstore ×1
ios ×1
objective-c ×1
string ×1
xml ×1