0
просто интересно, может ли кто-нибудь помочь мне с этим, я пытаюсь добавить салфетки для обновления функции, и я не вижу, где я ошибаюсь, я просто получаю сообщение об ошибке, не могу разрешить символ mySwipeRefreshLayoutAndroid Studio Swipe Refresh
Heres код. Благодаря код
public class eventsListActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener {
mySwipeRefreshLayout.setOnRefreshListener(
new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
refreshList();
}
}
public class eventsListActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener {
mySwipeRefreshLayout.setOnRefreshListener(
new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
refreshList();
}
}
XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_events_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.parse.fypPlannr.eventsListActivity"
android:background="#24B14D">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/Swiper"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:id="@+id/eventList"
android:layout_below="@+id/createEvent"
android:textColor="@android:color/holo_orange_light"/>
</android.support.v4.widget.SwipeRefreshLayout>
<Button
android:text="Map View"
android:layout_height="wrap_content"
android:id="@+id/mapButton"
android:layout_width="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#029789"
android:textColor="#ffffbb33"
android:onClick="mapView" />
<Button
android:text="Log Out"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/logOut"
android:onClick="logOut"
android:background="#029789"
android:textColor="#ffffbb33"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="@+id/mapButton"
android:layout_toStartOf="@+id/mapButton" />
<Button
android:text="Create Event"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/createEvent"
android:onClick="createEvent"
android:background="#04988a"
android:textColor="#ffffbb33"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/mapButton"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_events_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.parse.fypPlannr.eventsListActivity"
android:background="#24B14D">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/Swiper"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:id="@+id/eventList"
android:layout_below="@+id/createEvent"
android:textColor="@android:color/holo_orange_light"/>
</android.support.v4.widget.SwipeRefreshLayout>
<Button
android:text="Map View"
android:layout_height="wrap_content"
android:id="@+id/mapButton"
android:layout_width="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#029789"
android:textColor="#ffffbb33"
android:onClick="mapView" />
<Button
android:text="Log Out"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/logOut"
android:onClick="logOut"
android:background="#029789"
android:textColor="#ffffbb33"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="@+id/mapButton"
android:layout_toStartOf="@+id/mapButton" />
<Button
android:text="Create Event"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/createEvent"
android:onClick="createEvent"
android:background="#04988a"
android:textColor="#ffffbb33"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/mapButton"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
http://pastebin.com/u72WtQ3y Java Code
http://pastebin.com/9KnYhJLp Xml
Я отредактировал ваше сообщение, это будет видно на мгновение. И я разместил код внутри вашего сообщения. Удостоверьтесь, что вы лучше объясняете код и публикуете свой логарифм, и вы можете удалить эти ссылки, указывающие на некоторый webiste вне stackoverflow. – Yupi
Вам нужно объявить переменную в Java, прежде чем использовать ее. Ваш 'mySwipeRefreshLayout' не был объявлен в текущем классе или в любом из суперклассов. Пожалуйста, потратьте некоторое время на работу с [Учебники Java] (https://docs.oracle.com/javase/tutorial/) перед тем, как приступить к Android, иначе с этого момента у вас будут сложные проблемы во всем мире. –