android - The method onFetchComplete(List<Application>) of type MainActivity must override a superclass method error -
i trying show content mysql database in listview below listactivity implementing interface fetchdatalistener.but giving errors 1.the method onfetchcomplete(list) of type mainactivity must override superclass method error 2.the method onfetchfailure(list) of type mainactivity must override superclass method error
please see below class , interface files
class
/*package com.example.androidhive; import java.util.list; import android.app.listactivity; import android.app.progressdialog; import android.os.bundle; import android.widget.toast; public class mainactivity extends listactivity implements fetchdatalistener{ private progressdialog dialog; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); initview(); } private void initview() { // show progress dialog dialog = progressdialog.show(this, "", "loading..."); string url = "http://192.168.0.2/android_login_api/include/apps.php"; fetchdatatask task = new fetchdatatask(this); task.execute(url); } @override public void onfetchcomplete(list<application> data) { // dismiss progress dialog if(dialog != null) dialog.dismiss(); // create new adapter applicationadapter adapter = new applicationadapter(this, data); // set adapter list setlistadapter(adapter); } @override public void onfetchfailure(string msg) { // dismiss progress dialog if(dialog != null) dialog.dismiss(); // show failure message toast.maketext(this, msg, toast.length_long).show(); } } */
interface
/*package com.example.androidhive; import java.util.list; public interface fetchdatalistener { public void onfetchcomplete(list<application> data); public void onfetchfailure(string msg); } */
please me, in advance
use sqlitedatabase class this
sqlitedatabase db = openorcreatedatabase("database_name", mode_private, null); //create table string strsql = "create table if not exists tablename(name varchar(30),id int(15) unique) "; db.execsql(strsql);
you can fire query in mysql(insert,update,delete) using db.execsql()
to retrive data can use this
strsql = "select * tablename "; cursor c = db.rawquery(strsql, null); int count = c.getcount(); c.movetofirst(); while (k >= 0) { listviewcontent.add(c.getstring(c.getcolumnindex("name"))); setlistadapter(new listviewadapter(this)); c.movetonext(); k--; } //you can set retrived data list view shown above.
Comments
Post a Comment