Note that there are some explanatory texts on larger screens.

plurals
  1. POevery time only "else case alert dialog" is invoking?
    text
    copied!<p>please help me with this code: every time only the else case is executing not the if case i have a html file in asset/www folder and this is listview<br> Here i am providing the ListviewActivity i will have max of 20 in that list and each list will have an webview </p> <p>//this is the data in the list view private String arr[]={"sunny","cool","hot","rainy"}; list.setOnItemClickListener(new OnItemClickListener() {</p> <pre><code> public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position, long arg3) { /*Intent myIntent = new Intent(SpellsActivity.this, Details.class); myIntent.putExtra("key",(String) list.getItemAtPosition(position)); startActivity(myIntent);*/ String str =(String) list.getItemAtPosition(position); Context mContext= SpellsActivity.this; AlertDialog.Builder alert = new AlertDialog.Builder(mContext); //this is where i need you to see only else case is invoking not the if if(str.equalsIgnoreCase(arr[0])){ alert.setTitle("Sunny"); WebView wv=new WebView(mContext); wv.loadUrl("file:///android_asset/www/sunny.html"); } else{ alert.setTitle("Cool"); WebView wv=new WebView(mContext); wv.loadUrl("file:///android_asset/www/cool.html");*/ } alert.setView(wv); alert.setIcon(R.drawable.ic_launcher); alert.setPositiveButton("Back", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Toast.makeText(getApplicationContext(), "BACK", Toast.LENGTH_SHORT).show(); } }); alert.show(); } }); } } </code></pre> <p>For testing whether it is working or not i have just used the two options sunny or else</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