Please help!


Last Updated:

  1. c0dered22

    c0dered22 Member

    I am creating an android apps for our research project and we are having a problem in creating a core function of creating new xml file when the user chooses "new project".
    Is this function is possible?

    Advertisement
  2. zimlokks

    zimlokks Well-Known Member

    what software are yu using to build your application?
    c0dered22 likes this.
  3. c0dered22

    c0dered22 Member

    I am using Eclipse Juno now.
  4. zimlokks

    zimlokks Well-Known Member

    i cant help there, someone else will have to come around and help sorry.
  5. shredcode

    shredcode Active Member

    When you are within eclipse, you are attempting to create a new android project and you are receiving an error?

    What is the error you are seeing in the console, or in a dialog box?
  6. out of ideas

    out of ideas Well-Known Member

    go to new >android XML File, not new> project.
  7. c0dered22

    c0dered22 Member

    um I mean is when the user clicks the new project on our application a core function activates that create new xml file.
  8. out of ideas

    out of ideas Well-Known Member

    youre being way too vague.

    so on the phone an end user would click a button and make an xml file?

    why not have a premade xml and fill it with the data you need in there?

    again you'd have to explain a lot better cuz this is just stabs in the dark.
  9. c0dered22

    c0dered22 Member

    Oh sorry for that.

    Okay I will explain it.

    Our apps is called "VN MAKER".

    A development apps that let the user create a Visual Novel.

    The thing is we don't know what to do in creating new project and we are thinking

    of creating new xml file as a body of the "New Project" I am talking.

    And then when the user chooses the "New Project" a new XML file will be created as

    the body of the "New Project" of "VN Maker"

    And my problem is, I don't have an idea how can I put it in codes or s it really possible to creat that function.
  10. out of ideas

    out of ideas Well-Known Member

    So like they could write their own novel thing? like taking a new note?

    If it's something like that, then just put a blank xml page in the app, with an EditText box they can type in. that way, when they pick new project, it will open up a blank page they can add to as they see fit.
    c0dered22 likes this.
  11. c0dered22

    c0dered22 Member

    thanks for the idea, but can I have another question.

    Is there any function that a user can add Image by just clicking a button?

    It's like you can browse a certain database folder and then chose image from that database and add it on the project.
  12. out of ideas

    out of ideas Well-Known Member

    Yup. I'll give ya some code for a head start

    Code (Text):
    1.  
    2.  else if (item.getTitle().toString().equalsIgnoreCase("Pick an image")) {
    3.             Intent i = new Intent(Intent.ACTION_PICK,
    4.                     android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
    5.      
    6.                 startActivityForResult(i, IMAGE);
    7.             Toast.makeText(this, "your Screenshots are here", Toast.LENGTH_LONG).show();
    8.                     }
    9.         return true;
    10.        
    11.     }
    12.     @Override
    13.     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    14.       super.onActivityResult(requestCode, resultCode, data);
    15.  
    16.       if(resultCode==RESULT_OK && requestCode==IMAGE){
    17.        Uri selectedImage=data.getData();
    18.        String path=getPath(selectedImage);
    19.  
    20.        Bitmap bitmapImage=BitmapFactory.decodeFile(path);
    21. //this part puts it on a imageview
    22.        ImageView image=(ImageView)findViewById(R.id.image);
    23.        image.setImageBitmap(bitmapImage);
    24.  
    25.       }
    26.     }
    27.  
    28.     public String getPath(Uri uri){
    29.       String[] filePathColumn={MediaStore.Images.Media.DATA};
    30.  
    31.       Cursor cursor=getContentResolver().query(uri, filePathColumn, null, null, null);
    32.       cursor.moveToFirst();
    33.       int columnIndex=cursor.getColumnIndex(filePathColumn[0]);
    34.  
    35.       return cursor.getString(columnIndex);
    36.     }
    I use that to let people use their gallery to pick an image off their sdcard and set it to an imageview.

    play around with it a little and you can get them them to pull it out of a drawable folder.

    you got lucky I had Eclipse open ;)
    c0dered22 likes this.
  13. c0dered22

    c0dered22 Member

    Oh, thanks this really help us.
  14. c0dered22

    c0dered22 Member

    I have another question.
    How can I add music.
    for example.
    If the button is pressed it can add music in the file. like on the earlier question that is about image.

Share This Page