Is it possible to get another application's context if I have the Package-Name? I need to get application's context anyhow... Please answer if any one know..
Asked
Active
Viewed 131 times
0
-
You can't. A Context is a variable of a running application. These are sandboxed from each other. There may be another way to do what you really want to, but you can't get the Context. – Gabe Sechan Mar 18 '16 at 02:22
-
@GabeSechan see, what official android is saying... http://developer.android.com/reference/android/content/Context.html#createPackageContext(java.lang.String,%20int) – Muhammad Jobayer Mar 18 '16 at 02:37
-
It depends on what you're trying to do. You can get limited access to its resources that way. But what's returned is not the same as the application context or an activity context for a running instance of the application. – Gabe Sechan Mar 18 '16 at 02:53
-
Actually, I want to get cacheDir of an app through this way. So I tried if this is possible – Muhammad Jobayer Mar 18 '16 at 03:00
-
You might be able to get the directory name, but no read or write access to it – Gabe Sechan Mar 18 '16 at 03:01
-
Yeah, you are right. That's a big bug. Android may allow me to get that directory but as far as I think, android won't allow me to edit... – Muhammad Jobayer Mar 18 '16 at 03:03