How to use WebView in Offline mode? Can I dynamically revoke permissions?

by Mariano Kamp » Wed, 21 Apr 2010 02:17:51 GMT


Sponsored Links
 Hi,

I am want to use JavaScript to process some HTML pages in the background.

WebView seems to be a great basis to do this. There is one issue though. I
don't want to display the web page and its images/stylesheets right away, so
it is a waste of bandwidth when the stylesheets and images are downloaded. I
am wondering how to tell WebView not to do that.

I tried WebSettings.setLoadsImagesAutomatically(false), but this still loads
the stylesheets. WebView.setNetworkAvailable(false) is more an information
for WebView than a switch. Overriding
WebViewClient.shouldOverrideUrlLoading(..) didn't work either.

Any idea how to do this?

One thing that works is not giving the app the required Internet permission.
Unfortunately it is not that simple, because at other times I want to
display the processed pages and then it should download the
images/stylesheets ;-( But still is there some way that I can use this
permission thing? Can I dynamically revoke the permission? For a single
thread or process?

Cheers,

Mariano

--



How to use WebView in Offline mode? Can I dynamically revoke permissions?

by Mariano Kamp » Wed, 21 Apr 2010 03:39:17 GMT


 >




Sounds good. I will try that.

--


Sponsored Links


Other Threads

1. (File export) What's going on with my code?[NEED HELP]

Hi,
I have data stored in a file in /data/data.... and i want to export it
to the SDCARD, i writed the code(wondering if it's correct) and the
class is not called, please try to help me to solve the problem, THANK
YOU:
public class Import extends Saves {
        private Context context;

        public void transfer(){
        context = getApplicationContext();
        File sdCard = Environment.getExternalStorageDirectory();
        File dir = new File (sdCard.getAbsolutePath() + "/SDCARD/Carburant/
storeddata.dat");
        dir.mkdirs();
        Toast.makeText(Import.this, "Test", Toast.LENGTH_SHORT).show();
        copyfile(context,"/data/data/carburant.android.com/files/",
                        sdCard.getAbsolutePath() + 
"/SDCARD/Carburant/storeddata.dat");

}

        private void copyfile(Context context,String srFile, String dtFile){
                context = getApplicationContext();
            try{
                File f1 = new File(srFile);
                File f2 = new File(dtFile);
              InputStream in = new FileInputStream(f1);
              OutputStream out = new FileOutputStream(f2);

              byte[] buf = new byte[1024];
              int len;
              while ((len = in.read(buf)) > 0){
                out.write(buf, 0, len);
              }
              in.close();
              out.close();
              Toast.makeText(context, "Export effectu",
Toast.LENGTH_SHORT).show();
            }
            catch(FileNotFoundException ex){
                Toast.makeText(context, "File Not found",
Toast.LENGTH_SHORT).show();
            }
            catch(IOException e){
                Toast.makeText(context, "Echec",
Toast.LENGTH_SHORT).show();
            }
          }

        }

-- 

2. Problem with activity group

Hi,

I am using ActivityGroup class for one of my tab in my application.

1) There is a tab activity class calling the activitygroup class.

2) In activity group class i am calling one activity say Activity A which is
a list view.

3) On Activity A item click, I am calling another activity say Activity B.

I need to override the back button functionality in Activity A and Activity
B.

The problem which I am facing is on Activity A it is successfuly calling the
overriden onBackButton method but on Activity B instead of overriding the
back button method, it is calling the Tab Activity's back button method.  I
am not sure why?
I even debugged the code and it never goes into the onbackbutton method of
Activity B.

To resolve this I even tried calling Activity A on back button press of tab
activity which is required.  But the flow come as it goes into activity A
and then from there it goes directly to the First Activity.

I am also using Alert Dialog Box in both of the activity and passing
getParent() as context in the Alert Builder Dialog Box.

Any help in this regard will be great.


Thanks & Regards,
Laxmi Verma

-- 

3. Dispatch KeyDown on Listview

4. Camera.getNumberOfCameras() not working

5. Compilation error using android SDK 2.0 (Camera Preview)

6. Source code for StackView(Honeycomb build) available yet?

7. IPSEC for Android