Mar 31, 2012

Post Image to GMail or Facebook or any other

/* Return Drawable Object from Specified imageUrl In Web

@imageUrl : image Url in Web


try {
/// Getting image from Web
InputStream is = (InputStream) new URL(imageUrl).getContent();
// storing image from stream
drawable = Drawable.createFromStream(is, "srcName");
// converting drawable object to Bitmap to store in content providers of Media
Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
// Store image in Devise database to send image to mail
String path = Images.Media.insertImage(getContentResolver(), bitmap,"title", null);
Uri screenshotUri = Uri.parse(path);
final Intent emailIntent1 = new Intent( android.content.Intent.ACTION_SEND);
emailIntent1.putExtra(Intent.EXTRA_STREAM, screenshotUri);
startActivity(Intent.createChooser(emailIntent1, "Send email using"));

catch(Exception e) { }

Mar 2, 2012

How to install apk files on Android Emulator

   If you are new to Android and looking for a way to test some of the currently available Android applications, here is how to proceed :
First get the Android SDK and unzip it somewhere on your hard drive
Add SDK_ROOT to your system variables pointing to /tools folder under the sdk
Run the emulator
Copy the apk file to /platform-tools folder
Change directory to /platform-tools and run from commandline $adb install your_application.apk
Now check applications list in the emulator and you should see the new application installed and ready.
Some pointed me to the error message when running adb on windows : * deamon still not running * error: no device.
In this case try to shutdown adb server and start it manually using :
$adb kill-server
$adb start-server
You can test if deamon is working by running $adb shell
The uninstall procedure is
$adb shell rm your_application.apk

: In Linux

=> First we should put the .apk file in androidsdk==>platform-tools

=>run the terminal and type (key board shortcut alt+crtl+t)[path of android platform tools]

2../adb devices

3../adb install filename.apk

now we can see the result in emulator: