Why not use getPackageName() from the class Context. So in your activity it would be something like this.getPackageName()
That would five you a String of your package. It is against Android convention to end your process in this manner, however. Android will garbage collect it as necessary. On Dec 9, 6:42 am, Asif k <asifk1...@gmail.com> wrote: > One observation, > > It is working fine if I am giving hardcoded package as > > am.restartPackage("demo.test"); rather than > > am.restartPackage(pkg.substring(0,pkg_point)); . > > Here it is showing error that : Invalid package : demo.test > which is same as I had given inside quotes. > > Any suggestions?? > > On Dec 9, 3:02 pm, Asif k <asifk1...@gmail.com> wrote: > > > Hi all, > > > Can I have any working example of restartPackage() API. > > > Thanks in advance, > > Asif > > > On Dec 9, 2:56 pm, Asif k <asifk1...@gmail.com> wrote: > > > > Hi justinh, > > > > Thanks for your reply. > > > > > Is that the package name you have defined in your Manifest for the > > > > package attribute? > > > > yess thats the package name that is there in manifest file. I am > > > finding the package name from the main activity as shown bellow , > > > > String pkg = "demo.test.MyActivity"; > > > int pkg_point= pkg.lastIndexOf('.'); > > > am.restartPackage(pkg.substring(0,pkg_point)); // am is Activity > > > Manager > > > Is there any better/other way to find out the package and give as an > > > input parameter to restartPackage() ?? > > > > >Also, you need to provide the parameter as a > > > > > String. > > > > Ya it is the string but in the previous post , I had written it > > > manually in this mail to replace pkg.subString(0,pkg_point) for better > > > understanding. > > > > But still I am getting the same error as " 12-09 15:13:56.893: WARN/ > > > ActivityManager(58): Invalid packageName: 1: demo.test " > > > > Waiting for inputs, > > > Asif- Hide quoted text - > > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en