1

I have an android application. I am facing some problems while compile. So where is the problem. Please help me. Sorry for my poor english.

Here is the erro:

Information:Using javac 1.6.0_65 to compile java sources
Information:java: Errors occurred while compiling module 'cycle4it_android'
Information:Compilation completed with 1 error and 6 warnings in 2 sec
Information:1 error
Information:6 warnings
Warning:java: Note: /Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/DonateActivity.java uses unchecked or unsafe operations.
Warning:java: Note: Recompile with -Xlint:unchecked for details.
/Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/DonateActivity.java
    Warning:Warning:line (417)java: /Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/DonateActivity.java:417: warning: [deprecation] Notification(int,java.lang.CharSequence,long) in android.app.Notification has been deprecated
    Warning:Warning:line (419)java: /Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/DonateActivity.java:419: warning: [deprecation] setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent) in android.app.Notification has been deprecated
/Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/SignupActivity.java
    Error:Error:line (28)java: /Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/SignupActivity.java:28: cannot find symbol
symbol  : method setPluginsEnabled(boolean)
location: class android.webkit.WebSettings
/Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/SubmitActivity.java
    Warning:Warning:line (106)java: /Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/SubmitActivity.java:106: warning: [deprecation] Notification(int,java.lang.CharSequence,long) in android.app.Notification has been deprecated
    Warning:Warning:line (107)java: /Users/m/Projects/navico/mobile/android/cycle4it_android/src/com/cubicasa/cycle4it/SubmitActivity.java:107: warning: [deprecation] setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent) in android.app.Notification has been deprecated

Here is my signup activity:

public class SignupActivity extends Activity {
WebView webview;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.sign_up);

    webview = (WebView) findViewById(R.id.webView1);
    webview.getSettings().setJavaScriptEnabled(true);

    webview.getSettings().setJavaScriptEnabled(true);
    webview.getSettings().setLoadWithOverviewMode(true);
    webview.getSettings().setUseWideViewPort(true);
    webview.getSettings().setBuiltInZoomControls(true);
    webview.getSettings().setPluginsEnabled(true);
    webview.loadUrl("http://beta.cycle4it.com/register");

}

Here is my Submit activity:

public class SubmitActivity extends Activity implements OnClickListener {

TextView distance, userid, purpose, email, type;
Button submit;
NotificationManager nm;
static final int uniqueId=12;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.submit);
    new CreateUser().execute();
    submit = (Button) findViewById(R.id.submit);
    distance = (TextView) findViewById(R.id.distance);
    userid = (TextView) findViewById(R.id.usrid);
    String distanceink = String.valueOf(Constant.totalDistanceinKm);
    String userId = Constant.idusr;
    distance.setText(distanceink);
    userid.setText(userId);
    nm=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
    nm.cancel(uniqueId);
    submit.setOnClickListener(this);

}

class CreateUser extends AsyncTask<String, String, String> {

    @Override
    protected String doInBackground(String... args) {
        // TODO Auto-generated method stub
        // Check for success tag
        String distanceink = String.valueOf(Constant.totalDistanceinKm);
        String useridc = String.valueOf(Constant.idusr);

        HttpClient client = new DefaultHttpClient();

        String url = "http://......./api/POST/donate/data";
        HttpPost httppost = new HttpPost(url);
        // httppost.setHeader("Content-type", "application/json");
        // httppost.setHeader("Accept", "application/json");

        try {
            List<NameValuePair> namevalpair = new ArrayList<NameValuePair>();
            namevalpair.add(new BasicNameValuePair("km", distanceink));
            namevalpair.add(new BasicNameValuePair("id", useridc));
            namevalpair.add(new BasicNameValuePair("purpose", "1"));
            namevalpair.add(new BasicNameValuePair("email",
                    "[email protected]"));
            namevalpair.add(new BasicNameValuePair("type", "1"));
            UrlEncodedFormEntity entity = new UrlEncodedFormEntity(
                    namevalpair, HTTP.UTF_8);
            httppost.setEntity(entity);

            HttpResponse httpresponse = client.execute(httppost);
            int responsecode = httpresponse.getStatusLine().getStatusCode();
            Log.d("responsenummmm", "submit" + responsecode);
            // Log.d("httpresponseeeee", httpresponse.toString());
        } catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }
}

@Override
public void onClick(View v) {
    // TODO Auto-generated method stub
    Intent intent = new Intent(this, NotificationActivity.class);
    PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
    String body="Good job: "+Constant.distance+" biked so";
    String title="Cycle4it";
    Notification n = new Notification(R.drawable.nf, body, System.currentTimeMillis());
    n.setLatestEventInfo(this, title, body, pIntent);
    n.defaults=Notification.DEFAULT_ALL;
    nm.notify(uniqueId, n);
    this.finish();
}

}
6
  • i guess your lint is not working. Commented Feb 10, 2014 at 5:55
  • Can you please post some code? Commented Feb 10, 2014 at 5:56
  • these are just lint warnings. Put cursor on line which is showing error and press F2 key. It will show popup. Click on "Disable lint check for this project" Commented Feb 10, 2014 at 5:58
  • @Haresh I updated my question. Please check. Commented Feb 10, 2014 at 6:01
  • What is on line 28 of SignupActivity ? Commented Feb 10, 2014 at 6:03

2 Answers 2

2

try to replace this peace of code

webview.getSettings().setPluginsEnabled(true)

To

webview.getSettings().setPluginState(WebSettings.PluginState.ON);
Sign up to request clarification or add additional context in comments.

Comments

1

The issue is that the setPluginsEnabled method that you're trying to call on a WebSettings doesn't seem to exist (cf documentation).

There is a setPluginState method but it's going to be deprecated and should not be used anymore.

Plugins will not be supported in future, and should not be used.

Comments

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.