How to open a local .html file in Android and Blackberry emulators for testing?

How to open a local .html file in Android and Blackberry emulators?

I can open any URL from the Internet, but I am developing a site for mobile devices on my local PC, and I want to run my locally developed HTML files in emulators.

alt textalt text

+4
source share
3 answers

You can access the local PC from the Android emulator through 10.0.2.2. If you want to test HTML files on the local file system, you need to serve these files from some HTTP server. The very simple one I use for this purpose is mongoose , which can serve any local directory without any configuration.

I have no experience with the Blackberry emulator, but you must have access to the local PC using its network IP address. You can access HTML files from the local HTTP server in the same way as with the Android emulator.

+4
source

I can’t speak for a blackberry, but on android you can do this by creating a simple activity. You will need a WebView in the layout, something like this:

<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"> <WebView android:id="@+id/web_engine" android:layout_width="fill_parent" android:layout_height="fill_parent" > </WebView> </LinearLayout> 

Then in your onCreate method you will need to find a link to your web view and call the download URL method with the file path in your html file.

 WebView wv = (WebView) findViewById(R.id.web_engine); wv.loadUrl("file:///android_asset/HTML_FILE_NAME.html"); 

for this example, you will need to put your html file in the resource folder in your project. If you are trying to view your html file without creating an application, this can be trickier. On real devices, I know that you can put the html file on the SD card and navigate to it using the file manager program and open it in a standalone browser. I don't know if this will work on an emulator.

+3
source

The answer is provided upon publication.

Blackberry Simulator FileSystem: where is it?

In your own words, using the BB9900 simulator, for a simple HTML5 project, Windows XP. 1. Launch the BB simulator. 2. ALT-C (change SD card) 3. click on the left β€œadd directory” icon and then go to the file system to find where you have a local application that you are developing (for example, C: \ temp \ myapp ) 4. Click on the second icon on the right (Mount selected) 5. click on the close icon (bottom right)

At this point, if you are using a file browser application, you can access the file system of your PC, where you have a local application, and check it.

Someone suggested serving it through a web server ... not necessary.

0
source

Source: https://habr.com/ru/post/1333594/


All Articles