1

Basically, I am developing an online library management system. I have successfully displayed the whole database as a listView using PHP, JSON and Async Task. Now I need to search that listView and and display the selected item's detail in a new Activity.

3
  • sql where and some appropriate parameters for your http call? if you've gotten this far, it's just a few extra steps to actually FILTER the whole database. Commented Aug 5, 2014 at 13:43
  • you can make a REST webservice in php and let the android app call that service. JSON would be returned to the app and then app can handle the displaying part. Alternatively you can also develop a Single Page Application for the same and call it in the webView for android app. You can use WHERE, MATCH AGAINST and HAVING for searching the data in DB Commented Aug 5, 2014 at 13:43
  • Thank you @SaurabhSinha. The alternate step helped! Commented Aug 5, 2014 at 15:27

1 Answer 1

1

You can try creating your new activity with a WebView that opens your PHP url with a query string dictating your search. This would be a start.

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.webview);

    Intent intent = getIntent();
    String stringPassed = intent.getExtras().getString("searchParam");

    webView = (WebView) findViewById(R.id.webView1);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl("http://www.yoursite.com/search/?string="+stringPassed);

}

Your listView will have to pass strings to your webView activity in order to dynamically generate your query string, which is subsequently used to generate your search parameters.

Sign up to request clarification or add additional context in comments.

1 Comment

anyone can send this project please, the link is google webview, but i need that come from webserver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.