startActivityForResultを使用してArrayAdapterクラスから別のインテントを呼び出したいのですが、それができません。これが私のコードです。
ArrayAdapterクラスコンストラクタ
public QsShareManagerAdapter(Context context, String[] values, Long[] size,String[] time,
boolean isRoot, Boolean[] attrdir, ArrayList<Boolean> selected,boolean type,
LinearLayout linearLayout,String SHARE,String qsUsername)
{
super(context, R.layout.listlayout, values);
this.context = context;
this.values = values;
this.size = size;
this.time=time;
this.isRoot = isRoot;
this.attrdir = attrdir;
this.selected = selected;
this.type=type;
this.linearLayout=linearLayout;
this.SHARE=SHARE;
this.qsUsername=qsUsername;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent)
{
String spliter = "/";
tag=SHARE.split(spliter);
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.listlayout, parent, false);
//
addFiles=(Button)linearLayout.findViewById(R.id.add_files);
manageUser=(Button)linearLayout.findViewById(R.id.manage_users);
deleteSharedFolder=(Button)linearLayout.findViewById(R.id.delete_shared_folder);
copyFiles=(Button)linearLayout.findViewById(R.id.copy);
deleteFiles=(Button)linearLayout.findViewById(R.id.delete_files);
addFiles.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent=new Intent(context,QsFileSelector.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); ;
intent.putExtra(QsFileSelector.SELECTED_FILES,existing_seletedFile);
intent.putExtra(QsFileSelector.FILE_OR_DIRECTORY, tag[6]);
startActivityForResult(intent);
Toast.makeText(context, "Add Files", Toast.LENGTH_SHORT).show();
}
});
manageUser.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(context, "Manage User", Toast.LENGTH_SHORT).show();
}
});
deleteSharedFolder.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
boolean status=serverURL.folderRequestResponseURI("DELETED_CREATOR", tag[6], qsUsername, tag[5], null, "");
if(status){
Toast.makeText(context, "Delete Share Folder", Toast.LENGTH_SHORT).show();
}
}
});
copyFiles.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(context, "Copy", Toast.LENGTH_SHORT).show();
}
});
deleteFiles.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(context, "Delete", Toast.LENGTH_SHORT).show();
}
});
TextView textView = (TextView) rowView.findViewById(R.id.txtview);
ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
TextView sizeView = (TextView) rowView.findViewById(R.id.size);
final CheckBox checkbox = (CheckBox) rowView
.findViewById(R.id.checkbox);
String s = values[position];
checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
int postion=position;
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
// TODO Auto-generated method stub
if(isChecked){
addToList(values[postion],true);
}else{
addToList(values[postion],false);
}
}
});
rowView.setTag(s);
if (!values[position].contains("my_shared_folder") && isRoot && type)
{
s = values[position] + " 's Shared Folder";
textView.setText(s);
}
else
{
textView.setText(values[position]);
}
if (size.length != 0)
{
double sizeinKb = size[position] / 1024;
if (sizeinKb > 1024) {
double sizeinMb = sizeinKb / 1024;
sizeView.setText(Double.toString(round(sizeinMb, 2,
BigDecimal.ROUND_HALF_UP)) + " MB | "+time[position]);
}
else if (sizeinKb > 1048576) {
double sizeinGB = sizeinKb / (1024 * 1024);
sizeView.setText(Double.toString(round(sizeinGB, 2,
BigDecimal.ROUND_HALF_UP)) + " GB | "+time[position]);
}
else {
sizeView.setText(Double.toString(round(sizeinKb, 2,
BigDecimal.ROUND_HALF_UP)) + " KB | "+time[position]);
}
}
if (attrdir[position])
{
imageView.setImageResource(R.drawable.icon_folder_logo);
sizeView.setText("");
}
else
{
checkbox.setVisibility(View.VISIBLE);
if (s.contains(".mp3") || s.contains(".wav"))
{
imageView.setImageResource(R.drawable.audio);
}
else if (s.contains(".zip") || s.contains(".rar")
|| s.contains(".tar"))
{
imageView.setImageResource(R.drawable.zip);
}
else if (s.contains(".db"))
{
imageView.setImageResource(R.drawable.db_icon);
}
else if ((s.contains(".png")) || (s.contains(".jpg")))
{
imageView.setImageResource(R.drawable.imagview);
}
else if ((s.contains(".doc")) || (s.contains(".docx")))
{
imageView.setImageResource(R.drawable.doc);
}
else if ((s.contains(".xls")) || (s.contains(".xlsx")))
{
imageView.setImageResource(R.drawable.excel);
}
else if ((s.contains(".pdf")))
{
imageView.setImageResource(R.drawable.pdf);
}
else
{
imageView.setImageResource(R.drawable.unknown);
}
}
/*
* for(int i=0;i<size.size();i++){
* sizeView.setText(Integer.toString(size.get(i))); }
*/
if(fileList.contains(values[position]) && checkStatus.contains(true)){
linearLayout.setVisibility(View.VISIBLE);
checkbox.setChecked(true);
}
if(fileList.size() == 0){
linearLayout.setVisibility(View.GONE);
}
checkbox.setTag(values[position]);
return rowView;
}