ArrayList <ClipData.Item> dataList = new ArrayList<ClipData.Item>();
How can I add Image data in dataLIst?
Please Clarify, Why would you want to do such a thing and what is the source of the data? Network Download or Just a local asset/image or resources for initialization process of the application?
A good scenario would be really helpful.
Thanks
In drawable right click an select New>Image assert(or vector assert if you want to add icon) and select your image . Choese a name and next and finish.
easy way:
Copy your images from your file manager and simply right click and paste it in drawable folder.
You can rename it with refactor > rename
Related
I would like to create a button that when clicked will go to a class that displays all media files from an SD card using a ListView.
After selecting from the list it will then return the filename selected to the main class. IF the returned file is an image file, it will be displayed in an ImageView and if the returned file is an audio file, it'll display and on click play?
You may find it interesting to use a library to consult the files in a directory and display it. This can save you lots of work if the requirements of your application permits. There are a lot of libraries for this pourpose, for example:
https://github.com/bartwell/ExFilePicker
Hope it helps you!!
I am doing the tutorial for making your first android app and it is saying I need to open the activity_main.xml file in the layout folder.
However, when I open the the layout folder it doesn't have anything in it. There are no files at all.
This is the first bit of programming I am doing. please give me an answer.
Your layout xml files are located in src/main/res/layout/. If they do not show up, you can check the file directory where the project is saved on your computer. If they still do not show up I suggest restarting eclipse and then rebuild/clean. If the problem persists you may need to create a new project
If your files are in the disk folder, but aren't showing in Eclipse, then you'll want to refresh the project contents. You can do that by clicking on your project in either the Project or Package window and pressing F5 (or by right-clicking and selecting the Refresh item.)
It is possible that you didn't create the activity when you created the project and that's the reason you don't see the layout in your When you created the project:
Please follow these steps:
1) Enter your application name in the wizard.
2) Enter Project Name
3) Enter package name.
4) Check mark on 3 items when you clck next "Create custom launcher icon", "Create activity", "Create project in workspace"
5) Again when you click next, Check mark on Create Activity and do next.
6) Make sure that the next screen has all the fields populated. Like (Activity name, Layout name)
7) After all that, click finish.
You must have missed all these steps while creating your project. Try this.
Make sure that the the Activity Name and Layout name are not completely different
I am developing an application which creates menu with each menu item having its own icon. I have too many PNG files for each menu item. In future i will be updating menu items from WebService which will add to these png files.
What is the most efficient way to store this data(png files). I don't want to keep it in drawable folder as I can't update contents of drawable folder after i have shipped my app. If i am storing it on External Memory, How do i achieve that? Where exactly should i copy these png files and use them as resources in my code.
Thanks
Store them as BLOBs in sqLite.
You can write to private space assigned to your app using this http://developer.android.com/reference/android/content/Context.html#openFileOutput(java.lang.String, int) method and read back with it's sibling.
InputStream is = your input stream
OutputStream os = mContext.openFileOutput("image.png",Context.MODE_PRIVATE);
Utils.copyStream(is,os); //Your own steam copy here
is.close;
os.close;
hi i want make simple file explorer which can display all folder of sdcard using listview and only display image file using gridview.i do all of this thing very well.Display in screen shot.but after this i handle the all folder structure of sdcard.also revers process will be handle successfully.but problem is there
when i click on the system folder like .android_secure ,secure ,asec then display Null pointer Exception.but i handle this if folder is empty then display Message folder is empty.
so what i can do now?how to handle this problem.
first i want hide this folder means does not display in listview. but can`t success.
please give me the way.
First Error Image
Now I add Next Point in this that i want to delete specific folder.so i use file.delete() but if the folder is not empty then what to do?
i also want delete this folder with all contain it`s possible with android2.2?
If you use File,
try
File file;
if(file.isfolder && file.list[] != null && file.isreadable()){ // check read,write access
imageView.setVisible(Visible)
}else{
// hide your list item data
}
or first check adapter data and then put it into adapter.
File files
// ... check files
Adapter adapter = new Adapter(files)
setListAdapter(adapter)
i want to show the details of the file or folder after selecting that.
eg.Long press on a file say "icon.jpg" and we have some info like size,type,dateTime Modified,last opened,
hidden or not,permissions etc.
please help me by some example.
Jokes apart. You need to create your own file browser. Also read about creating context menus