Android Open Source - javainstaller Change Path






From Project

Back to project page javainstaller.

License

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.app.AlertDialog;
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;
  }

  @Override
  public void onClick(DialogInterface dialog, int which) {
  }

  @Override
  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);
    input.setId(id);
    input.setText(path);
    alert.setView(input);

    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());
        edit.commit();
        madapt.notifyDataSetChanged();
      }
    });

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

    alert.show();
  }

}




Java Source Code List

gnu.java.lang.management.VMRuntimeMXBeanImpl.java
julianwi.javainstaller.ChangePath.java
julianwi.javainstaller.CheckPoint.java
julianwi.javainstaller.Checkforfile.java
julianwi.javainstaller.ChecklistAdapter.java
julianwi.javainstaller.Download.java
julianwi.javainstaller.Error.java
julianwi.javainstaller.InstallActivity.java
julianwi.javainstaller.InstallList.java
julianwi.javainstaller.MainActivity.java
julianwi.javainstaller.MainList.java
julianwi.javainstaller.PathReceiver.java
julianwi.javainstaller.RunActivity.java
julianwi.javainstaller.SettingsActivity.java
julianwi.javainstaller.Update.java