我想知道,或者当用户点击谷歌地图上的任何位置时,有人可以指导我如何操作。弹出“对话框或权限请求”,向用户显示“您要在此处放置标记吗?”我带有一个复选框,上面写着“是”或“否”。如果用户选择是,则标记将放置在该位置,如果不是,则不会发生任何事情。这是可以做的吗?有这样一个问题的简单解决方案吗?任何参考资料或想法将不胜感激。
由于
答案 0 :(得分:0)
非常简单,向void *handy(void *arguments)
{
handarg *thestruct=(handarg*)arguments;
DIR *dp=opendir(thestruct->directory);
DIR *outExist=opendir(thestruct->outputdirectory);
if(outExist==NULL)
{
if((thestruct->outputdirectory = ""))
{
;
}
else
{
printf("The outputdirectory doesnt exist, program terminated\n");
exit(1);
}
}
struct dirent *entry; // has two important members (d-type)-tells me if its a directory (d-name) tells me current file name
if(dp==NULL)
{
printf("directory doesnt exist: %s\n", thestruct->directory);
exit(1);
}
NODE *head=(NODE*)malloc(sizeof(NODE)); //linked list
NODE *ptr=(NODE*)malloc(sizeof(NODE));//node POINTER
head=NULL;
int count;
while((entry=readdir(dp))!=NULL)
{
if(strcmp(entry->d_name,"..")==0||strcmp(entry->d_name,".")==0)
{
continue;
}
if((entry->d_type==DT_DIR))
{
unsigned int const sz1 = strlen(thestruct->directory);
unsigned int const sz2 = strlen(entry->d_name);
char *dnewname=(char *)malloc((sz1+sz2+2)*sizeof(char));
memcpy(dnewname,thestruct->directory,sz1);
memcpy(dnewname+sz1,"/",sizeof(char));
memcpy(dnewname+sz1+1,entry->d_name,sz2);
dnewname[strlen(dnewname)]='\0';
pthread_t tid;
handarg *current=(handarg*)malloc(sizeof(handarg));//malloc
current->directory=dnewname;
current->outputdirectory=thestruct->outputdirectory;
current->column=thestruct->column;
pthread_create(&tid,NULL,&handy,current);
printf("The Filepath is: %s, The Parent TID = %ld, THE peer TID = %ld\n",dnewname, pthread_self(), tid);
NODE *newNode=(NODE*)malloc(sizeof(NODE));
if(head==NULL)
{
head=newNode;
ptr=newNode;
newNode->peerTid=tid;
newNode->next=NULL;
//printf("THE TID I PUT INTO THIS NODE IS %ld\n",ptr->peerTid);
}
else
{
ptr=head;
while(ptr->next!=NULL)
{
ptr=ptr->next;
}
ptr->next=newNode;
newNode->peerTid=tid;
newNode->next=NULL;
//printf("THE TID I PUT INTO THIS NODE IS %ld\n",ptr->peerTid);
}
//pthread_join(tid,NULL);
// dont want to do this this does not make sense you
// create all your child threads make sure they are running KEEP Track of them (know their tid ) //create an array of tids or linked list then for loop
//for loop tids and wait on all of them
// then join all the threads (wait)
//say y ou have ann array of 5 tids for loop the array and call wait on each of tids for loop only exit if last tid is waiting on
}
if((entry->d_type==DT_REG))
{
char *filename = entry->d_name;
int len = strlen(filename);
const char *last_four = &filename[len-4]; //need to account for if filename is less than 4 characters
if(strcmp(last_four,".csv")==0)
{
//here is where i call handle file and merge sort
char *dnewname = (char*)malloc(sizeof(char)*(strlen(thestruct->directory)+strlen(entry->d_name)+2));
char *slash = (char*)malloc(sizeof(char));
strcpy(dnewname, thestruct->directory);
strcpy(slash, "/");
strcat(dnewname, slash);
strcat(dnewname, entry->d_name);
dnewname[strlen(dnewname)]='\0';
pthread_t tid;
handarg *current=(handarg*)malloc(sizeof(handarg));
current->directory=dnewname;
current->outputdirectory=thestruct->outputdirectory;
current->column=thestruct->column;
pthread_create(&tid,NULL,&handleFile,current);
printf("The Filepath is: %s, The Parent TID = %ld, THE peer TID = %ld\n",dnewname, pthread_self(), tid);
NODE *newNode=(NODE*)malloc(sizeof(NODE));
if(head==NULL)
{
head=newNode;
ptr=newNode;
newNode->peerTid=tid;
newNode->next=NULL;
//printf("THE TID I PUT INTO THIS NODE IS %ld\n",ptr->peerTid);
}
else
{
ptr=head;
while(ptr->next!=NULL)
{
ptr=ptr->next;
}
ptr->next=newNode;
newNode->peerTid=tid;
newNode->next=NULL;
//printf("THE TID I PUT INTO THIS NODE IS %ld\n",ptr->peerTid);
}
}
}
}
ptr=head;
printf("\nthese are the items from the linkedlist\n\n");
while (ptr!=NULL)
{
printf("%ld\n",ptr->peerTid);
ptr=ptr->next;
}
printf("\n");
ptr=head;
while (ptr!=NULL)
{
printf("THE PEER THREAD I AM WAITING ON IS %ld --------I AM THE THREAD %ld\n",ptr->peerTid,pthread_self());
pthread_join(ptr->peerTid,NULL);
ptr=ptr->next;
}
printf("\n");
//return NULL;
}
添加点击监听器,并在{/ 1}}中显示googlemap
,如
AlertDialog