请帮我使用此代码: 每次只有其他情况下执行不是如果我有资产/ www文件夹中的html文件,这是列表视图
在这里,我提供ListviewActivity我将有最多20在这个列表中,每个列表将有一个webview每次只有“else case alert dialog”正在调用?
//这是列表视图中的数据 private String arr [] = {“sunny”,“cool”,“hot”,“rainy”}; list.setOnItemClickListener(新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();
}
});
}
}
为了测试是否是工作或没有我刚才所用的两种选择晴天或其他
对不起朋友得到的答案,但无法发布,因为较少的声誉将在6小时后发布 – VENKI 2012-01-15 14:02:58