2014-01-23 49 views
1

以下塊,而建立在Android的錯誤設置菜單類

@Override 
protected void onListItemClick(ListView l, View v, int position, long id) { 
    // TODO Auto-generated method stub 
    super.onListItemClick(l, v, position, id); 
    String ncall = Classes[position]; 
    try { 
     Class ourClass=Class.forName("com.example.newtrynow.", + ncall); 
\\above line shows error, why is "+" not supported its just appending the rest of string 
     Intent ourIntent=new Intent(Menu.this, ourClass); 
     startActivity(ourIntent); 
    } catch (ClassNotFoundException e) { 
     // TODO Auto-generated catch block 
     e.printStackTrace(); 
    } 
} 

回答

0

一個新的菜單,從下面的行刪除逗號

Class ourClass=Class.forName("com.example.newtrynow.", + ncall); 

它應該是這樣的

拋出一個錯誤
Class ourClass=Class.forName("com.example.newtrynow." + ncall); 
+0

大聲笑解決了..愚蠢的錯誤雖然 – Akash

+0

笏做參數密碼在文本視圖中做?機器人:密碼 – Akash