hi.
In my application I want to create a directory xyz in sdcard at the runtime from the my Application.
But it doesn't work.
Here is my code..
public class process extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String[] str ={"mkdir","/sdcard/xyz"};
try {
Process ps = Runtime.getRuntime().exec(str);
try {
ps.waitFor();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
catch (IOException e) {
Toast.makeText(this, ""+e, Toast.LENGTH_LONG).show();
}
}
}
What you are trying to do seems incredibly pointless.... you shouldn't
be running a shell command to create a directory.
Read this: http://groups.google.com/group/android-developers/browse_thread/thread/64fb55b5bd03a2cd
On Apr 12, 5:19 pm, a genius <droidhac...@gmail.com> wrote:
> This has nothing at all to do with adb.
> adb is the client/server protocol used for debugging android remotely
> via network or USB.
>
> What you are trying to do seems incredibly pointless.... you shouldn't
> be running a shell command to create a directory.
>
> Read this:http://groups.google.com/group/android-developers/browse_thread/threa...
>
> On Apr 12, 7:58 am, joy joy <joyy.bl...@gmail.com> wrote:
>
> > hi.
>
> > In my application I want to create a directory xyz in sdcard at the runtime
> > from the my Application.
>
> > But it doesn't work.
>
> > Here is my code..
>
> > public class process extends Activity {
>
> > /** Called when the activity is first created. */
>
> > @Override
>
> > public void onCreate(Bundle savedInstanceState) {
>
> > super.onCreate(savedInstanceState);
>
> > setContentView(R.layout.main);
>
> > String[] str ={"mkdir","/sdcard/xyz"};
>
> > try {
>
> > Process ps = Runtime.getRuntime().exec(str);
> > try {
> > ps.waitFor();
> > } catch (InterruptedException e) {
> > // TODO Auto-generated catch block
> > e.printStackTrace();
> > }
> > }
>
> > catch (IOException e) {
> > Toast.makeText(this, ""+e, Toast.LENGTH_LONG).show();
> > }
>
> > }
> > }
>
>
ok thnx.
nw can I run executable file within process command at the runtime of
application.
from the above code my command string is now..
String[] str = "./extract_xxxfile /sdcard/abc.xxx /sdcard/
extracted_file/";
Here extract_xxxfile is the arm executable file and its in system/lib.
I want to extract /sdcard/abc.xxx file in /sdcard/extracted_file
directory.
It gives runtime directory null and environment null exception (IO
Exception).
can you help me?