Note that there are some explanatory texts on larger screens.

plurals
  1. POPreferenceActivity: OnPreferenceStartFragment "Syntax error on token ";", { expected after this token"
    primarykey
    data
    text
    <p>So I'm trying to make a Settings screen and it seemed to work until I realized that the preferences won't react to clicks. I tried using onPreferenceStartFragment, but there's a strange error I'm encountering with the line</p> <pre><code>boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) </code></pre> <p>Here's the onPreferenceStartFragment:</p> <pre><code>public interface OnPreferenceStartFragment { boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref); //Syntax error on token ";", { expected after this token if(pref == password) { LayoutInflater inflater = LayoutInflater.from(context); final View text = inflater.inflate(R.layout.changepassword, null); final EditText currentPassword = (EditText)text.findViewById(R.id.currentPassword); final EditText newPassword = (EditText)text.findViewById(R.id.newPassword); final AlertDialog.Builder alert = new AlertDialog.Builder(context); alert.setTitle("Change Your Password"); alert.setView(text); alert.setPositiveButton("Change", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String stringData = currentPassword.getText().toString().trim(); String stringNew = newPassword.getText().toString().trim(); dataReturned = myFolder.getString("passwordKey", ""); if(dataReturned.equals(stringData)) { String newData = newPassword.getText().toString().trim(); SharedPreferences.Editor editor = myFolder.edit(); editor.putString("passwordKey", newData); editor.commit(); dataReturned = myFolder.getString("passwordKey", "couldn't load data"); Toast.makeText(context, "Password changed", Toast.LENGTH_SHORT).show(); currentPassword.setText(""); newPassword.setText(""); } else { Toast.makeText(context, "Incorrect Password", Toast.LENGTH_LONG).show(); currentPassword.setText(""); newPassword.setText(""); } } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub dialog.cancel(); } }); alert.show(); ; } if(pref == notification) { NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.device_access_secure) .setOngoing(true) .setContentTitle("Obstruct") .setContentText("Start Stealth Mode"); Intent resultIntent = new Intent(); TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(resultPendingIntent); NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(0, mBuilder.build()); } return true; } </code></pre> <p>Everything seems to be right, but it's flummoxing me that it's not. Any Ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload