android how to crop using an existent image - android

I need to crop an image using selectors and dragging etc.
I cannot use com.android.camera.action.CROP cause in many phones i tested doesn't work.
I searched here all examples, the only working is that where is used android.provider.MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI
but the problem is that everytime it asks user to choice the image.
Can someone post me kindly an example.
I need to open it on the image i need, without that the user has to open an image, searching in file system.
I am enough disappointed cause android doestn offer something compatible for all devices from 2.1 android till 4 at least...
Thanks

Download Sample:- https://github.com/lorensiuswlt/AndroidImageCrop
Only three changes required for android 2.1:-
In main.xml, write wrap_content instead of matchparent.
In AndroidManifest.xml, <uses-sdk android:minSdkVersion="7" />
In default.properties, target=android-7
A project is a best tutor.

Related

Standardized image sizes on android

So I'm trying to build a basic app on Android Studio 1.4.0. Yes, I know it's old, but being pretty new to app-building and having found a tutorial I thought I'd go with it.
My question: I put an image into "#drawable." How do I make sure it resizes when I select different emulators? Should I use "#mipmap?" If so, how exactly would I do that? I have different sizes for my image (xxhdpi, etc.) but I don't know how to make it so the emulator "automatically selects" the correct image size.
For adding a resource to your Project use this plugin
https://plugins.jetbrains.com/plugin/7658-android-drawable-importer
You add your img on one size example xxxhdpi and it automatically make all the resizes, then you only set #drawable/yourimage in the ImageView for example and it selects automatically the image needed for that size
And also I highly recomend you to use at least android studio 2.7+, when you decide to actualize after tutorial you'll encounter a lot of differences and too many methods deprecated

Android Maps V2 keeps crashing

First I want to reference my "research". I'm new to the Android environment, not to Java, but I could say I've sometimes failed to understand the concepts that lead to logical errors. It's been my experience that I usually don't have to think too much about setup, diving right into code. It's also been one one of the things that have held me back.
This to say that the error I'm experiencing now may be because of a fundamental misunderstanding of the compiling-linking mechanism on Java or on Android specifically. I want to change that.
Primarily this question is for an explanation on this subject, concentrating on learning enough to update this text so that I can give an apt explanation of what's really going on and why I was stuck with this problem for so long.
Specifically, I'm using the demo app to test on my device, having the app go "Unfortunately, has stopped". I've followed each step outlined here with repetition and variance in each case following previous answer, especially this answer, which seems to describe a very similar scenario to mine.
I could use a quick fix, but this answer I think deserves a better explanation. Solutions associated with this question seem to depend on what exactly the user has in his environment/the order with which libraries are compiled/the folders within which these libraries are placed. So if anyone has a deeper understanding of what exactly is going on here I would certainly appreciate the visualization.
I can share my own code files (which are copies of the my_location_demo) but I have no logcat as I'm exporting to dropbox to test on my own device.
UPDATE
Does anyone know if I need to declare my library resources in my manifest file? Here it says to declare all external library activity. My current manifest file includes the following:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCvGBr5in13NK2yYBR7lhXTtnxj3mrXQy4"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
I am looking into the logcat suggestions, although I do not have a rooted device, nor one running <=4.1 But I had this running a while back, this cannot be so difficult.
UPDATE 2
Right now I got the demo app functioning, this is what I did:
1.Created new workspace.
2.Imported Google Play Services lib (Copy into workspace because i have 2 Drives, this only works when both files are in the same drive)
3.I noticed that androi v4 support library was already added.
4.Changed API key accordingly on manifest (which already had all necesary permissions).
Since this was the demo app it already has some setting i cannot decipher. I obviously want to apply this to my own app.
I tried reproducing the same procedure and i noticed the file icon (to the left of the name in the file explorer on eclipse) was missing a symbol for Library, in contrast to my previously succesful demo project.
I referenced that through "Add JAR" in the Java build path libraries tab.
With these options my app gets to a loading map, but crashes before it shows anything.
I referenced the google play through "Add External JAR" in the java build path libraries tab as well, and I didn't get to the map, which takes me "further" away, so I removed it and got the map to 'almost' load again, at least.
UPDATE 3
In the next Image I'd like to point out the only difference I can still find while comparing the demo app (working) with two versions of my app. The bottom red rectangle highlights what I mean about the working project having an android-support-v4.jar with a library icon on its left. The next red highlight box shows one of the project instances I have, where the file is shown to not have the same library icon on its left. The last two red boxes from bottom up highlight how I tried to convert that file into a library, the top red box being a new 'file' that appeared when I made the reference to the library.
The one that 'seems' to work (gets to map controls, but shows no map and crashes) is the top instance.
UPDATE 4
I added this line GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()); to my onCreate as suggested here. Which resulted in getting to actually load a MAP (omg im so close) with controls. GPS icon on the top system tray is flashing (acquiring location) and a colorful map appears on the grid, but it still crashes after 5-7 seconds.
UPDATE 5
It's possible that I may have acomplished something, but I think i just lost my time. I added a TextView that was present in the initial tutorial (i didn't need it) to the code and now everything is working (almost fine). I'm guessing I haven't read enough of Layouts to understand how much that needs to be set up.I still have some bugs but at least i can see the map and it's pinging my location.
Again,
Many thanks.

minSdkVersion breaking program

So whenever I add
<uses-sdk android:minSdkVersion = "7"></uses-sdk>
my application refuses to work properly. The UI is miniature (the font is small and the buttons are smaller than usual). I tried changing the minversion from 7-15 and none of them worked. My phone is on 4.0.4 and whenever I take out
<uses-sdk android:minSdkVersion>
it works perfectly. Sadly google market requires this, and I can't upload the application not working. Any ideas? If I need to give more information just ask, thank you so much!
The application is mainly an XML app, such that there is no graphical interface, just native buttons, and such. I am using the Theme.Holo.Light theme though. Thank you!
The easy fix is likely to set minSdkVersion to 1; this should give you the same behavior as leaving it out, but allow you to upload your app to the Play store.
The better solution would be to set it to an appropriate value based on what APIs you use and testing it on various devices, and adjust your layouts to work appropriately.

Where is the drawable for the handle of a SlidingDrawer defined?

I want to use a SlidingDrawer in an activity, and I would love to just use the built-in tray handle, rather than try to find or create my own. I found it online thanks to CommonsWare but I assume that they got it from the Android platform itself, so I figure it will benefit me in the long run to know where to find it, rather than just use their copy of it. I looked for it in my Android SDK installation, under platforms/android-8/android.jar/res/ but with no success.
Where can I find the above image, in the Android SDK itself, rather than just downloading it?
Look in the launcher app: ~\platform\packages\apps\Launcher\res\drawable\handle.xml
It uses all the drawables: tray_handle_normal, tray_handle_pressed, tray_handle_selected.
may be you can type android.R.drawable... in eclipse and let the intelli-sense display all the built in drawables.
but I think it's not there cause I searched for it and didn't find it too
thanks
Be carefull with using images that come with the system. Google itself states that they will not guarantee that these images will be included in the system in every release (the name may change). Also the design of your app will change if the user uses something like Blur or Sense that overrides a lot of the standard design items. If you use a copy of the drawable itself you now how your app will look and you can be sure that your app will keep working even if the manufacturer or Google changes the images that come with a device.

Is this a built in drawable?

In this linked image , I see the button on the right quite often in a lot of apps. On my Moto Droid, it is used extensively in the settings app. It is also used as the default AlertDialog icon. Can I use this via a android.r.drawable?
The icon is built-in with the Android development, you can access the image by using R.drawable.ic_dialog_menu_generic
While it may be possible to use it via android.R.drawable, you may want to find the image in the resources that come with your SDK ($ANDROID_HOME/platforms/$VERSION/data/res, where $ANDROID_HOME is where you have the SDK installed and $VERSION is a relevant Android API level). So, per Mr. Forloney's answer, you'll find that in, say, drawable-hdpi/ic_dialog_menu_generic.png in the aforementioned directory. Then, copy that image into your project. While it will add 5K to your project size, it will mean that the icon does not change based upon OEM or Android changes.

Categories

Resources