asked    Celeste     2018-10-22       html       104 view        1 Answer

[SOLVED] Load HTML file through file naming in Android Studio

I need to load a random image, according to the outcome and based on that I need to load a certain HTML file. Can I link them through naming?

When I load a drawable house.jpg it has to link dynamically with house.html.

(The image and HTML file have to be separate. So no need to say you can put everything in one HTML file.)

  1 Answer  

        answered    Olive     2018-10-22      

You can only do such a thing if our image is inside your /assets folder. Also, you must load your html with a baseUrl that's inside your assets folder

You can use WebView.loadUrl() or WebView.loadDataWithBaseURL():



webView.loadDataWithBaseURL("file:///android_asset/", "<img src='file.jpg' />", "text/html", "utf-8", null);

(file.jpg should be inside your assets folder)

To compare which button :

Use getDrawable() method in ImageButton and compare them using .getConstantState().equals()

Sample code:

ImageButton btn = (ImageButton) findViewById(;
Drawable drawable = btn.getDrawable();
if (drawable.getConstantState().equals(getResources().getDrawable(R.drawable.myDrawable).getConstantState())){
   //Do your work here


Get drawable of image button

Your Answer

 2018-10-22         Sarah

Multiple microsites will login as one

I have multiple microsites:https://www.samplesite.comhttps://subdomain2.samplesite.comhttps://subdomain3.samplesite.comhttps://subdomain4.samplesite.comhttps://subdomain5.samplesite.comOnce I login to one of these, it should also automatically create a logged session for other microsites just like GOOGLE.How can I do this? Any ideas?As I know, session is individually created for each domains and is certainly not readable for other domains. P.S. I am using codeigniter as framework. You should be searching the keyword "Single Sign-On". There are many ways to do it. But ba...
 php                     1 answers                     84 view
 2018-10-22         Daniel

how to make a html login page that connect to database

Lets say I have a login.html page with a html templateAnd I want to use that login.html template to login to another login.php page.Say, when a user types in email and password in login.html, I want that login.html page to type the same email and password in my another website which has login.php page.For this example, lets take blesta - it has a login.php page but the landing page is simple and is not beautiful.I have another html page named login.html which looks sleek and beautiful but I don't want to transfer users to blesta login.php and then they enter their credentia...
 html                     1 answers                     85 view
 2018-10-22         Maurice

python ~ requests // login and send form not working

Ive written code for a programming mission 2 on hackthissite, just some fun and to practice coding etc. I have completed the mission but i was unable to get python to login using the requests library and upload my code to the form automatically.Here is a snippet from my code with the code that is not working and still says 'you need to login' etc, when page content.def upload_code(key): login_url = ''btn_submit = 'Login'username = 'example_username'password = 'example_password''login = { 'btn_submit':btn_submit, 'passw...
 python                     1 answers                     86 view