Sending and receiving.

by Erik Hughes » Mon, 22 Feb 2010 15:07:15 GMT


Sponsored Links
 Hello Devs,
I have the problem that even though the activities starts i cannot get
the data back from the filebrowser.java. I am not getting any errors
except the line begining with the *. The error is code is never used
locally. I have also checked the filbrowser and it does give an output
with the code "aDirectory.getAbsolutePath().toString()" so the issue
is somewhere in the transfer. Code is below:

Main.java
[
        //Code + imports above
       public static final int ACTION_PICK_FILE = 0;

       //Code above is outside the method body.

        button = (Button) findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
                public void onClick(View arg0) {
                Intent filebintent = new
Intent(arg0.getContext(),Filebrowser.class);
            startActivityForResult(filebintent, ACTION_PICK_FILE);
                }
*        protected void onActivityResult(int requestCode, int
resultCode, Intent filebintent)
        {
             switch(requestCode)
             {
                 case ACTION_PICK_FILE:
                 if (resultCode == RESULT_OK)
                 {
                Bundle bundle = filebintent.getExtras();
                String select1 = bundle.getString("Selected1");
                String path1 = select1.getBytes().toString();
                System.out.println(select1); //Check if there is an
output.
                System.out.println(path1); //Check if there is an
output.
                 }
                 break;
             }
            }
     });
        //Code
]

Filebrowser.java
[
                //Code + imports above
               OnClickListener okButtonListener = new OnClickListener()
{
                    // @Override
                    public void onClick(DialogInterface arg0, int
arg1) {
                           Bundle Data = new Bundle();
                           Data.putString("Selected1",
aDirectory.getAbsolutePath().toString());
                           Intent mainintent = new Intent();
                           mainintent.putExtras(Data);
                           setResult(RESULT_OK, mainintent);
                           finish();
                    }
               };
                //Code
]

Thanks in advance!
/Erik Hughes

--



Other Threads

1. How to release resources when application ends?

Hi,

I created an application which is displaying camera preview. When the
application terminates I noticed that some processes are still running. Also
if I try to run the original camera application it displays an error
(obviously due to the active process which belongs to the custom
application).

Does anyone know how to release all resources when application ends?

Thanks!

Niko

-- 
http://mypetprojects.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~

2. import org.apache.commons.httpclient.HttpClient library error

Hi to all...

           I got one blog which interacts with servlets... Link as
follows

3. Failing to send attachments via email

4. How do i compile platform/packages/apps applications ?

5. language translation?

6. A question regarding Activities and Tasks.

7. ScrollView changs the behavior of the layout even when it's not active.