I am trying to load "https://facebook.com/" with a WebView but it says the webpage couldn't be loaded and the problem is ERR_CACHE_MISS.
The code that I am using is widely-used one. I don't know why there is such problem.
Code:
webView.setVerticalScrollBarEnabled(true);
webView.setHorizontalScrollBarEnabled(false);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
webView.loadUrl("https://facebook.com");
Android API: 22
Internet permission has been granted in Manifest.
Related logs are shown below : The initial release for Android 5.0 includes a version of Chromium for WebView based on the Chromium M37 release. So, I've added chromium logs. Any other log related to webview doesn't exist.)
V/WebViewChromiumFactoryProvider﹕ Binding Chromium to main looper Looper (main, tid 1) {3c06d3b9}
I/chromium﹕ [INFO:library_loader_hooks.cc(104)] Chromium logging enabled: level = 0, default verbosity = 0
W/chromium﹕ [WARNING:resource_bundle.cc(304)] locale_file_path.empty()
I/chromium﹕ [INFO:aw_browser_main_parts.cc(65)] Load from apk succesful, fd=38 off=46872 len=3037
I/chromium﹕ [INFO:aw_browser_main_parts.cc(78)] Loading webviewchromium.pak from, fd:39 off:230172 len:1089587
W/chromium﹕ [WARNING:data_reduction_proxy_settings.cc(331)] SPDY proxy OFF at startup
I/chromium﹕ [INFO:CONSOLE(12)] "Not allowed to load local resource: file:///android_asset/webkit/android-weberror.png", source: data:text/html,chromewebdata (12)
I just got stuck here. Please don't grudge your help.
Try adding these lines:
Code:
webView.clearCache(true);
webView.getSettings().setAppCacheEnabled(false);
@mmdeveloper said:
Try adding these lines:
Code:
webView.clearCache(true);
webView.getSettings().setAppCacheEnabled(false);
Click to expand...
Click to collapse
I have updated settings webview via google play. I have cleared cache, too as recommended. Now, my problem has been resolved. Thanks
Related
I have a problem in setting controls in a Win32 application.
When I use SendMessage to set a text string in a static control I get error number 120 which translated means: "This function is only valid in Win32 mode."
Here's the background:
I'm using Visual Studio 2005, I've installed the Windows Mobile 5 SDK.
The project was created using the New Project Wizard, with the following settings:
Visual C++/Smart Device
Win32 Smart Device Project
Platform SDK is: Windows Mobile 5.0 Pocket PC SDK
Windows application
I've added a dialog template resource and can bring up a dialog based on that resource. It contains a static control that I can read the text from, but attempting to set the text gives me the above error.
The relevent code (within the WM_INITDIALOG message handler) is:
Code:
char buffer[100];
HWND hCtrl = ::GetDlgItem(hDlg, IDC_TITLE);
LRESULT result = ::SendMessage(hCtrl, WM_GETTEXT, (WPARAM)80, (LPARAM)buffer);
This works, I get the correct text (ie the text I have placed into the static control using the dialog template editor) copied into the buffer. What follows is:
Code:
buffer[0] = 'A'; // Just to set up a different string
result = ::SendMessage(hCtrl, WM_SETTEXT, (WPARAM)0, (LPARAM)buffer);
if (result == 0)
{
LPVOID lpMsgBuf;
DWORD error = ::GetLastError();
::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error, 0, (LPTSTR)&lpMsgBuf, 0, NULL);
::MessageBox(NULL, (LPCTSTR)lpMsgBuf, (LPCWSTR)"LError", MB_OK | MB_ICONINFORMATION);
::LocalFree(lpMsgBuf);
}
The attempt to set the changed text string fails (ie result == 0), and the last error is 120, which is translated to the error message above.
This works the same in both the Windows Mobile 5 emulator, and if I run it on my Atom.
What does this mean? How could it be anything other than Win32 mode?
Is there a function or something I have to call to put it into Win32 mode?
Or is it a project setting in VS2005 that I haven't been able to find?
I'd very much appreciate any help on this.
Peter
Your build target was a PPC 2003 variant for this project, correct? If so (and I'm assuming that it is so because you mention trying this on the PPC emulator), then you are most certainly not in Win32 mode, rather you are targeting WinCE. To target win32, you need to go into configuration manager and change your target at which point your program will no longer run on PPC.
More to your problem: I don't believe that you can dynamically change dialog static control properties through messaging on WinCE. I may be wrong on this here though too....
Hi Guys/Girls,
I'm a new to android development and today I've run in quiet strange issue.
I have onClick action for Button which call function to read and parse file.
When I click on button in debugger error appeared and my action failed:
Code:
11-28 21:57:50.838: WARN/System.err(309): Error: /lib/eng-srb.csv (No such file or directory)
In eclipse (Normal Java development) relative paths work as well.
In ADT this seems not to work.
I've tried various combinations of location but without success.
This is code I'm using:
Code:
File f = new File("lib/eng-srb.csv");
FileInputStream fstream = new FileInputStream(f);
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
Any idea ?
Thx,
Vukasin
P.S.
Google didn't help me a lot on this issue.
Solution
finally Google helped
Code:
h**p://android-er.blogspot.com/2010/07/display-text-file-in-resraw_01.html
So i have a Q here which isnt much use. All i can do is music and youtube, as everything else doesnt work in NZ.
So ive sideloaded XBMC
Launching however gives me this, excerpt from logcat:
V/XBMC ( 2135): 21:33:45 T:5797824 INFO: load language info file: special://xbmc/language/English/langinfo.xml
V/XBMC ( 2135): 21:33:45 T:5797824 ERROR: unable to load special://xbmc/language/English/langinfo.xml: Failed to open file at line 0
V/XBMC ( 2135): 21:33:45 T:5797824 INFO: load English language file, from path: special://xbmc/language/
V/XBMC ( 2135): 21:33:45 T:5797824 DEBUG: LocalizeStrings: no translation available in currently set gui language, at path /data/data/org.xbmc.xbmc/cache/a
pk/assets/language/English
V/XBMC ( 2135): 21:33:45 T:5797824 FATAL: : Failed to load English language file, from path: special://xbmc/language/
V/XBMC ( 2135): => XBMC_Run finished with -1
Anyone know how to get this working? I'd load CM9/CM10.1 but apparently this breaks compatibility with a TV (have to use a monitor?)
eXDee said:
So i have a Q here which isnt much use. All i can do is music and youtube, as everything else doesnt work in NZ.
So ive sideloaded XBMC
Launching however gives me this, excerpt from logcat:
V/XBMC ( 2135): 21:33:45 T:5797824 INFO: load language info file: special://xbmc/language/English/langinfo.xml
V/XBMC ( 2135): 21:33:45 T:5797824 ERROR: unable to load special://xbmc/language/English/langinfo.xml: Failed to open file at line 0
V/XBMC ( 2135): 21:33:45 T:5797824 INFO: load English language file, from path: special://xbmc/language/
V/XBMC ( 2135): 21:33:45 T:5797824 DEBUG: LocalizeStrings: no translation available in currently set gui language, at path /data/data/org.xbmc.xbmc/cache/a
pk/assets/language/English
V/XBMC ( 2135): 21:33:45 T:5797824 FATAL: : Failed to load English language file, from path: special://xbmc/language/
V/XBMC ( 2135): => XBMC_Run finished with -1
Anyone know how to get this working? I'd load CM9/CM10.1 but apparently this breaks compatibility with a TV (have to use a monitor?)
Click to expand...
Click to collapse
I haven't heard about CM9/CM10.1 breaking compatibility with a TV, but you do lose the ability to use the Q for it's original function (stream Google Music/YouTube from another android device, change the LED lights etc.) I installed the CM 10.1 nightly build and I'm able to use XBMC on my old Vizio TV without any problems.
Not 100% sure about your specific error, but it seems like XMBC just doesn't have a language pack that matches the locale / language you have set in Android and it's not falling back to English. Are you using the latest XBMC for Android from the site?
I used this code:
Code:
mWebViewVertreungsplan = (WebView)findViewById(R.id.webViewVertretung);
mWebViewVertreungsplan.setVisibility(View.VISIBLE);
mWebViewVertreungsplan.setWebViewClient(new WebViewClient());
// Enable Javascript
WebSettings webSettings = mWebViewVertreungsplan.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebViewVertreungsplan.loadUrl("Username: Pasword @ domain. com");
On the on some devices it works, but on others it wont work. I geht the error 401 unauthorized.
Funny enough i am working on a project that has to do with a "substitution plan" as well (dunno what the correct english translation is) xD
You have to put the credentials inside the url header, and they have to be Base64 encoded
I use jsoup library to read the values from a pw protected site, so putting things into header is done differently, but same principle:
[...]Jsoup.connect("domain.com").header("Authorization", "Basic " + encodedString).post()
encodedString is done like that:
String text ="unamewd";
byte[] data = null;
data = text.getBytes("UTF-8");
encodedString = Base64.encode(data, Base64.DEFAULT);
So only thing you would have to google is how to set url header for webview
Hi still new to android, tried the following tutorial in the youtube link here https://www.youtube.com/watch?v=4LCnoVqQ6N4 but I couldn't get the app to work as I am unable to execute the camera on my physical phone where it kept giving me this popup "Something went Wrong while taking photos" when I press the camera imageview. And when I am at the gallery choosing a photo it will cause the app to suddenly stop.
Thus, I downloaded the author's source code here https://drive.google.com/file/d/0B2rvGRbu0A83cjBBZElhdGp5OHM/view but i also encounter the same issues stated above.
Tried adding the permission for camera,read,write external storage in the androidmanifest without any luck of solving it.
Error Log after i click on a image in the gallery:
Code:
08-17 12:21:08.181 17286-17286/com.example.user.cameratoserver E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.user.cameratoserver, PID: 17286
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=400, result=-1, data=Intent { dat=content://com.android.providers.media.documents/document/image:104460 flg=0x1 }} to activity {com.example.user.cameratoserver/com.example.user.cameratoserver.MainActivity}: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=17286, uid=10038 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
at android.app.ActivityThread.deliverResults(ActivityThread.java:3798)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3841)
at android.app.ActivityThread.access$1400(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:234)
at android.app.ActivityThread.main(ActivityThread.java:5526)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=17286, uid=10038 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
at android.os.Parcel.readException(Parcel.java:1627)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:427)
at android.content.ContentResolver.query(ContentResolver.java:497)
at android.content.ContentResolver.query(ContentResolver.java:439)
at com.kosalgeek.android.photoutil.RealPathUtil.getDataColumn(RealPathUtil.java:131)
at com.kosalgeek.android.photoutil.RealPathUtil.getRealPathFromURI_API19(RealPathUtil.java:62)
at com.kosalgeek.android.photoutil.GalleryPhoto.getPath(GalleryPhoto.java:49)
at com.example.user.cameratoserver.MainActivity.onActivityResult(MainActivity.java:100)
at android.app.Activity.dispatchActivityResult(Activity.java:6490)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3794)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3841)
at android.app.ActivityThread.access$1400(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:234)
at android.app.ActivityThread.main(ActivityThread.java:5526)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
if you are testing on a device running android marshmallow and above you should also write code to request the android.permission.READ_EXTERNAL_STORAGE permission at runtime.
Take a look at the following link for android developers https://developer.android.com/training/permissions/requesting.html
nemoc 23 said:
if you are testing on a device running android marshmallow and above you should also write code to request the android.permission.READ_EXTERNAL_STORAGE permission at runtime.
Take a look at the following link for android developers https://developer.android.com/training/permissions/requesting.html
Click to expand...
Click to collapse
Oh i see but I've read the documentation but still at a lost as to how to implement the codes from the documentation into the source code in the link above, as this is my first android development experience was feeling rather lost.
imso said:
Oh i see but I've read the documentation but still at a lost as to how to implement the codes from the documentation into the source code in the link above, as this is my first android development experience was feeling rather lost.
Click to expand...
Click to collapse
If you are below MM you just need to add the permission to the manifest.
Code:
<manifest>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>
If you are on MM or higher you need to add the permission the manifest and then ask for it at runtime.
Code:
if (ContextCompat.checkSelfPermission(activity, Manifest.permission.READ_CONTACTS) != PackageManager.READ_EXTERNAL_STORAGE) {
ActivityCompat.requestPermissions(thisActivity, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, CALLBACK_ID);
}
You will also need to handle the result of that on your activity:
Code:
@Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
if (requestCode == CALLBACK_ID) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// Granted
} else {
// Not granted
}
}
}