java - error missing return statement in method -


i want data based on fragment of name , why error description of missing return statement ?

public cursor getname (string nama){     cursor c = db.query(konstanta.nama_tabel, new string[]{             konstanta.id_artis,             konstanta.nama_artis,             konstanta.gender_artis_pria,             konstanta.gender_artis_wanita,             konstanta.tglahir}, konstanta.nama_artis + "like '%" + nama + "%'",             null, null, null, null, null);     if (c != null){         c.movetofirst();         return c;     } } 

your method returns result if c not null. must return result in scenarios, i.e. if c null.

you can change

    if (c != null){         c.movetofirst();         return c;     } 

to

    if (c != null){         c.movetofirst();     }     return c; 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -