Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Pasting the whole code of an application just made this for your purpose.</p> <pre><code> package asdasd.adasd.ad; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.Spinner; import android.widget.Toast; public class AsdasdasActivity extends Activity { public static final int DIALOG_DOWNLOAD_PROGRESS = 0; private ProgressDialog mProgressDialog; Spinner spLoadFrom; private ArrayAdapter&lt;CharSequence&gt; spinnerArrayAdapter; String name[] = { "1.html", "2.html", "3.html"}; String displayName[] = {"1st Name", "2nd Name", "3rd name" }; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mProgressDialog = new ProgressDialog(AsdasdasActivity.this); mProgressDialog.setIndeterminate(false); mProgressDialog.setMax(100); mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); spLoadFrom = (Spinner) findViewById(R.id.Spinner02); spinnerArrayAdapter = new ArrayAdapter&lt;CharSequence&gt;(this, android.R.layout.simple_spinner_item, displayName); spinnerArrayAdapter .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spLoadFrom.setAdapter(spinnerArrayAdapter); SpinnerListener spListener = new SpinnerListener(); spLoadFrom.setOnItemSelectedListener(spListener); WebView wv = (WebView)findViewById(R.id.webView1); wv.getSettings().setJavaScriptEnabled(true); /* wv.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }); */ wv.loadUrl("file:///android_asset/htmlfileMine.html"); Button atcBack = (Button) findViewById(R.id.atcBacksecweb); atcBack.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub setResult(RESULT_OK); finish(); } }); } private void emailme() { // TODO Auto-generated method stub try{ String domsEmail = ""; String message = "Insert Message Here"; String myemail[] = { domsEmail }; Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, myemail); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, ""); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message); startActivity(emailIntent); }catch (Exception e) { Toast.makeText( AsdasdasActivity.this, "No email application is available, please download one from Play store.", Toast.LENGTH_LONG).show(); } } public class SpinnerListener implements OnItemSelectedListener { public SpinnerListener() { } public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, final int position, long arg2) { WebView wv = (WebView)findViewById(R.id.webView1); wv.getSettings().setJavaScriptEnabled(true); wv.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }); wv.loadUrl("file:///android_asset/"+name[position]); } public void onNothingSelected(AdapterView&lt;?&gt; arg0) { } } } </code></pre> <p>/// XML LAYOUT</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /&gt; &lt;Spinner android:id="@+id/Spinner02" android:layout_width="match_parent" android:layout_height="wrap_content" /&gt; &lt;ProgressBar android:id="@+id/progressBar1" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;Button android:id="@+id/atcSubmitweb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /&gt; &lt;Button android:id="@+id/atcBacksecweb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /&gt; &lt;WebView android:id="@+id/webView1" android:layout_width="300dp" android:layout_height="300dp" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload