There is a mysterious error at the line ee.add(new BasicNameValuePair("uid","demo"));
Eclipse says:
Multiple markers at this line
- Syntax error on token "add", = expected after this token
- Syntax error on token(s), misplaced construct(s)
package com.test;
import java.util.*;
import org.apache.http.*;
import android.app.Activity;
import android.os.Bundle;
public class HttpMysqlActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
ArrayList<NameValuePair> ee = new ArrayList<NameValuePair>();
ee.add(new BasicNameValuePair("uid","demo"));//error occurs here
}
I don't know what the problem is, because ArrayList do have the method add(), and I saw many people (e.g. Link a tutorial of Connecting to MySQL database) code like this. That's why it is mysterious.
Can anybody tell me why did Eclipse throw the error and how to fix it?