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
Here i am providing the ListviewActivity i will have max of 20 in that list and each list will have an webview
//this is the data in the list view
private String arr[]={“sunny”,”cool”,”hot”,”rainy”};
list.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> 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();
}
});
}
}
For testing whether it is working or not i have just used the two options sunny or else
sorry friends that its not the like if is not invoked but the web-view in the if clause is not executed because of the objects
now it is perfect.thanks!