这可能是什么原因? 我们只是尝试在以下服务类中查询浏览器历史记录,但是eclipse会生成错误The method managedQuery is undefined for the type Service_class Service_class.java

我们试图遵循月食的建议-但它完全打开了另一罐蠕虫。

例:

public class Service_class extends Service {
       String Dirty1 = "www.playboy.com";
        String Dirty2 = "www.penthouse.com";
        String Dirty3 = "www.pornhub.com";
        String Dirty4 = "www.playboy.com";
        String Dirty5 = "www.playboy.com";
        String Dirty6 = "www.playboy.com";
        String Dirty7 = "www.playboy.com";
        String Dirty8 = "www.playboy.com";
        String Dirty9 = "www.playboy.com";
        String Dirty10 = "www.playboy.com";

    @Override
    public IBinder onBind(Intent arg0) {
        return null;
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Toast.makeText(this, "Service Started", Toast.LENGTH_LONG).show();

        return START_STICKY;
    }

    @Override
    public void onDestroy() {

        super.onDestroy();
        Toast.makeText(this, "Service Stopped", Toast.LENGTH_LONG).show();

    }

    @Override
    public void onCreate() {
        super.onCreate();
        String[] projection = new String[] { Browser.BookmarkColumns.TITLE,
                Browser.BookmarkColumns.URL };
                Cursor cursor = managedQuery(android.provider.Browser.BOOKMARKS_URI,
                        projection, null, null, null);
                String urls = "";
                if (cursor.moveToFirst()) {
                String url1 = null;
                String url2 = null;
                do {
                String url = cursor.getString(cursor.getColumnIndex(Browser.BookmarkColumns.URL));

                if (url.toLowerCase().contains(Dirty1)) {
                } else if (url.toLowerCase().contains(Dirty2)) {
                } else if (url.toLowerCase().contains(Dirty3)) {
                } else if (url.toLowerCase().contains(Dirty4)) {
                } else if (url.toLowerCase().contains(Dirty5)) {
                } else if (url.toLowerCase().contains(Dirty6)) {
                } else if (url.toLowerCase().contains(Dirty7)) {
                } else if (url.toLowerCase().contains(Dirty8)) {
                } else if (url.toLowerCase().contains(Dirty9)) {
                } else if (url.toLowerCase().contains(Dirty10)) {
                //if (url.toLowerCase().contains(Filthy)) {
                urls = urls
                + cursor.getString(cursor.getColumnIndex(Browser.BookmarkColumns.TITLE)) + " : "
                + url + "\n";
                Intent intent = new Intent(Service_class.this, Warning.class);
                Service_class.this.startActivity(intent);
                }
                } while (cursor.moveToNext()); 
            //  tv.setText(urls);


    }

}}

===============>>#1 票数:0 已采纳

服务不存在托管查询功能。 它仅对于活动存在。 您仍然可以执行查询,但是必须管理游标并手动关闭它。

===============>>#2 票数:0

在onCreate方法的第3行中,您正在使用托管查询方法。 它在哪里定义?

  ask by UT Tech Lab Students translate from so

未解决问题?本站智能推荐: