当前位置: 首页>>代码示例>>Java>>正文


Java FoursquareApiException类代码示例

本文整理汇总了Java中fi.foyt.foursquare.api.FoursquareApiException的典型用法代码示例。如果您正苦于以下问题:Java FoursquareApiException类的具体用法?Java FoursquareApiException怎么用?Java FoursquareApiException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FoursquareApiException类属于fi.foyt.foursquare.api包,在下文中一共展示了FoursquareApiException类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadMayors

import fi.foyt.foursquare.api.FoursquareApiException; //导入依赖的package包/类
@Background
protected void loadMayors(){
    loading();
    try {
        Result<VenueHistoryGroup> userResult = api.mayorships("self");
        String error = userResult.getMeta().getErrorDetail();
        if(error != null && !error.equals("")){
            error(error);
            return;
        }
        setMayors(userResult.getResult().getItems());
    } catch (FoursquareApiException e) {
        Crouton.makeText(this, e.getMessage(), Style.ALERT);
    }
    loadingDone();
}
 
开发者ID:qbraet,项目名称:Check-Me-In,代码行数:17,代码来源:AddSearchActivity.java

示例2: loadVenueHistory

import fi.foyt.foursquare.api.FoursquareApiException; //导入依赖的package包/类
@Background
protected void loadVenueHistory(int days){
    loading();
    long now = System.currentTimeMillis();
    long before = now / 1000;
    long after = (now / 1000) - (60*60*24*days);
    try {
        Result<VenueHistoryGroup> result = api.usersVenueHistory("self", before, after);
        String error = result.getMeta().getErrorDetail();
        if(error != null && !error.equals("")){
            error(error);
            return;
        }
        setVenueHistory(result.getResult().getItems());
    } catch (FoursquareApiException e) {
        Crouton.makeText(this, e.getMessage(), Style.ALERT);
    }
    loadingDone();
}
 
开发者ID:qbraet,项目名称:Check-Me-In,代码行数:20,代码来源:AddSearchActivity.java

示例3: loadHistory

import fi.foyt.foursquare.api.FoursquareApiException; //导入依赖的package包/类
@Background
protected void loadHistory() {
    loading();
    try {
        Result<CheckinGroup> userResult = api.usersCheckins("self", 20, 0, null, null);
        String error = userResult.getMeta().getErrorDetail();
        if(error != null && !error.equals("")){
            error(error);
            return;
        }
        setCheckins(userResult.getResult().getItems());
    } catch (FoursquareApiException e) {
        Crouton.makeText(this, e.getMessage(), Style.ALERT);
    }
    loadingDone();
}
 
开发者ID:qbraet,项目名称:Check-Me-In,代码行数:17,代码来源:HistoryActivity.java

示例4: testSearchVenues

import fi.foyt.foursquare.api.FoursquareApiException; //导入依赖的package包/类
public void testSearchVenues() throws UnknownHostException, FoursquareApiException {
	Gson gson=new Gson();
	FoursquareSearchVenues fsv=new FoursquareSearchVenues();
	ArrayList<FoursquareObjectTemplate> array;
	array=fsv.searchVenues(1, 1, new Double(45.057), new Double(7.6613), new Double(45.0561), new Double(7.6600));
	String s=gson.toJson(array.get(1));
	s=s.replace("\"","");
	s=s.substring(0, 48);
	
	//Construct the test case
	String s1="{row:1,column:1,venueId:4e1028a36284edb6bacc6d51";
	
	//Start the tests
	//assertNotNull(array);
	//assertEquals(s1, s);	
}
 
开发者ID:giusepperizzo,项目名称:geosummly,代码行数:17,代码来源:FoursquareSearchVenuesTest.java

示例5: executeWithCoord

import fi.foyt.foursquare.api.FoursquareApiException; //导入依赖的package包/类
public void executeWithCoord( ArrayList<Double> coord, 
							  String out, 
							  int gnum, 
							  int rnum, 
							  CoordinatesNormalizationType ltype, 
							  long sleep,
							  boolean secondLevel) 
									  throws IOException, 
									  FoursquareApiException, 
									  InterruptedException {
	
	//Create the grid
	BoundingBox bbox = new BoundingBox(coord.get(0), 
					   				   coord.get(1), 
					   				   coord.get(2), 
					   				   coord.get(3));
	
	ArrayList<BoundingBox> data=new ArrayList<BoundingBox>();
	Grid grid=new Grid();
	grid.setCellsNumber(gnum);
	grid.setBbox(bbox);
	grid.setStructure(data);
	if(rnum>0)
		grid.createRandomCells(rnum);
	else
		grid.createCells();
	
	collectAndTransform(bbox, data, out, sleep, secondLevel);
}
 
开发者ID:giusepperizzo,项目名称:geosummly,代码行数:30,代码来源:SamplingOperator.java

示例6: getCategoryTree

import fi.foyt.foursquare.api.FoursquareApiException; //导入依赖的package包/类
/**
 * Get the 4square category tree
*/
public HashMap<String, String> getCategoryTree() throws FoursquareApiException, IOException {
	
	Result<Category[]> result= foursquareApi.venuesCategories();
	Category[] mainTree = result.getResult();
	HashMap<String, String> map = new HashMap<String, String>();
	
	//Top categories
	for(int i=0;i<mainTree.length;i++) {
		String cat = mainTree[i].getName();
		Category[] subTree = mainTree[i].getCategories();
		
		//Subcategories
		for(int j=0;j<subTree.length;j++) {
			String subCat = subTree[j].getName();
			Category[] subSubTree = subTree[j].getCategories();
			
			//Subsubcategories
			for(int k=0;k<subSubTree.length;k++) {
				map.put(subSubTree[k].getName(), subCat);
			}
			
			map.put(subCat, cat);
		}
		
		map.put(cat, null);
	}
	
	return map;
}
 
开发者ID:giusepperizzo,项目名称:geosummly,代码行数:33,代码来源:FoursquareSearchVenues.java

示例7: searchVenues

import fi.foyt.foursquare.api.FoursquareApiException; //导入依赖的package包/类
/**Search venues informations. Row and column informations are included*/
public ArrayList<FoursquareObjectTemplate> searchVenues(int row, 
														int column, 
														Double north, 
														Double east, 
														Double south, 
														Double west) 
														throws FoursquareApiException, 
															   UnknownHostException {
	
	try {
		String ne=north+","+east;
		String sw=south+","+west;
		Map<String, String> searchParams = new HashMap<String, String>(); 
		searchParams.put("intent", "browse");
		searchParams.put("ne", ne); 
		searchParams.put("sw", sw);
		ArrayList<FoursquareObjectTemplate> doclist = 
								new ArrayList<FoursquareObjectTemplate>(); 
	    
	    //After client has been initialized we can make queries.
	    Result<VenuesSearchResult> result = foursquareApi.venuesSearch(searchParams);
		//For debug
	    System.out.println("here");
		System.out.println(result.getMeta().getCode());
		System.out.println("");
	    if(result.getMeta().getCode() == 200) {  	
    		
	    	FoursquareObjectTemplate dataobj;
	    	
	    	for(CompactVenue venue : result.getResult().getVenues()) {
	    		
	    		dataobj=new FoursquareObjectTemplate(row, 
	    											 column, 
	    											 venue.getId(), 
	    											 venue.getName(), 
	    											 venue.getLocation().getLat(),
	    											 venue.getLocation().getLng(), 
	    											 venue.getCategories(), 
	    											 venue.getContact().getEmail(),
	    											 venue.getContact().getPhone(), 
	    											 venue.getContact().getFacebook(), 
	    											 venue.getContact().getTwitter(), 
	    											 venue.getVerified(), 
	    											 venue.getStats().getCheckinsCount(), 
	    											 venue.getStats().getUsersCount(), 
	    											 venue.getUrl(), 
	    											 venue.getHereNow().
	    											 getCount(), 
	    											 this.timestamp);
	    		doclist.add(dataobj);
	    	}
	    	
	    	return doclist;
    	} 
    	else {
    			logger.log(Level.INFO, "Error occurred:\ncode: "+
    					   result.getMeta().getCode()+
    					   "\ntype: "+result.getMeta().getErrorType()+
    					   "\ndetail: "+result.getMeta().getErrorDetail());
    			
    			return doclist;
	    }
	} 
	catch(Exception e) {
		e.printStackTrace(); 
		return null;
	}
}
 
开发者ID:giusepperizzo,项目名称:geosummly,代码行数:70,代码来源:FoursquareSearchVenues.java


注:本文中的fi.foyt.foursquare.api.FoursquareApiException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。