SlideShare a Scribd company logo
1 of 3
Download to read offline
Android Studio App that lets you upload pictures to the app.
Hello, can someone who is familiar with Android Studio help me create a code (in Java) that is
an app page that lets the user upload any picture from the gallery, etc. and saves it into the app
after its uploaded? Please send all the code (.JAVA .XML etc.) as I need to test run it on my
Android Studio as well to make sure it works.
Solution
Step 1: Create Basic Android Project in Eclipse
Create a Hello World Android project in Eclipse. Go to New > Project > Android Project. Give
the project name as ImageGalleryDemo.
Step 2: Change the Layout:
Step 3: Android Java Code to trigger Image Gallery Intent:
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class ImageGalleryDemoActivity extends Activity {
private static int RESULT_LOAD_IMAGE = 1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button buttonLoadImage = (Button) findViewById(R.id.buttonLoadPicture);
buttonLoadImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
Intent i = new Intent(
Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, RESULT_LOAD_IMAGE);
}
});
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null
!= data) {
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
ImageView imageView = (ImageView) findViewById(R.id.imgView);
imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath));
}
}
}

More Related Content

Similar to Android Studio App that lets you upload pictures to the app.Hello,.pdf

Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studioParinita03
 
Langkah-langkah Instalasi software untuk develop aplikasi android
Langkah-langkah Instalasi software untuk develop aplikasi androidLangkah-langkah Instalasi software untuk develop aplikasi android
Langkah-langkah Instalasi software untuk develop aplikasi androidAgus Haryanto
 
Final NEWS.pdf
Final NEWS.pdfFinal NEWS.pdf
Final NEWS.pdfRebaMaheen
 
Final NewsApp.pdf
Final NewsApp.pdfFinal NewsApp.pdf
Final NewsApp.pdfRebaMaheen
 
Android OS & SDK - Getting Started
Android OS & SDK - Getting StartedAndroid OS & SDK - Getting Started
Android OS & SDK - Getting StartedHemant Chhapoliya
 
AN IDE FOR ANDROID MOBILE PHONES WITH EXTENDED FUNCTIONALITIES USING BEST DEV...
AN IDE FOR ANDROID MOBILE PHONES WITH EXTENDED FUNCTIONALITIES USING BEST DEV...AN IDE FOR ANDROID MOBILE PHONES WITH EXTENDED FUNCTIONALITIES USING BEST DEV...
AN IDE FOR ANDROID MOBILE PHONES WITH EXTENDED FUNCTIONALITIES USING BEST DEV...IJCNCJournal
 
Module-I_Introduction-to-Android.pptx
Module-I_Introduction-to-Android.pptxModule-I_Introduction-to-Android.pptx
Module-I_Introduction-to-Android.pptxlancelotlaytan1996
 
androidstudio.pptx
androidstudio.pptxandroidstudio.pptx
androidstudio.pptxSundaresanB5
 
Introduction to Android and Java.pptx
Introduction to Android and Java.pptxIntroduction to Android and Java.pptx
Introduction to Android and Java.pptxGandhiMathy6
 
Building a Native Camera Access Library - Part II - Transcript.pdf
Building a Native Camera Access Library - Part II - Transcript.pdfBuilding a Native Camera Access Library - Part II - Transcript.pdf
Building a Native Camera Access Library - Part II - Transcript.pdfShaiAlmog1
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesAhsanul Karim
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesAhsanul Karim
 

Similar to Android Studio App that lets you upload pictures to the app.Hello,.pdf (20)

Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studio
 
Langkah-langkah Instalasi software untuk develop aplikasi android
Langkah-langkah Instalasi software untuk develop aplikasi androidLangkah-langkah Instalasi software untuk develop aplikasi android
Langkah-langkah Instalasi software untuk develop aplikasi android
 
Final NEWS.pdf
Final NEWS.pdfFinal NEWS.pdf
Final NEWS.pdf
 
Final NewsApp.pdf
Final NewsApp.pdfFinal NewsApp.pdf
Final NewsApp.pdf
 
Android OS & SDK - Getting Started
Android OS & SDK - Getting StartedAndroid OS & SDK - Getting Started
Android OS & SDK - Getting Started
 
Android - Getting started with Android
Android - Getting started with Android Android - Getting started with Android
Android - Getting started with Android
 
AN IDE FOR ANDROID MOBILE PHONES WITH EXTENDED FUNCTIONALITIES USING BEST DEV...
AN IDE FOR ANDROID MOBILE PHONES WITH EXTENDED FUNCTIONALITIES USING BEST DEV...AN IDE FOR ANDROID MOBILE PHONES WITH EXTENDED FUNCTIONALITIES USING BEST DEV...
AN IDE FOR ANDROID MOBILE PHONES WITH EXTENDED FUNCTIONALITIES USING BEST DEV...
 
Module-I_Introduction-to-Android.pptx
Module-I_Introduction-to-Android.pptxModule-I_Introduction-to-Android.pptx
Module-I_Introduction-to-Android.pptx
 
androidstudio.pptx
androidstudio.pptxandroidstudio.pptx
androidstudio.pptx
 
Android programming-basics
Android programming-basicsAndroid programming-basics
Android programming-basics
 
Introduction to Android and Java.pptx
Introduction to Android and Java.pptxIntroduction to Android and Java.pptx
Introduction to Android and Java.pptx
 
Build Your First Android App
Build Your First Android AppBuild Your First Android App
Build Your First Android App
 
Android wear notes
Android wear notesAndroid wear notes
Android wear notes
 
Android wear notes
Android wear notesAndroid wear notes
Android wear notes
 
Drupoid
DrupoidDrupoid
Drupoid
 
Building a Native Camera Access Library - Part II - Transcript.pdf
Building a Native Camera Access Library - Part II - Transcript.pdfBuilding a Native Camera Access Library - Part II - Transcript.pdf
Building a Native Camera Access Library - Part II - Transcript.pdf
 
Android class provider in mumbai
Android class provider in mumbaiAndroid class provider in mumbai
Android class provider in mumbai
 
Android course (lecture2)
Android course (lecture2)Android course (lecture2)
Android course (lecture2)
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 

More from feelingcomputors

Identify sources and effects of power on organizational structures a.pdf
Identify sources and effects of power on organizational structures a.pdfIdentify sources and effects of power on organizational structures a.pdf
Identify sources and effects of power on organizational structures a.pdffeelingcomputors
 
I have .5ml of a stock 3.0ppm F- solution that Im adding to 2.5 ml.pdf
I have .5ml of a stock 3.0ppm F- solution that Im adding to 2.5 ml.pdfI have .5ml of a stock 3.0ppm F- solution that Im adding to 2.5 ml.pdf
I have .5ml of a stock 3.0ppm F- solution that Im adding to 2.5 ml.pdffeelingcomputors
 
How to do the main method for this programBinaryNode.javapublic.pdf
How to do the main method for this programBinaryNode.javapublic.pdfHow to do the main method for this programBinaryNode.javapublic.pdf
How to do the main method for this programBinaryNode.javapublic.pdffeelingcomputors
 
How many lexemes does the following Java code containGive the num.pdf
How many lexemes does the following Java code containGive the num.pdfHow many lexemes does the following Java code containGive the num.pdf
How many lexemes does the following Java code containGive the num.pdffeelingcomputors
 
How many 5-letter words can be formed from the letters S-W-I-N-G .pdf
How many 5-letter words can be formed from the letters S-W-I-N-G .pdfHow many 5-letter words can be formed from the letters S-W-I-N-G .pdf
How many 5-letter words can be formed from the letters S-W-I-N-G .pdffeelingcomputors
 
How can companies and customers become interconnected Recently, the.pdf
How can companies and customers become interconnected Recently, the.pdfHow can companies and customers become interconnected Recently, the.pdf
How can companies and customers become interconnected Recently, the.pdffeelingcomputors
 
H0w to Secured Bluetooth DeviceSolutionAnswerBluetooth is be.pdf
H0w to Secured Bluetooth DeviceSolutionAnswerBluetooth is be.pdfH0w to Secured Bluetooth DeviceSolutionAnswerBluetooth is be.pdf
H0w to Secured Bluetooth DeviceSolutionAnswerBluetooth is be.pdffeelingcomputors
 
Explain the managerial approach to public administration and include.pdf
Explain the managerial approach to public administration and include.pdfExplain the managerial approach to public administration and include.pdf
Explain the managerial approach to public administration and include.pdffeelingcomputors
 
Exercise 12-4 Chipotle Mexican Grill began with a single location in .pdf
Exercise 12-4 Chipotle Mexican Grill began with a single location in .pdfExercise 12-4 Chipotle Mexican Grill began with a single location in .pdf
Exercise 12-4 Chipotle Mexican Grill began with a single location in .pdffeelingcomputors
 
describe two recent scientific research studies and it therapies inv.pdf
describe two recent scientific research studies and it therapies inv.pdfdescribe two recent scientific research studies and it therapies inv.pdf
describe two recent scientific research studies and it therapies inv.pdffeelingcomputors
 
Differentiating Events that Occur Before and After Ovulation In the O.pdf
Differentiating Events that Occur Before and After Ovulation In the O.pdfDifferentiating Events that Occur Before and After Ovulation In the O.pdf
Differentiating Events that Occur Before and After Ovulation In the O.pdffeelingcomputors
 
A man starts walking north at 3 fts from a point P. Five minutes la.pdf
A man starts walking north at 3 fts from a point P. Five minutes la.pdfA man starts walking north at 3 fts from a point P. Five minutes la.pdf
A man starts walking north at 3 fts from a point P. Five minutes la.pdffeelingcomputors
 
11. Briefly describe the function of the following in protein synthe.pdf
11. Briefly describe the function of the following in protein synthe.pdf11. Briefly describe the function of the following in protein synthe.pdf
11. Briefly describe the function of the following in protein synthe.pdffeelingcomputors
 
You save exist1 the first day of the month, exist2 the second day, ex.pdf
You save exist1 the first day of the month, exist2 the second day, ex.pdfYou save exist1 the first day of the month, exist2 the second day, ex.pdf
You save exist1 the first day of the month, exist2 the second day, ex.pdffeelingcomputors
 
Willy owns a small chocolate factory, located close to a river that o.pdf
Willy owns a small chocolate factory, located close to a river that o.pdfWilly owns a small chocolate factory, located close to a river that o.pdf
Willy owns a small chocolate factory, located close to a river that o.pdffeelingcomputors
 
Which of the following are used as cloning vectors Select all that a.pdf
Which of the following are used as cloning vectors Select all that a.pdfWhich of the following are used as cloning vectors Select all that a.pdf
Which of the following are used as cloning vectors Select all that a.pdffeelingcomputors
 
When are bank deposits createdWhen businesses pay wages and salar.pdf
When are bank deposits createdWhen businesses pay wages and salar.pdfWhen are bank deposits createdWhen businesses pay wages and salar.pdf
When are bank deposits createdWhen businesses pay wages and salar.pdffeelingcomputors
 
what historical trends have affected the social resposibilites of bu.pdf
what historical trends have affected the social resposibilites of bu.pdfwhat historical trends have affected the social resposibilites of bu.pdf
what historical trends have affected the social resposibilites of bu.pdffeelingcomputors
 
What are some alternate perspectives that HRM professionals may purs.pdf
What are some alternate perspectives that HRM professionals may purs.pdfWhat are some alternate perspectives that HRM professionals may purs.pdf
What are some alternate perspectives that HRM professionals may purs.pdffeelingcomputors
 
view the media release by Phillip Lowe, the Governor of the RBA and a.pdf
view the media release by Phillip Lowe, the Governor of the RBA and a.pdfview the media release by Phillip Lowe, the Governor of the RBA and a.pdf
view the media release by Phillip Lowe, the Governor of the RBA and a.pdffeelingcomputors
 

More from feelingcomputors (20)

Identify sources and effects of power on organizational structures a.pdf
Identify sources and effects of power on organizational structures a.pdfIdentify sources and effects of power on organizational structures a.pdf
Identify sources and effects of power on organizational structures a.pdf
 
I have .5ml of a stock 3.0ppm F- solution that Im adding to 2.5 ml.pdf
I have .5ml of a stock 3.0ppm F- solution that Im adding to 2.5 ml.pdfI have .5ml of a stock 3.0ppm F- solution that Im adding to 2.5 ml.pdf
I have .5ml of a stock 3.0ppm F- solution that Im adding to 2.5 ml.pdf
 
How to do the main method for this programBinaryNode.javapublic.pdf
How to do the main method for this programBinaryNode.javapublic.pdfHow to do the main method for this programBinaryNode.javapublic.pdf
How to do the main method for this programBinaryNode.javapublic.pdf
 
How many lexemes does the following Java code containGive the num.pdf
How many lexemes does the following Java code containGive the num.pdfHow many lexemes does the following Java code containGive the num.pdf
How many lexemes does the following Java code containGive the num.pdf
 
How many 5-letter words can be formed from the letters S-W-I-N-G .pdf
How many 5-letter words can be formed from the letters S-W-I-N-G .pdfHow many 5-letter words can be formed from the letters S-W-I-N-G .pdf
How many 5-letter words can be formed from the letters S-W-I-N-G .pdf
 
How can companies and customers become interconnected Recently, the.pdf
How can companies and customers become interconnected Recently, the.pdfHow can companies and customers become interconnected Recently, the.pdf
How can companies and customers become interconnected Recently, the.pdf
 
H0w to Secured Bluetooth DeviceSolutionAnswerBluetooth is be.pdf
H0w to Secured Bluetooth DeviceSolutionAnswerBluetooth is be.pdfH0w to Secured Bluetooth DeviceSolutionAnswerBluetooth is be.pdf
H0w to Secured Bluetooth DeviceSolutionAnswerBluetooth is be.pdf
 
Explain the managerial approach to public administration and include.pdf
Explain the managerial approach to public administration and include.pdfExplain the managerial approach to public administration and include.pdf
Explain the managerial approach to public administration and include.pdf
 
Exercise 12-4 Chipotle Mexican Grill began with a single location in .pdf
Exercise 12-4 Chipotle Mexican Grill began with a single location in .pdfExercise 12-4 Chipotle Mexican Grill began with a single location in .pdf
Exercise 12-4 Chipotle Mexican Grill began with a single location in .pdf
 
describe two recent scientific research studies and it therapies inv.pdf
describe two recent scientific research studies and it therapies inv.pdfdescribe two recent scientific research studies and it therapies inv.pdf
describe two recent scientific research studies and it therapies inv.pdf
 
Differentiating Events that Occur Before and After Ovulation In the O.pdf
Differentiating Events that Occur Before and After Ovulation In the O.pdfDifferentiating Events that Occur Before and After Ovulation In the O.pdf
Differentiating Events that Occur Before and After Ovulation In the O.pdf
 
A man starts walking north at 3 fts from a point P. Five minutes la.pdf
A man starts walking north at 3 fts from a point P. Five minutes la.pdfA man starts walking north at 3 fts from a point P. Five minutes la.pdf
A man starts walking north at 3 fts from a point P. Five minutes la.pdf
 
11. Briefly describe the function of the following in protein synthe.pdf
11. Briefly describe the function of the following in protein synthe.pdf11. Briefly describe the function of the following in protein synthe.pdf
11. Briefly describe the function of the following in protein synthe.pdf
 
You save exist1 the first day of the month, exist2 the second day, ex.pdf
You save exist1 the first day of the month, exist2 the second day, ex.pdfYou save exist1 the first day of the month, exist2 the second day, ex.pdf
You save exist1 the first day of the month, exist2 the second day, ex.pdf
 
Willy owns a small chocolate factory, located close to a river that o.pdf
Willy owns a small chocolate factory, located close to a river that o.pdfWilly owns a small chocolate factory, located close to a river that o.pdf
Willy owns a small chocolate factory, located close to a river that o.pdf
 
Which of the following are used as cloning vectors Select all that a.pdf
Which of the following are used as cloning vectors Select all that a.pdfWhich of the following are used as cloning vectors Select all that a.pdf
Which of the following are used as cloning vectors Select all that a.pdf
 
When are bank deposits createdWhen businesses pay wages and salar.pdf
When are bank deposits createdWhen businesses pay wages and salar.pdfWhen are bank deposits createdWhen businesses pay wages and salar.pdf
When are bank deposits createdWhen businesses pay wages and salar.pdf
 
what historical trends have affected the social resposibilites of bu.pdf
what historical trends have affected the social resposibilites of bu.pdfwhat historical trends have affected the social resposibilites of bu.pdf
what historical trends have affected the social resposibilites of bu.pdf
 
What are some alternate perspectives that HRM professionals may purs.pdf
What are some alternate perspectives that HRM professionals may purs.pdfWhat are some alternate perspectives that HRM professionals may purs.pdf
What are some alternate perspectives that HRM professionals may purs.pdf
 
view the media release by Phillip Lowe, the Governor of the RBA and a.pdf
view the media release by Phillip Lowe, the Governor of the RBA and a.pdfview the media release by Phillip Lowe, the Governor of the RBA and a.pdf
view the media release by Phillip Lowe, the Governor of the RBA and a.pdf
 

Recently uploaded

FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfNirmal Dwivedi
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesSHIVANANDaRV
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of PlayPooky Knightsmith
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17Celine George
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningMarc Dusseiller Dusjagr
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 

Recently uploaded (20)

FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Our Environment Class 10 Science Notes pdf
Our Environment Class 10 Science Notes pdfOur Environment Class 10 Science Notes pdf
Our Environment Class 10 Science Notes pdf
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food Additives
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 

Android Studio App that lets you upload pictures to the app.Hello,.pdf

  • 1. Android Studio App that lets you upload pictures to the app. Hello, can someone who is familiar with Android Studio help me create a code (in Java) that is an app page that lets the user upload any picture from the gallery, etc. and saves it into the app after its uploaded? Please send all the code (.JAVA .XML etc.) as I need to test run it on my Android Studio as well to make sure it works. Solution Step 1: Create Basic Android Project in Eclipse Create a Hello World Android project in Eclipse. Go to New > Project > Android Project. Give the project name as ImageGalleryDemo. Step 2: Change the Layout: Step 3: Android Java Code to trigger Image Gallery Intent: import android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.view.View; import android.widget.Button; import android.widget.ImageView; public class ImageGalleryDemoActivity extends Activity { private static int RESULT_LOAD_IMAGE = 1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button buttonLoadImage = (Button) findViewById(R.id.buttonLoadPicture);
  • 2. buttonLoadImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); } }); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); ImageView imageView = (ImageView) findViewById(R.id.imgView); imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath)); }
  • 3. } }