小编Bri*_*ian的帖子

如何显示然后删除android进度对话框

我可以使用以下代码显示进度条

pd = ProgressDialog.show(myActivity.this, "", "Loading. Please wait...", true);
Run Code Online (Sandbox Code Playgroud)

直截了当,但是一旦我有代码执行,我希望它消失,但是当我在看不到对话框显示之后运行dismiss方法时.

下面是包含在oncreate中的上下文中的代码

pd = ProgressDialog.show(myActivity.this, "", "Loading. Please wait...", true);
runCode();  
setListAdapter(new CustomAdapter(myActivity.this)); 
pd.dismiss();
Run Code Online (Sandbox Code Playgroud)

我以为你可以在活动的任何地方显示/解除进度对话框,但我一定是错的.

android progressdialog

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

尝试启用与Android应用的深度链接,测试意图无法启动活动

我正在尝试启用深层链接,以便某些链接启动我的应用程序。

我读了这个教程https://developer.android.com/training/app-indexing/deep-linking.html并非常接近它,但是当我尝试使用adb将VIEW意图发送到该应用程序进行测试时,我只是得到错误

Error: Activity not started, unable to resolve Intent { act=android.intent.actio
n.VIEW dat=example://gizmos flg=0x10000000 pkg=com.myapp.DeepLinkActivity }
Run Code Online (Sandbox Code Playgroud)

DeepLinkActivity.java

public class DeepLinkActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getIntent().getAction() == Intent.ACTION_VIEW) {
        Uri uri = getIntent().getData();

    }

  }
}
Run Code Online (Sandbox Code Playgroud)

Android Manifest宣布Deeplink活动

<activity android:name="com.myapp.DeepLinkActivity" >
        <intent-filter>

            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />


            <data
                android:host="gizmos"
                android:scheme="example" />
            <!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
            <data
                android:host="www.example.com"
                android:pathPrefix="gizmos"
                android:scheme="http" />
        </intent-filter>
    </activity>
Run Code Online (Sandbox Code Playgroud)

ADB命令发送视图意图

adb …
Run Code Online (Sandbox Code Playgroud)

android deep-linking android-manifest android-intent

4
推荐指数
2
解决办法
5582
查看次数

PHP和Composer,我如何组合composer.json文件

有人可以解释我应该如何使用PHP的作曲家.我在我的doc根目录下有一个composer.json文件,它下载了我的项目的核心包,但是当我想添加另一个像google + php sdk这样的项目时,请点击此处https://github.com/googleplus/gplus-quickstart-php /

我该怎么处理composer.json文件?我手动组合它们?我只是将composer.json下载到另一个目录中吗?

我当前的composer.json文件看起来像这样

 {
"name": "fuel/fuel",
"type": "metapackage",
"description": "The FuelPHP framework",
"keywords": ["framework"],
"homepage": "http://fuelphp.com",
"license": "MIT",
"authors": [
    {
        "name": "FuelPHP Development Team",
        "email": "team@fuelphp.com"
    }
],
"support": {
    "irc": "irc://irc.freenode.org/fuelphp",
    "forum": "http://fuelphp.com/forums"
},
"require": {
    "php": ">=5.3.3",
    "monolog/monolog": "1.5.*",
    "fuelphp/upload": "2.0",
    "omissis/php-cloudfiles": "dev-master",
    "mustache/mustache": "*"
},
"suggest": {
    "mustache/mustache": "Allow Mustache templating with the Parser package",
    "smarty/smarty": "Allow Smarty templating with the Parser package",
    "twig/twig": "Allow Twig templating with the Parser package", …
Run Code Online (Sandbox Code Playgroud)

php package-managers fuelphp composer-php

3
推荐指数
1
解决办法
4444
查看次数

如何使用jquery-mobile界面在photoswipe中使用事件处理程序

我试图做一些图像处理的东西取决于我与我的画廊关联的任意数据.

  gallery.html('');
    $.each(data.photos, function(key, photo) {

        var item = "<li><a href='http://stage.domain.com/assets/img/user/"+photo.full+"'><img src='http://stage.domain.com/assets/img/user/"+photo.med+"'/></a></li>";

        gallery.append(item);
    });
    gallery.trigger('create');

    var options = {


        enableMouseWheel: false , 
        enableKeyboard: false ,
        captionAndToolbarAutoHideDelay:0,
        jQueryMobile:true

    }

    var swipe = $(".gallery a").photoSwipe(options);

    // onDisplayImage
    swipe.addEventHandler(PhotoSwipe.EventTypes.onDisplayImage, function(e){
        console.log('onDisplayImage{');
        console.log('onDisplayImage - e.action = ' + e.action);
        console.log('onDisplayImage - e.index = ' + e.index);
        console.log(swipe.getCurrentImage());
        console.log('onDisplayImage}');
    });
Run Code Online (Sandbox Code Playgroud)

但是ondisplayimage事件从未被解雇,因为没有定义PhotoSwipe

 06-14 04:28:45.496: D/CordovaLog(31662): Uncaught ReferenceError: PhotoSwipe is not defined
Run Code Online (Sandbox Code Playgroud)

示例https://github.com/codecomputerlove/PhotoSwipe/blob/master/src/examples/07-custom-toolbar.html不使用我需要的jquery实现.那么基本上我如何使用jquery mobile挂钩事件处理程序.

jquery-plugins jquery-mobile phonegap-plugins photoswipe

2
推荐指数
1
解决办法
4816
查看次数

在jquery延迟对象之间发送数据

我试图抓住jquery中的延迟对象,但仍然遇到麻烦.基本上我有一系列我想要运行的函数,其中函数1的结果决定了第二个函数中的逻辑.

我不确定我是否必须在某处调用管道方法或者只是使用then(),但无论如何我都会失败.如果你看第一个函数,有一个名为data的对象,我想传递给第二个.

 function run() {
    var data1 = {};
    var data2 = {};

    var body = $('body');

    $.when(first()).then(second()).done(constructData);

    function first() {
        var d = new $.Deferred();



        var data = {} //arbitrary data set that i want to send to second

        data.message = 'first message';
        data.id = 1234;

        body.append('First done');

        //return data object? add it to the resolve method?
       d.resolve();
    }

    function second(data) { //how do I get this data object?

        var d = new $.Deferred();


        body.append('Data from first:');

         body.append('Second done'); …
Run Code Online (Sandbox Code Playgroud)

javascript jquery deferred jquery-deferred

2
推荐指数
1
解决办法
5778
查看次数

jquery移动面板事件未触发

我似乎无法与这里看到的jquery移动面板事件联系起来

http://jquerymobile.com/demos/1.3.0-rc.1/docs/panels/events.html

$(document).on('beforeopen', ".ui-panel", function() {
    alert('open');
});
$(document).on('beforeclose', ".ui-panel", function() {
    alert('close');
 });
Run Code Online (Sandbox Code Playgroud)

要么

 $(document).on('open', ".ui-panel", function() {
    alert('open');
});
$(document).on('close', ".ui-panel", function() {
    alert('close');
 });
Run Code Online (Sandbox Code Playgroud)

甚至在面板上使用上下文

$('.ui-panel',context).on('open', function() {
    alert('opened');
});
Run Code Online (Sandbox Code Playgroud)

其中context是当前页面的jquery对象变量

javascript jquery panel jquery-mobile

2
推荐指数
1
解决办法
4176
查看次数

我可以将参数传递给异步任务中的preExecute()方法吗?

我想在执行后台任务之前操作异步任务中的特定视图但不确定如何将所需参数传递给方法.当我做这样的事情时,我得到一个空指针

class CalcFib extends AsyncTask<Integer, Void, Long> {

    private View v;
    private int index;

    public CalcFib(int i){
        this.index = i;

    }
    @Override
    protected void onPreExecute() {
        //do something with this.index
    }

    @Override
    protected Long doInBackground(Integer... params) {

        long t = 1234;
        return t;
    }

    @Override
    protected void onPostExecute(Long result) {

    }
}
Run Code Online (Sandbox Code Playgroud)

android android-asynctask android-view

2
推荐指数
1
解决办法
2104
查看次数

片段可以通过其父活动实现两个接口吗?

为了在片段之间进行通信,我们使用父活动实现的接口模式...就像在文档中一样,例如,片段可以在其与活动的附件上获取父接口。

public class HeadlinesFragment extends ListFragment {
    OnHeadlineSelectedListener mCallback;

    // Container Activity must implement this interface
    public interface OnHeadlineSelectedListener {
        public void onArticleSelected(int position);
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);

        // This makes sure that the container activity has implemented
        // the callback interface. If not, it throws an exception
        try {
            mCallback = (OnHeadlineSelectedListener) activity;
        } catch (ClassCastException e) {
            throw new ClassCastException(activity.toString()
                    + " must implement OnHeadlineSelectedListener");
        }
    }

...
}
Run Code Online (Sandbox Code Playgroud)

但是例如说父活动实现了另一个接口

public interface OnThreadCliked{
    void …
Run Code Online (Sandbox Code Playgroud)

android interface android-fragments

2
推荐指数
1
解决办法
1457
查看次数

jquery mobile根据调用页面阻止页面更改

我试图阻止jquery移动中的页面更改取决于用户当前所在的页面,但我不知道data.options对象中的内容.所以基本上我需要说用户是否要使用index.html并且调用页面是example.html然后防止默认.

$(document).bind("pagebeforeload", function (event, data) {
  var toPage = data.toPage;
  if (toPage == 'undefined') {
    return;
  } else {
    //need additional condition to see current page in the data.objections object?
  if (toPage == '/android_asset/www/index.html');
  event.preventdefault();
  }
});
Run Code Online (Sandbox Code Playgroud)

jquery jquery-mobile

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

这个PHP代码是否可以保护我免受SQL注入和XSS的攻击?

我已经在我网站的每个页面上的其他任何内容之前运行了清理类.我非常确定addslashes与使用mysql_real_escape_string进行转义相同.

class sanatize
{
private static $singleton;

function __construct(){

    $_CLEAN_POST = array();
    $_CLEAN_GET = array();
    $_CLEAN_REQUEST = array();

    foreach($_REQUEST as $key => $value)
    {
        $key = addslashes(trim(strip_tags($key)));
        $value = addslashes(trim(strip_tags($value)));

        $_CLEAN_REQUEST[$key] = $value;
    }
    foreach($_GET as $key => $value)
    {
        $key = addslashes(trim(strip_tags($key)));
        $value = addslashes(trim(strip_tags($value)));

        $_CLEAN_GET[$key] = $value;
    }
    foreach($_POST as $key => $value)
    {
        if(is_array($value)){
            foreach($value as $key2 => $value2){

                $key2 = addslashes(trim(strip_tags($key2)));
                $value2 = addslashes(trim(strip_tags($value2)));

                $_CLEAN_POST[$key][$key2] = $value2;
            }
        }
        else{
            $key = addslashes(trim(strip_tags($key)));
            $value = addslashes(trim(strip_tags($value))); …
Run Code Online (Sandbox Code Playgroud)

php xss sql-injection

0
推荐指数
1
解决办法
469
查看次数

如何设置jquery移动加载微调器的样式

我想将一些自定义样式应用于jquery加载对话框,但在文档中找不到任何内容来执行此操作.

jquery jquery-ui jquery-mobile

0
推荐指数
1
解决办法
7054
查看次数

如何解析JSON字符串,其中对象包装在另一个json数组中

可能重复:
我有一个嵌套的数据结构/ JSON,我如何访问特定的值?

我有一个奇怪格式的JSON字符串,看起来像这样,我试图访问属性,但不知道如何,因为它是如何在对象内的一堆json数组.

此变量数据的字符串化值

  console.debug(JSON.stringify(data));
Run Code Online (Sandbox Code Playgroud)

看起来像这样

[
{
    "note": [
        {
            "type": "2",
            "cid": "36",
            "icon": "cbb4153684de41ca61c0acc7124613b3.png",
            "created_at": "1359163643"
        }
    ],
    "count": 1
}
]
Run Code Online (Sandbox Code Playgroud)

例如,如果我想要计数int我试过

 var count = parseInt(data.count);
Run Code Online (Sandbox Code Playgroud)

但这只会导致NaN

javascript jquery json

0
推荐指数
1
解决办法
62
查看次数

如何修改此ffmpeg构建脚本以获得最小二进制大小输出

我正在尝试在3个芯片组上为android构建ffmpeg二进制文件.输出文件太大,无法在项目中包含大约15mb.

https://github.com/falnatsheh/ffmpeg-android是github项目回购

ffmpeg的.sh构建脚本是这样的

#!/bin/bash

. abi_settings.sh $1 $2 $3

pushd ffmpeg

case $1 in
  armeabi-v7a | armeabi-v7a-neon)
    CPU='cortex-a8'
  ;;
  x86)
    CPU='i686'
  ;;
esac

make clean

./configure \
--target-os="$TARGET_OS" \
--cross-prefix="$CROSS_PREFIX" \
--arch="$NDK_ABI" \
--cpu="$CPU" \
--enable-runtime-cpudetect \
--sysroot="$NDK_SYSROOT" \
--enable-pic \
--enable-libx264 \
--enable-pthreads \
--disable-debug \
--disable-ffserver \
--enable-version3 \
--enable-hardcoded-tables \
--disable-ffplay \
--disable-ffprobe \
--enable-gpl \
--enable-yasm \
--disable-doc \
--disable-shared \
--enable-static \
--pkg-config="${2}/ffmpeg-pkg-config" \
--prefix="${2}/build/${1}" \
--extra-cflags="-I${TOOLCHAIN_PREFIX}/include $CFLAGS" \
--extra-ldflags="-L${TOOLCHAIN_PREFIX}/lib $LDFLAGS" \
--extra-libs="-lm" \ …
Run Code Online (Sandbox Code Playgroud)

video android ffmpeg compilation

0
推荐指数
1
解决办法
2541
查看次数