Hello i am Yassine and i am newbee in android development. I want to create a simple app that retrieve answers from WolframAlpha website. And i am stuck with lot of errors. This is a part of my code:
`//Get The Search Input From The Main Activity
String sciSearch = myIntent.getStringExtra(HomeActivity.EXTRA_MESSAGE);
//Call WAengine
WAEngine engine = new WAEngine();
Log.d("Engine","Engine Was Created");
//Check The App Id
engine.setAppID(appid);
Log.d("AppId","App Selected");
engine.addFormat("plaintext");
//Create A Query
WAQuery query = engine.createQuery();
//Submit The Query
query.setInput(sciSearch);
//Get Results
//Print The Url
result = (TextView) findViewById(R.id.title);
content = (TextView) findViewById(R.id.content);
//String url = engine.toURL(query);
//result.setText(url);
//Here is The Problem
try{
Log.d("Query Performed","The Query was not performed");
WAQueryResult queryResult = engine.performQuery(query);
Log.d("Query Performed","The Query was performed");
for(WAPod pod : queryResult.getPods()){
if(!pod.isError()){
Log.d("Pod",pod.getTitle());
//result.setText(pod.getTitle());
for (WASubpod subpod : pod.getSubpods()) {
for (Object element : subpod.getContents()) {
if (element instanceof WAPlainText) {
//content.setText(((WAPlainText) element).getText());
Log.d("Content",((WAPlainText) element).getText());
}
}
}
}
}
}catch (WAException e) {
e.printStackTrace();
}`
When i check the Logcat, it logs that the Query Is Not Perfomed for first Error. Then i got another Error of 'URLFetcher' as a TAG and it says Exception Downloading URL http://api.wolframalpha.com/v2/query?appid=XXX&input=pi&format=PLAINTEXT&async=false&reinterpret=true Then another and last Error TAG : EGL_genymotion saying that eglSurfaceAttrib not implmented. I hope i was clear enough i already checked the url that is requested it returns an xml file so should i just use XmlPullParser to parse it, other than using the default one in the Wolframe library. Sorry if my code is not professional i am still working on my self (Will Do Some Refactoring) :). Thanks.