[android-developers] Re: ServiceTestCase and Contexts

2015-01-29 Thread Igor Ganapolsky
I am getting this error: android.content.Context.getMainLooper()' on a null object reference When calling new GoogleApiClient.Builder(getApplication()) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this)

[android-developers] Re: ServiceTestCase and Contexts

2011-02-08 Thread nate
Thanks for the response. The assets that I needed for the test project were specifically built for testing and we could not distribute them in the assets of our app (we are keeping the app footprint small), but the workaround I posted above worked fine to get the assets from the test project. On

[android-developers] Re: ServiceTestCase and Contexts

2011-02-04 Thread nate
I checked my setUp() method and I do call super.setUp() as the first line. The reason I believe the contexts are the same are two-fold: I tried both: getSystemContext().getAssets().list(.) getContext().getAssets().open(.); and neither of them listed any files. The second reason is that I read

[android-developers] Re: ServiceTestCase and Contexts

2011-02-04 Thread nate
Also, i put the test assets in the target project's directory and was able to access them with: getSystemContext().getAssets().list(.) On Feb 4, 10:31 am, nate nroy...@gmail.com wrote: I checked my setUp() method and I do call super.setUp() as the first line.  The reason I believe the contexts

[android-developers] Re: ServiceTestCase and Contexts

2011-02-04 Thread nate
OK, I found a solution: I created a context to our test package and was able to access the assets: mTestAppContext = getContext().createPackageContext(com.blah.test, Context.CONTEXT_IGNORE_SECURITY); Just in case anyone else needs a workaround. On Feb 4, 10:36 am, nate nat...@cisco.com wrote:

[android-developers] Re: ServiceTestCase and Contexts

2011-02-04 Thread A. Elk
Hmmm. ServiceTestCase.getSystemContext() returns the context of the test package. ServiceTestCase.getApplication() gets the Application instance in use by the service under test. It's probably better to use that Application object to look at the assets you want. When you wrote getContext(), I

[android-developers] Re: ServiceTestCase and Contexts

2011-02-03 Thread A. Elk
What leads you to believe that both Context objects contain the same information? If you do a getSystemContext() you should get the context that's stored during setUp(). The only thing that might screw this up is if you overrode setUp() but forgot to call super.setUp() first. On Feb 2, 2:08 pm,