Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8597437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:54:47+00:00 2026-06-12T00:54:47+00:00

I wrote this code on android to learn whether a .txt file exists or

  • 0

I wrote this code on android to learn whether a .txt file exists or not.

    File file_a =new File("a.txt");

 InputStream in3 = getResources().openRawResource(R.raw.b);
         FileOutputStream out3 = null;


        try {   out3=openFileOutput("a.txt",Context.MODE_WORLD_WRITEABLE);
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } 
         byte[] buff3 = new byte[1024];
         int read3 = 0; 

         try {
            while ((read3 = in3.read(buff3)) > 0) {
               out3.write(buff3, 0, read3);
            }
         } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace(); 
        } finally {
              try {
                in3.close();
                out3.close();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

         }

    boolean a=file_a.exists();

It always returns false.

How can I fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T00:54:48+00:00Added an answer on June 12, 2026 at 12:54 am

    I found solution.I tried the read file if its get the catch block it is not exist. thanks everyone.

    try {
            FileInputStream deneme=openFileInput("a.txt");
        } catch (FileNotFoundException e1) {
            // TODO Auto-generated catch block
             kopyala();
            e1.printStackTrace();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im new to ruby, wrote this code and works but i know is not
I am new to android programming. Just wrote this code to convert kg's to
I wrote this code: ScheduledExecutorService ExtractorTimer=Executors.newScheduledThreadPool(1); final ScheduledFuture<?> SchedulerHandle; SchedulerHandle =ExtractorTimer.scheduleWithFixedDelay( new Runnable() {
For get device id in android sdk i wrote simple This code :: import
In android to display file contains i wrote following code BufferedReader myReader = null;
I wrote this XML code; <TableLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:layout_weight=20 > <TableRow android:layout_height=fill_parent android:layout_weight=10
I wrote this code to try threads on Android, but it doesn't work. @Override
I am learning android so I wrote this code just to toggle phone ringer
I just started to learn Android and I wrote the following code followed a
I wrote a code using this tutorial http://marakana.com/forums/android/examples/311.html It is working fine except the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.