コード例 #1
0
 // flipscreen not loading again
 @Override
 public void onConfigurationChanged(Configuration newConfig) {
   super.onConfigurationChanged(newConfig);
 }
コード例 #2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.profile);
    findViews();
    /*Select Category work */
    final String[] categories = getIntent().getStringArrayExtra("Options");
    ArrayAdapter<String> catadapt;
    catadapt = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, categories);
    mCatSpin.setAdapter(catadapt);
    mCatSpin.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          public void onItemSelected(AdapterView<?> parent, View v, int pos, long id) {
            mChosenCategory = categories[pos];
          }

          public void onNothingSelected(AdapterView<?> parent) {}
        });
    /*Availability selection work*/
    mAvail = (Button) findViewById(R.id.editavail);
    mAvail.setOnClickListener(this);
    /*Submit/Back button work*/
    mSub = (Button) findViewById(R.id.submitbutton);
    mSub.setOnClickListener(this);
    mBack.setOnClickListener(this);
    /*Web View & Camera uploader work*/
    openCam.setOnClickListener(this);
    openWeb.setOnClickListener(this);
    web.getSettings().setJavaScriptEnabled(true);
    web.loadUrl("http://www.monkbananas.com/uploader/index.php");
    // ------Everything below this line was found on StackOverflow--------------------
    web.setWebChromeClient(
        new WebChromeClient() {
          @Override
          public boolean shouldOverrideUrlLoading(WebView v, String url) {
            web.loadUrl(url);
            return true;
          }
          // The undocumented magic method override
          // Eclipse will swear at you if you try to put @Override here
          // For Android 3.0+
          public void openFileChooser(ValueCallback<Uri> uploadMsg) {

            mUploadMessage = uploadMsg;
            Intent i = new Intent(Intent.ACTION_GET_CONTENT);
            i.addCategory(Intent.CATEGORY_OPENABLE);
            i.setType("image/*");
            startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);
          }

          // For Android 3.0+
          public void openFileChooser(ValueCallback uploadMsg, String acceptType) {
            mUploadMessage = uploadMsg;
            Intent i = new Intent(Intent.ACTION_GET_CONTENT);
            i.addCategory(Intent.CATEGORY_OPENABLE);
            i.setType("*/*");
            startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE);
          }

          // For Android 4.1
          public void openFileChooser(
              ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
            mUploadMessage = uploadMsg;
            Intent i = new Intent(Intent.ACTION_GET_CONTENT);
            i.addCategory(Intent.CATEGORY_OPENABLE);
            i.setType("image/*");
            startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE);
          }
        });
  }