本文将分享android–如何在自定义位置发布签到(如foursquare)的详细内容,并且还将对android实现签到功能进行详尽解释,此外,我们还将为大家带来关于AndroidEspresso:如
本文将分享android – 如何在自定义位置发布签到(如foursquare)的详细内容,并且还将对android实现签到功能进行详尽解释,此外,我们还将为大家带来关于Android Espresso:如何在自定义微调器选择的项目布局上匹配文本?、android – Custom Square LinearLayout.怎么样?、android – Foursquare Venue类别网址图标 – 访问被拒绝、android – Foursquare用户检查V2的相关知识,希望对你有所帮助。
本文目录一览:- android – 如何在自定义位置发布签到(如foursquare)(android实现签到功能)
- Android Espresso:如何在自定义微调器选择的项目布局上匹配文本?
- android – Custom Square LinearLayout.怎么样?
- android – Foursquare Venue类别网址图标 – 访问被拒绝
- android – Foursquare用户检查V2
android – 如何在自定义位置发布签到(如foursquare)(android实现签到功能)
在尝试发布checkin时,我将地址=(某些网址如“http://www.example.com/jeffys_burgers.html”)以及来自android app的lat,long坐标和facebook user_id传递给它
responds {“error”:{“message”:“(#100)需要有效的地方信息页ID”,“类型”:“OAuthException”,“code”:100}}.
我的查询是如何在我的Facebook应用程序中指定操作,对象类型,以便我可以从Android应用程序传递适当的参数,以便在自定义位置发布签入?
解决方法
记住,对象类型Place是“Facebook Place”.你的jeffys_burgers.html应该有og:type = yournamespace:venue(如果你决定调用你的对象类型“Venue”),并拥有这个地方:location:纬度和地点:location:经度集.
Android Espresso:如何在自定义微调器选择的项目布局上匹配文本?
我有带有自定义布局的微调器:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_icon"
android:layout_width="60dp"
android:layout_height="60dp" />
<TextView
android:id="@+id/tv_text"
android:textColor="#FFFFFF"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
我需要检查所选项目的R.id.tv_text中的值是否与特定文本匹配.
是否可以在不实现自定义Matcher类的情况下做到这一点?
我的简单测试:
@SmallTest
public class CategoryTest {
public static final String TEXT_TO_MATCH = "Spinner item text";
@Test
public void testCreate() {
...
onView(withId(R.id.spn_tt)).perform(click()); // open spinner
onView(allOf(withId(R.id.tv_text), withText(TEXT_TO_MATCH))).perform(click()); // find item by text and click
onView(withId(R.id.spn_tt)).check(matches(withTextInSpinnerSelectedView(TEXT_TO_MATCH))); // check if right item selected by text
}
}
解决方法:
除了创建在Spinner选定项目的任何TextView(或其继承人)中查找特定文本的自定义匹配器之外,我没有找到更简单的方法.我有一个自定义匹配器:https://gist.github.com/igorokr/5f3db37f0b9eb8b2feae
android – Custom Square LinearLayout.怎么样?
我为方形布局创建了自己的类:
public class SquareLayout extends LinearLayout{
public SquareLayout(Context context) {
super(context);
}
public SquareLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public SquareLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
int size = width > height ? height : width;
setMeasuredDimension(size, size);
}
然后,在我的xml中:
...
<com.myApp.SquareLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:orientation="horizontal" >
<ImageView
android:id="@+id/cellImageView"
android:adjustViewBounds="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:padding="2dp"
android:scaleType="centerCrop"
android:src="@drawable/image" />
</com.myApp.SquareLayout>
...
我的java代码中没有更多内容.
但相反,如果我的布局和我的图像,我只看到一个白色的矩形……
我错了什么?
解决方法:
//你忘记调用super.onMeasure(widthMeasureSpec,widthMeasureSpec);
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, widthMeasureSpec);
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
int size = width > height ? height : width;
setMeasuredDimension(size, size);
}
// xml文件
<com.example.testapplication.SquareLayout
android:id="@+id/layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:orientation="horizontal" >
<ImageView
android:id="@+id/cellImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:adjustViewBounds="true"
android:padding="2dp"
android:scaleType="centerCrop"
android:src="@drawable/ic_launcher" />
</com.example.testapplication.SquareLayout>
android – Foursquare Venue类别网址图标 – 访问被拒绝
当我将场地放在地图上时,一些请求会返回拒绝访问
这是一个例子:
https://ss1.4sqi.net/img/categories/education/administrativebuilding_32.png
<Error> <Code>AccessDenied</Code> <Message>Access Denied</Message> <RequestId>A25C4A76CBE89768</RequestId> <HostId>BQQK0z2iGYhmxjUJvlTz2vUWYO4wTF8lE7g6LuS1jHXNmwT88FwvfObPqyPzWOne</HostId> </Error>
解决方法
android – Foursquare用户检查V2
我正在使用Foursquare的v2来允许用户登录到指定的地点.我正在尝试签署请求,但到目前为止,我得到以下内容
u'Meta': {
u'errorType': u'param_error',
u'code': 400,
u'errorDetail': u'Invalid checkin id'
},
u'response': {
}
}
我这样做的方式如下,移动用户向我的网页发送一个请求,其中包含场地ID和他们的用户ID,Web处理程序执行以下操作
venueID = self.request.get("venue")
user = self.request.get("user")
params = {
'oauth_token': user
}
consumer = oauth2.Consumer(key=keys.CLIENT_ID,secret=keys.CLIENT_SECRET)
params.update({'signature': hunchMethods.sign_request(params, keys.CLIENT_SECRET)})
check_in_req = "https://api.foursquare.com/v2/checkins/" + venueID + "?" + urllib.urlencode(params)
print check_in_req
url1 = fetch(check_in_req)
json_response = simplejson.loads(url1.content.encode('utf-8'))
print json_response
我的签名请求方法如下:
def sign_request(query_dict, data):
queries = sorted( (unicode(k).encode('utf-8'), unicode(v).encode('utf-8'))
for k,v in query_dict.iteritems() )
data = urllib.urlencode(queries) + data
UPDATE
感谢@Drew我意识到我正在尝试实现错误的方法,因为我已经更新了我的代码
def post(self, info):
venueID = self.request.get("venue")
user = self.request.get("user")
venue = venue_id_change.retrieveNewID(venueID, user)
url = "https://api.foursquare.com/v2/checkins/add?venueId=" +venue+ "&oauth_token=" + user + "&broadcast=private"
logging.info(url)
url1 = fetch(url)
json_response = simplejson.loads(url1.content.encode('utf-8'))
虽然这似乎没有做任何事情:-(我错过了什么?
解决方法:
您似乎使用了错误的API方法.
The method you’re using获取签入ID并返回现有签到的详细信息.
This one获取场地ID并创建新的签到.
关于android – 如何在自定义位置发布签到(如foursquare)和android实现签到功能的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于Android Espresso:如何在自定义微调器选择的项目布局上匹配文本?、android – Custom Square LinearLayout.怎么样?、android – Foursquare Venue类别网址图标 – 访问被拒绝、android – Foursquare用户检查V2等相关内容,可以在本站寻找。
本文标签: