小编Str*_* B.的帖子

在AsyncTask中使用picasso加载图像

我正在使用毕加索来加载图像作为我的活动的背景,我想使用AsyncTask,而图像正在加载,完成后进度条会解散,以便为我的应用程序提供更好的外观,

这是我的代码:

  private class RemoteDataTask extends AsyncTask<Void, Void, Void> {
    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        mProgressDialog = new ProgressDialog(MainActivity.this);
        mProgressDialog.setMessage("Chargement...");
        mProgressDialog.setIndeterminate(false);
        mProgressDialog.show();

    }

    @Override
    protected Void doInBackground(Void... params) {
           Picasso.with(MainActivity.this).load("http://tv2.orangeadd.com/mediacenter-data/ofc__bg_home.jpg").into(background,new com.squareup.picasso.Callback() {
                 @Override
                 public void onSuccess() {
               mProgressDialog.dismiss();
                 }

                 @Override
                 public void onError() {

                 }
             }); 
        return null;
    }
    @Override
    protected void onPostExecute(Void result) {





    }
    }
Run Code Online (Sandbox Code Playgroud)

这总是显示错误并强制我的应用程序退出!

多谢你们 :)

android android-asynctask picasso

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

如何在Javascript中了解div中按钮之间按下的按钮

我有一个4个按钮的div,当我点击任何按钮时,它会重定向到所有按钮的同一页面,我想知道用户在进入下一页之前按下了哪个按钮,我一直在尝试,但不能找不到.

这是我的代码:

             
     $( "#buttons" ).click(function() {
    alert('button'); 
window.location.href = "score.html";
});  
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p id="countdown"></p>
<div id="buttons">
<button type="button" id="button1">button 1</button>
<button type="button" id="button2">button 2</button>
<button type="button" id="button3">button 3</button>
<button type="button" id="button4">button 4</button>
  </div>
Run Code Online (Sandbox Code Playgroud)

你有什么主意吗

javascript jquery

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

如何使用ng-repeat在Angular JS中显示json响应值

我试图以正确的顺序显示特定JSON的值。我的JSON看起来像:

{
"A":[{"id":"21","name":"Andrea"},{"id":"22","name":"Apple"}],
"B":[{"id":"21","name":"Baby"},{"id":"22","name":"Bali"}],
"C":[{"id":"21","name":"Candle"},{"id":"22","name":"Canada"}],
}
Run Code Online (Sandbox Code Playgroud)

如何使用ng-repeat显示值:

<div ng-repeat="item in items">

</div>
Run Code Online (Sandbox Code Playgroud)

喜欢 :

一种

安德里亚

苹果

宝宝

里岛

C

蜡烛

加拿大

javascript json angularjs

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

如何在 Swift 中知道发件人的标识符

我有两个UILabels,两个UITapGestureRecognizers在一个UITableViewCell.

cell.Username.tag = indexPath.row
cell.SharedUser.tag = indexPath.row
let tapGestureRecognizer2 = UITapGestureRecognizer(target:self, action:"GoToProfil:")
let tapGestureRecognizer3 = UITapGestureRecognizer(target:self, action:"GoToProfil:")
cell.Username.userInteractionEnabled = true
cell.Username.addGestureRecognizer(tapGestureRecognizer2)
cell.SharedUser.userInteractionEnabled = true
cell.SharedUser.addGestureRecognizer(tapGestureRecognizer3)

func GoToProfil (sender: AnyObject!) {
    self.performSegueWithIdentifier("GoToProfilSegue", sender: sender)
}
Run Code Online (Sandbox Code Playgroud)

我正在使用 aSegue来推送另一个UIViewController,并且我正在覆盖该PrepareSegue函数以发送与Sender标签相对应的所需信息。

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {

    let ProfilView = segue.destinationViewController as! Profil
    ProfilView.hidesBottomBarWhenPushed = true
    ProfilView.title = posts[sender.view!.tag].User?.objectForKey("Name") as? String
    ProfilView.User = posts[sender.view!.tag].User
}
Run Code Online (Sandbox Code Playgroud)

我的问题是我想知道UILabel按下了哪个,知道我已经在使用tag.

ios uitapgesturerecognizer segue swift

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

如何在swift 3中替换多个字符

我正在尝试转换Xcode无法转换为Swift3的代码部分

在swift 2.3中替换我使用的字符串中的多个字符:

var phone = "+ 1 (408)-456-1234"
phone = phone.replaceCharacters("  ) ( -   ?", toSeparator: "")
Run Code Online (Sandbox Code Playgroud)

这应该给+14084561234

在swift 3中我使用了这个:

phone = phone.replacingOccurrences(of: " |(|)|-", with: "z",options: .regularExpression)
Run Code Online (Sandbox Code Playgroud)

此代码给出+1(408)4561234

如何替换字符串中的多个字符(Swift3)?

但这不能正常工作?有任何想法吗

swift

0
推荐指数
2
解决办法
5200
查看次数

如何在舵图中获取 pod 索引

我正在部署一个 Kubernetes 有状态集,我想在舵图中获取 pod 索引,以便我可以使用此 pod 索引配置每个 pod。

例如,在以下模板中,我使用变量{{ .Values.podIndex }}来检索 pod 索引,以便使用它来配置我的应用程序。

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: {{ .Values.name }}
spec:
  replicas: {{ .Values.replicaCount }}
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 50%
  template:
    metadata:
      labels:
        app: {{ .Values.name }}
    spec:
      containers:
        - image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
          imagePullPolicy: Always
          name: {{ .Values.name }}
          command: ["launch"],
          args: ["-l","{{ .Values.podIndex }}"]
          ports:
            - containerPort: 4000
      imagePullSecrets:
        - name: gitlab-registry
Run Code Online (Sandbox Code Playgroud)

kubernetes kubernetes-helm

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