Closed ac1692 closed 10 years ago
You have the line: final MyItem deletedItem = lviewAdapter.getItem(position);
I don't see an import to a MyItem
class in the top of the file.
If you store MyItem
obejcts in the adapter you will need to import it. That is also what the error means. If a type cannot be found, you have forgotten to import
it correctly (or it doesn't exist at all).
Please provide an example for this. How and where should I write it in my adapter?
This is a very, very basic java coding question not anyhow related to this library. Sorry, but I don't want to describe that in any more detail then I did above. If that wasn't understandable, I highly recommend reading some Java coding guides to get more known to the language.
this is my code:- MainActivity.java package swipe.test;
import de.timroes.swipetodismiss.SwipeDismissList; import de.timroes.swipetodismiss.SwipeDismissList.UndoMode; import de.timroes.swipetodismiss.SwipeDismissList.Undoable; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.ListView; import android.os.Build;
public class MainActivity extends ActionBarActivity {
}
package swipe.test;
ListViewAdapter.java
import android.app.Activity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView;
public class ListViewAdapter extends BaseAdapter { Activity context; String title[]; String description[];
}
activity_main.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="swipe.test.MainActivity" tools:ignore="MergeRootFrame" >