Skip to main content

File path to Uri convert android or Uri to file

Convert file path to Uri


File externalFile = new File(Environment.getExternalStorageDirectory(),"image.png");
Uri external = Uri.fromFile(externalFile);




Uri to file convert.


File f = new File(uri.toString());

Comments

  1. I love you man :D hahah spent whole day in it !!

    ReplyDelete
  2. "Master interactive dashboards and analytics through structured tableau software learning and hands-on practice."

    ReplyDelete
  3. Nice explanation of mobile apps.iOS development requires Swift skills.Practice improves learning.This iOS app development course focuses on real applications.

    ReplyDelete
  4. "Enhance your data skills with power bi training online classes, designed for beginners and professionals alike. Learn to create interactive dashboards, analyze data, and make informed business decisions from anywhere."

    ReplyDelete
  5. "Enroll in the salesforce administrator course online to master CRM management and automation tools. Learn at your own pace and gain skills to advance your career in Salesforce administration."

    ReplyDelete
  6. "Learn from experts with our salesforce developer classes designed to teach hands-on skills for building and customizing Salesforce applications."

    ReplyDelete

Post a Comment

Popular posts from this blog

ProgressDialog example using handler android

final ProgressDialog dialog = ProgressDialog . show ( this , "Title" , "Message" , true ); final Handler handler = new Handler () { public void handleMessage ( Message msg ) { dialog . dismiss (); } } ; Thread t = new Thread () { public void run () { // write process code here. handler . sendEmptyMessage ( 0 ); } } ; t . start ();

How to set image button click effect ?

I have one simple solution: using that, you can set the default press effect to the button. // Create button and add event Button addImageView = (Button) bottomView.findViewById(R.id. addImage ); addImageView.setOnClickListener( new OnClickListener () { @Override public void onClick(View v) { // click event } }); //Using this code set touch listener addImageView.setOnTouchListener( touchEffect ); //touch listner OnTouchListener touchEffect = new OnTouchListener() {         public boolean onTouch(View v, MotionEvent event) {             switch (event.getAction()) {                 case MotionEvent. ACTION_DOWN : {                     v.getBackground().setColorFilter(0xe0f47521,PorterDuff.Mode. SRC_ATOP );                     v....

Store array of String or int or list in SharedPreferences android

 SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences( this );         JSONArray arr = new JSONArray ();         arr.put( "Viren" );         arr.put( "Android" );         prefs.edit().putString( "key" , arr.toString());         prefs.edit().commit();         try {             arr = new JSONArray (prefs.getString( "key" , "{}" ));             System. out .println(arr.getString(1));          } catch ( JSONException e) {             e.printStackTrace();         }