1

I'm making an Android app that is web base social media sites all in one and I am having trouble with Twitter and Google plus won't allow me to upload a photo, it will let me choose one but will not let me upload it.

Facebook is fine that will let me choose a photo and upload it without errors.

Here is the code I'm using, maybe something I'm doing is wrong.

@SuppressWarnings("unused")
                    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/*"); 
                       hello.mUploadMessage = uploadMsg;
                       getActivity().startActivityForResult( Intent.createChooser( i, "File Chooser" ), 1 ); } 

MainActivity

ValueCallback<Uri> mUploadMessage;  
     private final static int FILECHOOSER_RESULTCODE=1;
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {


         if(requestCode==FILECHOOSER_RESULTCODE)  
          {  
           if (null == mUploadMessage) return;  
                    Uri result = intent == null || resultCode != RESULT_OK ? null  
                            : intent.getData();  
                    mUploadMessage.onReceiveValue(result);  
                    mUploadMessage = null;  

          }  
         } 

I'm using Eclipse and testing it on Android 4.4.4 and 4.3, can anyone give me an idea? hope it something basic and an easy fix.

Max J
  • 11
  • 2

0 Answers0