Android Open Source - javainstaller Change Path

From Project

Back to project page javainstaller.


The source code is released under:

GNU General Public License

If you think the Android project javainstaller listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package julianwi.javainstaller;
/*w w w  . j a  v  a2s . c om*/
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;

public class ChangePath implements OnClickListener,
    android.content.DialogInterface.OnClickListener {
  private SharedPreferences sharedP;
  private Context mcontext;
  private ChecklistAdapter madapt;
  public ChangePath(SharedPreferences sharedP2, Context context, ChecklistAdapter adapt){
    sharedP = sharedP2;
    mcontext = context;
    madapt = adapt;

  public void onClick(DialogInterface dialog, int which) {

  public void onClick(View v) {
    showalert(v.getId(), sharedP.getString("path"+v.getId(), ""));
  public void showalert(int id, String path) {
    AlertDialog.Builder alert = new AlertDialog.Builder(mcontext);

    alert.setMessage("path to install");

    // Set an EditText view to get user input 
    final EditText input = new EditText(mcontext);

    alert.setPositiveButton("save", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int whichButton) {
        Editor edit = sharedP.edit();
        edit.putString("path"+input.getId(), input.getText().toString());

    alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int whichButton) {
        // Canceled.


Java Source Code List