小编Plu*_*rge的帖子

从Android上的Google Place API获取城市名称和邮政编码

我正在使用适用于Android的Google Place API并使用自动填充功能

一切正常,但是当我得到这里显示的结果时,我没有城市和邮政编码信息.

    private ResultCallback<PlaceBuffer> mUpdatePlaceDetailsCallback
        = new ResultCallback<PlaceBuffer>() {
    @Override
    public void onResult(PlaceBuffer places) {
        if (!places.getStatus().isSuccess()) {
            // Request did not complete successfully
            Log.e(TAG, "Place query did not complete. Error: " + places.getStatus().toString());

            return;
        }
        // Get the Place object from the buffer.
        final Place place = places.get(0);

        // Format details of the place for display and show it in a TextView.
        mPlaceDetailsText.setText(formatPlaceDetails(getResources(), place.getName(),
                place.getId(), place.getAddress(), place.getPhoneNumber(),
                place.getWebsiteUri()));

        Log.i(TAG, "Place details …
Run Code Online (Sandbox Code Playgroud)

android city postal-code google-places-api

17
推荐指数
4
解决办法
3万
查看次数

切换用户或重新通过Instagram进行身份验证

Instagram文档之后,我能够对用户进行身份验证并轻松检索access_token

但是现在我想更改Instagram帐户,这是不可能的,因为浏览器会自动调用我的回调URL,因为我已经使用帐户登录(没有再次登录/授权表单)

解释这里发生的是验证/授权流程:

  1. 打开浏览器,要求用户进行日志记录和授权
  2. 用户填写表单并提交(当用户已登录时,将跳过此步骤!)
  3. 浏览器重定向到回调URL

您看到第2步被跳过,因此我们无法使用其他用户登录

Instagram是否有强制重新登录的参数?

authentication android webview access-token instagram

8
推荐指数
1
解决办法
2207
查看次数

自定义XML属性,没有自定义View in Fragment

我正在尝试在现有View中添加自定义XML属性

将它们添加到自定义视图并不是一件大事,但我不知道如何在"基本"视图中访问这些属性(例如TextView,LinearLayout,ImageView ......)

当涉及片段和/或图书馆项目时,这将更加困难

到目前为止,这是我的代码

海关属性定义和XML(attrs.xml和布局):

<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="StarWars">
    <attr name="jedi" format="string" />
    <attr name="rank" format="string" />
</declare-styleable>
Run Code Online (Sandbox Code Playgroud)

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:sw="http://schemas.android.com/apk/res-auto"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">

<TextView
    android:id="@+id/name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="28dp"
    android:gravity="center_horizontal"
    sw:jedi="Obiwan" />

<TextView
    android:id="@+id/rank"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="28dp"
    android:gravity="center_horizontal"
    sw:rank="Master" />
Run Code Online (Sandbox Code Playgroud)

因为我在片段上膨胀这个(所以没有onCreate与attrs arg!),尝试获得2个sw自定义属性的唯一方法是:

  1. 将自定义LayoutInflater.Factory设置为onCreateView中的Fragment LayoutInflater

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      super.onCreateView(inflater, container, savedInstanceState);
    
      LayoutInflater layoutInflater = inflater.cloneInContext(inflater.getContext());
      layoutInflater.setFactory(new StarWarsLayoutFactory());
    
      View fragmentView = layoutInflater.inflate(R.layout.jedi, container, false);
      ((TextView) fragmentView.findViewById(android.R.id.jedi)).setText("Yep");
    
      return fragmentView;
    }
    
    Run Code Online (Sandbox Code Playgroud)
  2. 尝试在自定义LayoutInflater.Factory上获取自定义属性:

    public class StarWarsLayoutFactory …
    Run Code Online (Sandbox Code Playgroud)

android android-xml android-fragments android-view android-custom-attributes

6
推荐指数
1
解决办法
3769
查看次数

使用模板建议的模式在hook_theme()中不起作用

我正在尝试实现模式和模板建议,但它不起作用.
这是hook_theme()我的模式的实现 :

$theme['nm_home_page_zone'] = array(
  'pattern' => 'nm_home_page_zone__',
  'arguments' => array('nodes_content' => array(), 'nodes' => array()),
  'template' => 'zone-contenu',
),
Run Code Online (Sandbox Code Playgroud)

theme()用以下代码调用:

$output .= theme(array('nm_home_page_zone__'.$rowZone->model.'_'.$rowZone->weight, 'nm_home_page_zone__'.$rowZone->model, 'nm_home_page_zone'), array(), array());
Run Code Online (Sandbox Code Playgroud)

我在我的主题和模块中有2个模板文件(zone-contenu.tpl.php和zone-contenu - one.tpl.php)(只是为了确定).
在我的情况下,模式和模板建议应该使用zone-contenu - one.tpl.php,但它不起作用.

我在这里缺少什么?

drupal drupal-6 drupal-theming

4
推荐指数
1
解决办法
1301
查看次数