Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

James Hodgkiss

Ranch Hand
+ Follow
since Jan 22, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
8
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by James Hodgkiss

I have an Android app that simply houses a website. I would like the app to cache the pages of the website for offline use.

I'm doing a simple test to see if the cache is working but unfortunately it is failing to load a page i have previously loaded in online mode, when offline. To make things clearer i load the following 2 pages when in online mode.




I am hoping that the "why-bmi.php" page is loaded into the cache as well as the subsequent page http://www.bmimobile.co.uk/. The latter page has a link on it which refers to the first page. If i then come out of the app and turn the network adapter off then go back into the app the "http://www.bmimobile.co.uk/" page DOES display but when i click the "why-bmi" link that page DOES NOT display. I short toast message displays saying "error loading page".

Can anyone tell me why the webview is not caching loaded page for later offline use?

Here's the main activity and i've extended the Application object defining the appcachepath.

Thanks in advance.



.


.This is the logging when the app is first loaded in online mode

02-16 08:38:52.744: I/NONPRIME(8871): <CallBackProxy> Send to WebViewClient.
02-16 08:38:56.314: D/skia(8871): ----- started: [1 325] http://www.bmimobile.co.uk/images/mobile/bg-index.png
02-16 08:38:56.499: D/skia(8871): ----- started: [1 64] http://www.bmimobile.co.uk/CubeCore/modules/cubeMobile/images/bg-black-bar.png
02-16 08:38:56.509: D/skia(8871): ----- started: [26 20] http://www.bmimobile.co.uk/images/mobile/home-icon.png
02-16 08:38:56.529: D/skia(8871): ----- started: [275 189] http://www.bmimobile.co.uk/images/mobile/home-img.png
02-16 08:38:56.549: D/skia(8871): ----- started: [320 450] http://www.bmimobile.co.uk/images/mobile/welcome/bg-welcome.jpg
02-16 08:38:56.554: D/skia(8871): ----- started: [270 38] http://www.bmimobile.co.uk/images/mobile/welcome/next.png
02-16 08:38:56.584: D/skia(8871): ----- started: [16 17] http://www.bmimobile.co.uk/images/mobile/why.png
02-16 08:38:56.584: D/skia(8871): ----- started: [18 17] http://www.bmimobile.co.uk/images/mobile/services.png
02-16 08:38:56.584: D/skia(8871): ----- started: [20 15] http://www.bmimobile.co.uk/images/mobile/visit.png
02-16 08:38:56.589: D/skia(8871): ----- started: [20 15] http://www.bmimobile.co.uk/images/mobile/consultants.png
02-16 08:38:56.589: D/skia(8871): ----- started: [13 19] http://www.bmimobile.co.uk/images/mobile/contact.png

.

This is the logging when i've come out of the app turned off the network adapter then gone back into app in offline mode.

02-16 08:41:37.799: E/MainActivity(8871): in onResume in mainactivity
02-16 08:41:37.804: E/ApplicationExt(8871): extStorageAppCachePath = /storage/sdcard0/Android/data/uk.bmi.mobile/cache
02-16 08:41:37.804: E/MainActivity(8871): appCachePath = /storage/sdcard0/Android/data/uk.bmi.mobile/cache
02-16 08:41:37.834: W/dalvikvm(8871): disableGcForExternalAlloc: false

5 years ago


I am creating an offline webapp for the iPad 2, which includes video content. When the page first loads, the video displays fine. But when I reload the page, the video's play button becomes broken.

I've gone into Settings > Safari > Advanced > Website Data and, sure enough, the video is in the cache... So the problem seems to be that it is not being retrieved from the cache.

My HTML code snippet:


My cache.manifest snippet:


For good measure, my .htaccess snippet:


Does anyone have any ideas?

NB - This problem also happens (predictably) when I go into airplane/offline mode. The video size is 311KB. My iPad is running iOS 5.1.1.
5 years ago
iOS
If anyone is looking into getting a mobile version of their website, please check out Mobile Web Expert.

Cheers!
5 years ago
Hello,

I have acquired some J2ME source code which attempts to import com.sun.perseus.platform.BufferedInputStream . It seems this BufferedInputStream class is part of JSR 226, but when I try to compile the midlet with the Series 40 5th Edition SDK (with the "Scalable 2D Vector Graphics API 1.0" package selected) I am getting an error that the package doesn't exist.

Can anyone help?

Thanks,
James
5 years ago
When I enter a SELECT query in the textpane on MySQL Workbench, the textpane is replaced with the results table. How do I get the textpane back so I can edit my query??
Hiya,
I've been developing with Java (Inc. J2ME) for over ten years and am looking at getting Android development.

What's my best route? Is it learning something like Phone Gap or Titanium (as I already have HTML and CSS skills, and like the idea of creating iOS apps too), or would it be more beneficial to learn the Android-specific Java, or both even?

And is there any particular book or programme anyone could recommend?

Many thanks,
James
5 years ago
Does anyone know of any decent, low cost Tomcat hosting?

Thanks,
James

PS - I made the mistake of signing up with hostjava.net - and you would not believe how incompetent they are. This is no joke, but 11 days ago I asked them to deploy a WAR for me... and I am still waiting!
6 years ago
Cheers for the replies, but I've found the solution now... I decided to open my file in MS Works Spreadsheet and I noticed that actually uses the " character (double apostrophe, rather than single apostrophe) at the start of text cells, so I've put that into my app and it's now sorted!!
6 years ago
Sorry to interrupt with a technical question, but I don't know where else to ask this.

The situation is that my app creates a tab-delimited text file, which I want to 'open with' MS Excel. The problem is that one of the cells contains a long string of binary data (e.g., 01010101111111100000000010101010101000000000001111111110000011). I cannot find a way of making it display correctly though when I open the file in Excel.

When I open the file in Excel, it either shows as...
1.1E+198
...or as...
1010101111111100000000010101010101000000000001111111110000011 (with the leading zeroes missing - which is no good)

If my app writes the data into the file with an apostrophe in front (e.g., '01010101111111100000000010101010101000000000001111111110000011) then the apostrophe also gets displays in Excel.

How can I make it so that just the 01010101111111100000000010101010101000000000001111111110000011 shows when I open the file in Excel (preferably without having to modify loads of cell properties)?!

Thanks in advance,
James
6 years ago
Always leave your inflatable friend at home home you go on a date. It's an unwritten rule.
6 years ago
Thanks for that, but my web app is deployed in an unexploded way.

Bearing that in mind, is there any way my servlet can create a subdirectory in the root directory then output the files there (without hardcoding any absolute paths into my web app)?
6 years ago
Thanks for the replies. No, I don't have to use getRealPath() and I'm happy to write the files outside the web application. How then, could my servlet create a subdirectory in the root directory then output the files there (without hardcoding in any absolute paths)?
6 years ago
Hiya,

The logging in my webapp works fine... until it is packaged in a WAR. When used from a WAR, this code:



...gives null. Is there any other way I can access it without having to specify and absolute locations anywhere (as my webapp needs to work from the WAR on any machine without pre-configuration).

Many thanks,
James
6 years ago
Hiya,

I've currently got this code in my servlet:



I've seen examples that don't use the BufferedWriter, so I'm wondering if the BufferedWriter really necessary / could including it or excluding it hurt performance?

NB - The output file is to record test results - about 100 characters are written to the file every second.

Cheers,
James
6 years ago