小编del*_*a66的帖子

如何在自定义ListView中使用Button OnClick和View Holder

我需要一些帮助,我正在使用一个视图来从动态arrayadapter中显示.

我有列表视图.

每行包含;

  • 标题(Textview),
  • 子标题(TextView),
  • 进度条
  • 下载按钮(按钮).

我想在单击"下载"按钮时显示进度条并隐藏"下载"按钮.单击第一行中的下载按钮时,将显示第一个进度条,但也显示第8个进度条.

这是我的代码.我做错了什么?

    public class TabInComingAdaptor extends BaseAdapter {

    public static class ViewHolder {
        TextView title;
        TextView desc;
        Button DownloadButton;
        ProgressBar pB;
    }

    private ArrayList<rowObject> data;
    private LayoutInflater inflater = null;
    private Application ap;
    // final private Activity currentActivity;
    Button progressButton1;
    int CurrentUser;

    public TabInComingAdaptor(Activity activity, Application application,
            ArrayList<rowObject> GelenFakslar) {
        // currentActivity = activity;
        ap = application;
        data = GelenFakslar;
        inflater = (LayoutInflater) ap
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    public int getCount() {
        return data.size();
    } …
Run Code Online (Sandbox Code Playgroud)

android android-listview android-viewholder

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

如何在我的应用程序中显示通知

我想在我的应用程序中添加自定义通知,以便我如何在我的应用程序中执行此操作: 请单击以查看屏幕截图.

notifications android

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

iOS 13没有在后台获取VoIP推送通知

我正在使用CallKit和PushKit在Swift中开发软电话。在iOS 13之前,VoIP通知运行良好。但是,在iOS 13更新之后,我的应用程序在后台运行时没有收到VoIP推送通知。在前台didReceiveIncomingPushWith被调用,但在后台不被调用。

如何解决此问题?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.
    print("\(#function)")
    let voipPushResgistry = PKPushRegistry(queue: nil)
    voipPushResgistry.delegate = self
    voipPushResgistry.desiredPushTypes = [PKPushType.voIP]

    return true
}

func pushRegistry(_ registry: PKPushRegistry, didInvalidatePushTokenFor type: PKPushType) {
    print("\(#function) token invalidated")
}

func pushRegistry(_ registry: PKPushRegistry, didUpdate credentials: PKPushCredentials, for type: PKPushType) {
    let deviceToken = credentials.token.reduce("", {$0 + String(format: "%02X", $1) })
    print("\(#function) token is: \(deviceToken)")
}

func …
Run Code Online (Sandbox Code Playgroud)

iphone pushkit callkit ios13 xcode11

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

可以在Crouton中使用进度条吗?

我想用进度条显示自定义Crouton警报,我想动态更新进度.这是我的代码,但它不起作用.我怎样才能做到这一点?或者如何在图片上传时显示进度条

private void showCustomViewCrouton() {
    // try {
    View view = getLayoutInflater().inflate(R.layout.crouton_custom_view,null);
    pB = (ProgressBar) view.findViewById(R.id.progressBar1);
    final Crouton crouton;
    final Configuration croutonConfig = new Configuration.Builder()
            .setDuration(Configuration.DURATION_INFINITE)
            .setInAnimation(android.R.anim.fade_in)
            .setOutAnimation(android.R.anim.fade_out).build();
    crouton = Crouton.make(this, view, R.id.croutonContainer, croutonConfig);       
    view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            crouton.hide(crouton);
        }
    });

    crouton.show();

    try{
        do{
                Thread.sleep(100);
                deger+=1;
                pB.setProgress(deger);          
        }while(deger<101);      
    }catch(Exception e){

    }       
}
Run Code Online (Sandbox Code Playgroud)

android progress-bar crouton

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