I'm pretty new in Android development
I have this Activity class
public class ElencoNotificheActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_elenco_notifiche);
}
private void setRefreshListener()
{
ListView elencoNotificheView = (ListView)findViewById(R.layout.elencoNotificheView);
}
}
In my activity class i have the following error:
Error:(18, 71) error: cannot find symbol variable elencoNotificheView
But in my layout XML I have:
<ListView
android:id="@+id/elencoNotificheView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawSelectorOnTop="true"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
/>
it should be R.id.elencoNotificheView
not R.layout. elencoNotificheView
R.layout. elencoNotificheView
So your ListView should be like this:
ListView elencoNotificheView = (ListView)findViewById(R.id.elencoNotificheView);
You should have R.id.elencoNotificheView
:
private void setRefreshListener()
{
ListView elencoNotificheView = (ListView)findViewById(R.id.elencoNotificheView);
}
It should be
ListView elencoNotificheView = (ListView)findViewById(R.id.elencoNotificheView);
instead of
ListView elencoNotificheView = (ListView)findViewById(R.layout.elencoNotificheView);
You need fix it below code ..
private void setRefreshListener()
{
ListView elencoNotificheView = (ListView)findViewById(R.layout.elencoNotificheView);
}
Update
ListView elencoNotificheView = (ListView)findViewById(R.id.elencoNotificheView);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.