Posts

Showing posts with the label Action

Ansible - Print Message - Debug: Msg="line1 \n {{ Var2 }} \n Line3 With Var3 = {{ Var3 }}"

Answer : debug module support array, so you can do like this: debug: msg: - "First line" - "Second line" The output: ok: [node1] => { "msg": [ "First line", "Second line" ] } Or you can use the method from this answer: In YAML, how do I break a string over multiple lines? The most convenient way I found to print multi-line text with debug is: - name: Print several lines of text vars: msg: | This is the first line. This is the second line with a variable like {{ inventory_hostname }}. And here could be more... debug: msg: "{{ msg.split('\n') }}" It splits the message up into an array and debug prints each line as a string. The output is: ok: [example.com] => { "msg": [ "This is the first line.", "This is the second line with a variable like example.com", "And...

Android Pick Images From Gallery

Answer : Absolutely. Try this: Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE); Don't forget also to create the constant PICK_IMAGE , so you can recognize when the user comes back from the image gallery Activity: public static final int PICK_IMAGE = 1; @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PICK_IMAGE) { //TODO: action } } That's how I call the image gallery. Put it in and see if it works for you. EDIT: This brings up the Documents app. To allow the user to also use any gallery apps they might have installed: Intent getIntent = new Intent(Intent.ACTION_GET_CONTENT); getIntent.setType("image/*"); Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT...