Your other program must publish the Activity that is what it should
show when launched, and then you can use Context.startActivity() to
start it.

On Mar 23, 7:31 pm, Paul <[EMAIL PROTECTED]> wrote:
> Now I have  a program named ATest, and i have a button in this
> program.
> I want to start another program CityListguide when i click the button
> in program ATest.
> I use the following exec() metohd, but it can't start the new program.
> The CityListguide program is stored in
> com.google.android.citylistguide package, and it is no relation with
> current program ATest.
>
> Can anyone give me some suggestion?
> Thanks.
>
> The source code as follow:
>
>         OnClickListener btnClick = new OnClickListener() {
>                 @Override
>                 public void onClick(View arg0) {
>                         String cmd = "CityListguide";
>                         String[] envp = {"com.google.android.citylistguide"};
>                         try {
>                                 Log.i("Runtime", "cmd = " + cmd);
>                                 Process ps = Runtime.getRuntime().exec(cmd, 
> envp, new File("/data/
> app"));
>                                 //Process ps = Runtime.getRuntime().exec(cmd);
>                                 ps.waitFor();
>                                 Log.i("Runtime", "CityListguide is exected.");
>                         }catch(Exception e) {
>                                 Log.i("Runtime", "e.toString() = " + 
> e.toString());
>                                 e.printStackTrace();
>                         }
>
>                 }
>
>     };
>
> And the log is:
>
> INFO/Runtime(1286): cmd = CityListguide
> INFO/ProcessManager(1312): Setting environment:
> com.google.android.citylistguide
> ERROR/ProcessManager(1312): Error running CityListguide: No such file
> or directory
> INFO/Runtime(1286): CityListguide is exected.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to