Android Open Source - sdl_tester_android Delete File Dialog

From Project

Back to project page sdl_tester_android.


The source code is released under:

Copyright (c) 2014, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are m...

If you think the Android project sdl_tester_android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.livio.sdltester.dialogs;
// w  w  w .  j  av  a2  s . c  o m
import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

import com.livio.sdl.SdlImageItem;
import com.livio.sdl.SdlRequestFactory;
import com.livio.sdl.adapters.SdlImageAdapter;
import com.livio.sdl.dialogs.BaseImageListDialog;
import com.livio.sdl.enums.SdlCommand;
import com.livio.sdltester.R;
import com.smartdevicelink.proxy.RPCRequest;

public class DeleteFileDialog extends BaseImageListDialog {

  private static final SdlCommand SYNC_COMMAND = SdlCommand.DELETE_FILE;
  private static final String DIALOG_TITLE = SYNC_COMMAND.toString();
  private static final String DELETE_ALL = "Delete All";
  private List<SdlImageItem> imageList;
  public DeleteFileDialog(Context context, List<SdlImageItem> imageList) {
    super(context, DIALOG_TITLE, imageList);
    this.imageList = new ArrayList<SdlImageItem>(imageList);
    Bitmap deleteAllImage = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_close);
    ((SdlImageAdapter)listview.getAdapter()).insert(new SdlImageItem(deleteAllImage, DELETE_ALL, null), 0);
  protected void findViews(View parent) {
    listview = (ListView) parent.findViewById(;
    listview.setOnItemClickListener(new OnItemClickListener() {
      public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        List<RPCRequest> messages = new ArrayList<RPCRequest>(imageList.size());
        SdlImageItem selectedItem = ((SdlImageAdapter) parent.getAdapter()).getItem(position);
        String selectedName = selectedItem.getImageName();
          for(SdlImageItem item : imageList){
            RPCRequest request = SdlRequestFactory.deleteFile(item.getImageName());
          RPCRequest request = SdlRequestFactory.deleteFile(selectedItem.getImageName());



Java Source Code List