How to do swipe to delete cardview in android using support library

Hi I am using support library android.support.v7.widget.CardView to achieve cardview functionality in my android app. I want to achieve swipe to delete functionality in it as well. <android.support.v7.widget.CardView xmlns:card_view=”http://schemas.android.com/apk/res-auto” android:id=”@+id/card_view” android:layout_gravity=”center” android:layout_width=”200dp” android:layout_height=”200dp” card_view:cardCornerRadius=”4dp”> <TextView android:id=”@+id/info_text” android:layout_width=”match_parent” android:layout_height=”match_parent” /> </android.support.v7.widget.CardView> How to achieve swipe to delete functionality in it? Thanks in advance.

Error in Eclipse (for Android): The type java.lang.String cannot be resolved. It is indirectly referenced from required .class files

I am trying to run an Android project that someone else has created. I have opened the project in Eclipse as: File –> New –> Project –> Android Project from existing code Here are the first two lines of one of Java files: package aa.bb.cc; import java.io.File; There is red cross sign at the beginning […]

The method OpenFileOutput() is undefined !

firstly, I coded some methods in Main Activity, But I decided they should be a class. this is my code… openFileOutput and openFileInput are undefined. Any idea?? maybe it should be service or activity…?? package spexco.hus.system; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Date; import spexco.hus.cepvizyon.CepVizyon; import android.content.Context; public class LicenseIDB { private […]

Is there a way to detect which cellular network is used on Android?

My app will feature live video streams. I would like to know if there is a way to detect if the user has 2G, 3G, or 4G on their devices, and if the which category the current connection belongs to? My question is specifically about Android devices.

Get Touch Coordinates Relative To A View (ScreenToClient Equivalent?)

I have an image I am displaying to a user in my android application. I want to be able to tell where they ‘touch’ the image. I can easily get the screen coordinates by implementing an OnTouchListener private OnTouchListener image_Listener = new OnTouchListener(){ @Override public boolean onTouch(View v, MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_UP) { […]

Android: Cannot invoke toString() on the primitive type int

If I try nltxt = nllen.toString(); with nllen being int nllen = nl.getLength(); I get the error Cannot invoke toString() on the primitive type int. I want to convert the int to string so i can display the number of entries with Log… Why doesn’t it work?

Using the colors for the new Material design theme in Android

I was in the process of designing an Android application and decided to try out the new Material theme. I found all of the available color schemes for the new theme online, but I was unable to find a corresponding .xml file that has all of the colors in the color palette. Does anyone know […]

Adding rows into Cursor manually

I have an array of phone numbers and I want to get the corresponding contact names from the contacts database. In the array of phone numbers, I also have some numbers that are not saved before to the contact database. For example; 3333333 -> Tim 5555555 -> Jim 1111111 -> unknown I have the array […]

Android ScrollView adds extra padding on top and bottom of child imageview

I have a problem with rendering a ScrollView. Essentially, the layout is fixed header and footer with a scrollview in the middle. The idea is that when the screen keyboard is activated for the content EditText the image can be scrolled if the height of the image is longer than the middle view. In testing […]

The method getApplicationContext() is undefined – fragment issues

I am getting the following errors: The method getApplicationContext() is undefined The method findViewById(int) is undefined for the type Fragment1 These errors seem to be eliminated when my class is extended to an Activity as oppose to a fragment, but it is important that this activity remains as a fragment, so I am not too […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.