Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7878967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:47:55+00:00 2026-06-03T03:47:55+00:00

I want to call another intent from ArrayAdapter class using startActivityForResult but i cann’t

  • 0

I want to call another intent from ArrayAdapter class using startActivityForResult but i cann’t do that.Here is my code.

ArrayAdapter class Constructor

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;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:47:56+00:00Added an answer on June 3, 2026 at 3:47 am
    addFiles.setFocusable(false);
    

    I think you should change Context to Activity…In your Adapter Constructor change it…
    activity.startActivityForResult(intent,position);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a stored procedure that I want to call from within another, and
I have a Makefile from which I want to call another external bash script
i want to call a batch file from another batch file and also want
I want to call a webservice from jQuery. How can I do that?
I want to call a controller function from a view. Is that possible in
I read here it is possible to call another constructor Calling constructor from other
I don't know how to start an Intent to call another activity from my
I want to interrupt a thread1 from another thread2 but when I try make
So I have .csh script generate.csh I want to call another .csh script from
I here want to call another website url, login into it, and use one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.