Pages

Showing posts with label on. Show all posts
Showing posts with label on. Show all posts

Friday, May 13, 2016

Galaxy on Fire 2 Full HD Cracked Valkyrie for ANDROID

DOWNLOAD Galaxy on Fire 2 Full HD Valkyrie for ANDROID

 

 

Klik video diatas untuk melihat trailernya.








Full Cracked Version!

Pastikan anda tersambung dengan internet saat menginstall game ini di Android anda!
Wi-Fi recommended!


Read More..

Monday, May 9, 2016

Intel Running Android on Atom Chips

Hi all
Check this article found on Technorati.

I believe its a step towards the right direction for Android.
Read More..

Cara Mempercepat Booting Ponsel Android

Read More..

Put Android to work Attend the first ever Android for Work Live online conference on November 4th



Editors note: Were launching our first Android for Work Live online event to share how Android is transforming the workplace, expanding the business role of mobile devices and helping companies like Guardian Life Insurance Company achieve more with mobility. The event will take place on Wednesday, Nov 4th at 11 am PDT. Register today.

Mobile devices are essential for navigating our personal lives, from buying movie tickets and guiding us to weekend get togethers to helping us take out a home loan. For consumers, it seems that almost anything can be done now using smartphones and tablets. But in business, these devices have only just begun to change the way we work.

When we launched Android for Work earlier this year, we set out to close this gap, by helping companies use Android’s flexibility and choice to make the most of business mobility. Why? Because we see a world where mobility means so much more than mail, calendar and contacts.

This year, more than 10,000 companies are testing or deploying Android for Work, and Frost & Sullivan recently awarded us the 2015 North America Visionary Innovation Award for Mobile Enterprise Productivity. With Android Marshmallow, we’re taking another step in that journey by building out support for deploying Android devices in a host of scenarios – from dedicated employee use to installing customer-facing hardware that makes interactions more dynamic and responsive.



At Android for Work Live, you’ll:

  • Hear from Andrew Toy, product management director for Android for Work, who’ll discuss the broad vision of Android in the workplace and how businesses can mobilize every worker and workflow.
  • Learn how Android’s vast selection of devices – from affordable phones to locked-down hardware and customized devices – creates choice and agility for BYOD, corporate deployments and single-purpose scenarios.
  • Get an in-depth look at how companies can rely on Android’s built-in multi-layered protections to keep business data secure and managed across all devices in an overview from Adrian Ludwig, technical lead for Android security.
  • Hear insights from Android customers, including Guardian Life Insurance Company.

Register for Android for Work Live today and join the conversation on social media using #AndroidforWorkLive15.
Read More..

Friday, May 6, 2016

Install Android Studio on Ubuntu 15 10 using ubuntu developer tools center


remark:
ubuntu-developer-tools-center is now named Ubuntu Make officially.
Please check the updated "Install Android Studio on 64-bit Ubuntu-GNOME 15.10 with Ubuntu Make".



To install Android Studio on Ubuntu 15.10 using ubuntu-developer-tools-center
- install java (refer "Install Oracle java8 on Ubuntu 15.10 via PPA")
- Enter the command in Terminal:
$ sudo apt-get install ubuntu-developer-tools-center
$ udtc android

This video show installing Android Studio on 64-bit Ubuntu 15.10 (run in VirtualBox) using ubuntu-developer-tools-center.

Read More..

Saturday, April 30, 2016

Setup Hardware Devices debugging for Android Studio on Ubuntu 15 10

This video show how to setup /etc/udev/rules.d/51-android.rules in Ubuntu (behind VirtualBox) to enable hardware device debugging in Android Studio.


The development platform is 64-bit Ubuntu-GNOME 15.10 running in VirtualBox, with Android Studio installed with Ubuntu Make (umake).

To enable hardware device debugging in Ubuntu, you have to create /etc/udev/rules.d/51-android.rules file to add device IDs for your debugging devices. (refer: Android Developers Document Using Hardware Devices - Setting up a Device for Development)

Create /etc/udev/rules.d/51-android.rules file with sudo right, add the line and save:
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
where "18d1" is the USB Vendor ID for Google, Nexus 7 in my case.

Run the command:
$ sudo chmod a+r /etc/udev/rules.d/51-android.rules

This video show how to, behind VirtualBox.

Read More..

Saturday, April 23, 2016

Do you want to write on Android Revolution HD blog

Its time to expand. This place has a potential and I want it to become even more popular. If you are interested in making this place even better and more crowded, please keep reading!

So, what I am looking for?

Strong written English
This is essential. Its fine if English isnt your first language, its not if I have to rewrite all your posts. Your grammar and variety of vocabulary must be at an advanced level.

Good understanding of mobile tech and an attention to detail
Know the areas you want to write about, know the sources and strive for accuracy. Your articles must have some particular level of quality, otherwise it cant be published.

Have an opinion
Re-posting news from other tech-sites is not welcomed. You need to be able to understand what things mean, put it in context and share your thoughts with our readers. Im more interested in creating the opinion rather then passing some news along.

Regular contribution
This isnt a job offer, but this might change in the future. For now I want to create a friendly place where dedicated people can share their thoughts (and there is a lot to share nowadays). I ask that all applicants are able to post on average 1-2 times a week. News posts dont have to be thousands of words, in most cases a couple of hundred will suffice.

Technologies
Im mostly interested in Android / Windows Phone articles, however the variety of potential topics is: "Linux Kernels" | "Linux General" | "Android General" | "Android Devices" | "Windows Devices" | "Other OS Devices" | "Tablets" | "Gadgets" | "Manufacturers News" | "PC News" | "your idea".


There is no age limitation. Everyone can have hobby and be addicted to gadgets :)

How to apply
Please contact us via our Twitter profile: Twitter
Read More..

Thursday, April 21, 2016

Widget ON OFF Full Transparan

Read More..

Friday, April 15, 2016

The Android ION Memory Manager

Lately theres been quite a bit of discussions about Android "ION". What exactly is ION? Is it just some fancy name or is there more to it?

Lets talk about some history of Android first.

Since the very beginning, vendors of Android devices like HTC, Samsung or Motorola all use different System on a Chip (SoC) solutions from Qualcomm (MSM/Snapdragon), Nvidia (Tegra) and TI (OMAP). Each SoC has its own kernel drivers for managing memory buffers (chunks of scratchpad memory) used by Graphic Processing Unit (GPU), Audio processing, and Camera Stills and Video processing.

Every vendor had their own version of memory management, such as PMEM for Qualcomm, NVMAP for Nvidia and CMEM for TI - private memory not shared with anyone else. Each Android graphics, audio and camera libraries had to be customized to work with each of the SoCs own flavour of memory management, which makes it a nightmare for the Android Maintainers to maintain the fragmentation and compatibility issues abound. However, this was the case for all pre-Ice Cream Sandwich OS like Froyo, Gingerbread or even Honeycomb.

For Android 4.0 (aka Ice Cream Sandwich), Google was finally fed up with the private memory manager structure and decreed that all newer devices with Android 4.0 native should use the new, so called "ION" memory manager.

So what is exactly the Android ION?

In a simple words, Android ION removes ARM specific dependencies. The ION memory manager provides a common structure for how memory will be managed and used by GPU, Audio and Camera drivers. Common functions are:

  • memory allocation / de-allocation
  • Direct Memory Access Pools
  • user-space (Android libraries) memory passing to/from kernel space

With these common functions and structures defined, kernel drivers from each SoC manufacturer needed to rewrite their drivers to be compatible with Ice Cream Sandwich. Once the drivers adopted to the new common structure, the graphics, audio and camera libraries can now be more generic and could care less about the nitty-gritty details of how different SoC vendors drivers worked.

It was painful at first, but it was a necessary move for Google to impose to all the SoC vendors. Now looking back, this new ION manager enabled manufactures and third party Android projects (like Cyanogen-mod) to quickly bring up newer Android releases for various devices and also reduce the "hidden" Android fragmentation.

If you want to take a look at the code of the ION memory manager, please visit faux123 github - MSM ION

I hope you enjoyed my first Kernel GeekTalk series... more to come soon!

Have any questions or comments? Feel free to share! Also, if you like this article, please use the media sharing buttons (Twitter, G+, Facebook) under this post!
Read More..

How Twitter used Doze in Android 6 0 Marshmallow to Improve Notification Performance

Posted by Laurence Moroney, Developer Advocate

In October, we published a blog post about how Google Cloud Messaging (GCM) works with Doze in Android 6.0 Marshmallow to bring performance and usability improvements to the user. In this scenario, normal priority messages allow the device to stay in Doze, while high priority messages take the device out of Doze. For a great example of this capability and best practices on Android, we’ve spoken with the engineering team at Twitter.

Twitter has researched extensively which messages should get high priority -- given that this priority can awaken a device in Doze. To meet their particular need, Twitter wanted Direct Messages to be delivered on high priority, where mentions would be at normal priority.

Luke Millar, Android Engineering Manager at Twitter commented "With Android M we have a greater ability to be good citizens when it comes to conserving battery life. This feature lets us specify which notifications will wake up a device in Doze and which ones wont. Normally, we tell GCM to wait to deliver push notifications until the next time the users phone wakes up. However, users expect to receive some push notifications immediately, like notifications for Direct Messages, so we set those as high priority. Its nice being able to specify when and how those notifications make it to our users."

To test Doze, Twitter’s engineers followed the steps outlined on the Android Developers site. These guide you to use adb commands to simulate doze on either a physical or virtual device. Following this method, Twitter was able to successfully test how their messaging priorities would work in a real-world environment.

One other best practice that Twitter used was in transmitting larger payloads, such as when delivering Twitter Highlights. In this case, they opted to pass metadata in the notification, which was then used to sync the application to get the requested Highlights. In other words, they didn’t transmit the contents of Highlights in a notification, instead triggering a sync mechanism to update the contents of the app.

For more details on using GCM with your app in standby environments, check out the documentation.
You can learn more about Google Cloud Messaging and how to use it for notifications in your Android, iOS and Web Applications at the Google Developers site here.

Read More..

Thursday, April 14, 2016

Virtual SD card on Android


Since Android Honeycomb, Google changed the way to manage internal memory on Android devices. Before Honeycomb, every user had one separate partition on his device called userdata (/data), where he could install applications and where all user settings were stored (home screens, applications data, contacts, and all the rest you loose after doing so called "full wipe" on your device). Apart of userdata partition, all Android devices had microSD card slot to save pictures, movies, backups etc.. Now it looks completely different, but lets start from the beginning. There are several approaches to this subject, Ill present here all those I am aware of.


  • userdata partition + microSD card

This is the mentioned above pre-Honeycomb approach. There is userdata partition, where you can install all your applications and you also have a possibility to insert microSD card. Nothing more to explain. Only devices running Android Gingerbread and older versions have such configuration, so its getting less and less popular.


  • userdata partition + virtual SD card on userdata partition

This is the new approach presented for the first time in Honeycomb. Instead of having /data partition together with expandable microSD card slot of any capacity, Google decided for something different. Instead, /data partition became very large (16/32/64 GB) and inside you can find /data/media folder that contains all the files you can see as your SD card content. How does it work? Without too much technical explanations, there is so called fuse tool which emulates media folder inside userdata partition as a separate storage device. As a result, after connecting smartphone to the PC you can browse the content of /data/media location, so if it was a microSD card. The biggest downside of such approach is a high risk of loosing all your virtual SD card content in case of any serious /data partition failure. Also, such partition cant be formatted with mkfs.ext4 without loosing content of virtual SD card, because you cant format device partition just partially. You can use e2fsck tool to check for potential errors, but sometimes partition format is the only way out. How does "full wipe" work then? Well, its a little bit complicated. First of all, you cant format mounted (in use) partition. You need to unmount it first. Once unmounted userdata partition, you cant flash any ZIP file from inside recovery, because ZIPs files are stored on virtual SD card (/data/media) and remember that userdata partition is currently unmounted, because we want to format it. There is a workaround for it - you can run mkfs.ext4 from inside /cache partition or you can use command prompt. Now, what if you need to remove the whole content of your userdata partition, but you want to keep virtual SD card content at the same time? There is a workaround for this as well, but instead of formatting entire partition, you need to remove all files excluding /data/media location. Example:

#!/tmp/bash
# Remove content of /data partition excluding data/media files
cd /data
FILES=(*)
for i in *; do
if [ "$i" != "media" ]
then rm -R "$i"
fi
done


This way you can sort of wipe userdata, but it doesnt format the partition, so you cant fix broken file-system with it.  Why this point is the longest one? Because it took me quite a few words to explain the relation between virtual SD card and media folder on userdata partition (/data/media). So basically, what you read here applies to every configuration with virtual SD card emulated on userdata partition.


  • userdata partition + virtual SD card on a separate partition

This approach is not very popular, and its a shame because it seems to be much more practical rather than the previous one. Instead of emulating SD card from userdata partition, there is a separate, large partition with vFAT file-system. That means you can format your userdata partition anytime you want without loosing content of your virtual SD card, or from inside custom ROM, because userdata can be freely unmounted. The only device Ive seen so far with this approach was HTC One X.


  • userdata partition + virtual SD card on userdata partition + microSD card

This seems to be the most desirable solution for many Android users. It works similar to approach described in the second point, so everything I wrote about /data/media is valid here as well. However, every user have the ability to insert extra microSD card inside his device, so he can easily backup virtual SD card to microSD card or format userdata partition without loosing all pictures etc. (if previously stored on microSD card). This is the most common configuration for Samsung devices. But having removable microSD card is not only an advantage. First of all, any kind of microSD card (even SDHC) will be always slower than internal eMMC memory. It depends on many factors like card speed (class 2, 4, 6, 8 or even 10), on-board controller, I/O scheduler and more. Secondly, microSD card damage risk is higher then damage risk of internal eMMC memory. Out of question is the benefit to expand the memory with 64 GB microSD card, but its definitely the minority of power users, who are buying large capacity cards. For the vast majority of users, internal memory with 32 GB capacity is more then enough to store their favorite music or pictures.


  • userdata partition + virtual SD card on a separate partition + microSD card

This approach is theoretically possible, but personally Ive never seen device with such combination. For me, this is the best combination. You have possibility to use external microSD card and virtual SD card is not a part of userdata partition, but it has its own, separate vFat partition. Such configuration gives you control over all your data and possibility to manage it however you want.

Do you have any questions or want to share some opinion? Please leave a comment below! Also, if you like this article, please use media sharing buttons (Twitter, G+, Facebook) down this post!



Read More..

Friday, April 8, 2016

The Meenova Micro SD Card Reader for Android

A few months back I decided to pledge $12 US to a Kickstarter Project for a miniaturised USB card reader for Android smartphones. The idea looked promising, and I had a spare $12, so I took the gamble, and this week it paid off. Through the post I received the dividend on my investment. Ill follow up this mini-review with some details on performance once I can get hold of a class 10 card, but for now here are some first impressions and opinions.

The concept of USB OTG (on-the-go) storage is a good one, especially for the increasing number of us of us whose favourite phones dont have an SD card slot. However, one of the big issues with the regular arrangement for OTG is the need to carry a male-female adapter cable and a card reader or memory stick around in addition to the telephone. Doing away with this inconvenient clutter was really what attracted me to the idea of the Meenova reader.

I knew that a tiny, almost weightless device, which clips to my keyring, but which can take exchangeable micro SD cards at least up to 64Gb, would be worth $12 to me just for the convenience. The Meenova reader ticks all those boxes at around 2cm square by 8mm thick and weighing in at only 3 grammes.

Unboxing the Meenova


The reader arrived by mail, safe in a protective envelope, direct from the manufacturing facility. US customers receive theirs via USPS, the rest of the world via Hong Kong Post. Inside the envelope the reader was neatly packaged, and the pack included the reader, a USB adapter for lap/desktop connectivity, and a keyring clip.
 


All the items were well made and well finished. The only exception was the tiny split ring for the keyring adapter, which was quite flimsy, but that was such an insignificant part of the package that I just replaced it with a better one for five cents. The cap clips onto the reader with a satisfying and tight click, and the reader is securely held. 

That led me to thinking that instead of hanging the reader from my keyring, I should hang the cap from the ring and clip the reader in/out of it as I used it. I punched a small hole in the cap, threaded the tiny keyring through it, and I am very happy with the modification. 


N.B. - Later Edit 
Do NOT hang the reader on your keyring as I described above. My reader came unclipped twice today and I almost lost it !! Use the tag provided on the body of the reader and pass the spring clip through that. Only use the ring to hang the cap from the clip when the reader is in use.

Getting To Grips with the Meenova


Having got it all ready to use, my next step was to rummage in the spares bin. Luckily I found an old 8Gb class 4 SD card to use for the first test. I slotted it into the reader, plugged the reader into the USB adapter and plugged all that into my trusty iMac.

Partitioning and formatting the card was quick, easy and there were no issues.  A nice touch is that USB connector on the reader is mounted in a raised, transparent, plastic "plinth" and from inside the casing a blue LED flashes to indicate any activity.


The Meenova is actually much smaller than it appears here
My first test was to load up my entire photo library from iPhoto to see what would happen. 2 Gb was a heavy enough load, and during the loading process I also deleted around 400 of the photos from the card during the load to see if that caused any issues. The process took a while, but there was no noticeable slowdown during the deletions and no data dropouts or corruption.

Following the successful upload I unmounted the device and plugged it into the USB port of my HTC One. The One immediately reported "Preparing USB storage, Please Wait" and then "USB storage is ready" which popped up almost too quickly for me to take the screen shots.




ES File Explorer, showed me that the USB was mounted automatically by the OS at the mount point /mnt/usb. On opening, Explorer already had the USB folder open and I was able to examine the contents just as I would any other part of the file system.

The next step in this little test was to open Gallery and look for the photos I uploaded. They had already been found by the Gallery app and the app was in the process of making them available. Once the photos folder had been opened in Gallery, the photos themselves did take some time to appear, but until I can get hold of a faster card I can only speculate on whether this was caused by the cheap, slow card, the reader, or the OTG/USP processing in the phone OS.

Gotcha !!!


After playing with it for a while I was ready to hang the reader back on my keyring and drop my One into its slip case ... That was the only point at which I had an issue with the setup. In my haste, I just pulled the reader out of the USB socket and immediately received the notification "USB Storage unexpectedly removed" ...



Oops ... My Bad ... I had forgotten to unmount before removal!


I was only reading from the card so on this occasion it wasnt a painful experience, but no excuses ... some cards can be very sensitive to superblock corruption so its never a sensible thing to just pull them out without first unmounting, and definitely not advisable following a write to the card.

Just to make sure I knew what to do in future, I reinserted the reader and went in search of the unmount action. I have to admit, I was naively expecting a bar in the notifications or settings pull-down with some obvious wording such as "USB/OTG storage - Click to unmount" ...

No such luck ... I eventually found the action buried in the basement !! ... Its actually in Settings->Storage->USB Storage->Unmount USB Storage.



For the sake of user convenience, I think there is a good case for smartphone manufacturers to do some rethinking about where that action should be placed. In my opinion, it belongs in a much more prominent position.

Third-Party Apps and the Meenova


Because of that one thing, I went in search of an OTG/USB third-party app to see if I could make the unmount a little more convenient. I tried two (see *** footnote) and both worked well. However, both of them were designed to manage the mount and unmount themselves. That is, they are set up to create a mount point and mount to/unmount from that point. When using these apps on the HTC One, the OS native mount is maintained in addition to the ones set up by the tool, so a final unmount will still need to be done from within the settings page.

If you have a phone with an OS which automatically mounts the OTG/USB storage, then dont bother with third-party apps. Just be sure you know how to unmount the device. If, on the other hand your OS doesnt automount the storage, but you have an OTG-aware kernel, then these third party apps can make your use of OTG devices easier.

OTG Compatibility


There is a list of known compatible devices on the Meenova web site, but in this rapidly changing world, the list may not be complete. In hard terms, the device is only a micro card reader, and the chipset is the same one that can be found in many regular readers, so the rule of thumb is that if your phone works with a cable and memory stick, either with native or third-party software, then the chance is good that it will work with a Meenova Reader as well.

On the general subject of OTG compatibility my advice is for you to research your phone carefully before buying anything. Not all versions of Android support OTG and manufacturer support can also very variable, even between model ranges from the same company. Dont just assume that because your phone is fairly new and your Android is 4.x then it will have OTG. Check it out.

Conclusion (for now)


Overall I am already satisfied with my $12 investment, and at this point I feel that I can recommend this device to anyone looking for a compact, handy, OTG/USB storage solution.

In Part Two (coming soon) I will take a closer look at the Meenova readers performance with music and video files, and I will try to run a set of timing comparisons using Class 4 and class 10 Micro SD cards.

Have any questions or comments? Feel free to share! Also, if you like this article, please use media sharing buttons (Twitter, G+, Facebook) below this post!



*** The OTG Storage managers I tested were:

USB Storage Manager by Goprasoft
USB OTG Helper (Root) by Ray of Light

As for Meenova the company, the Kickstart project seems to have been a great success. Plenty of cash was raised to get the project onto a stable footing, and I have yet to read a negative comment about either the Meenova reader or the guys who set it all up. The initial seed stock has now been dispatched to all the original backers, and the company are now taking pre-orders for the next batch of devices.
Read More..

Tuesday, April 5, 2016

Open image free draw something on bitmap and save bitmap to ExternalStorage

Example to load image with intent of Intent.ACTION_PICK, free draw something on the image, and save the bitmap to storage.


I have a series example of "Something about processing images in Android", but have show how to save the result bitmap to SD Card. This example modify from one of the example "Detect touch and free draw on Bitmap", add the function to save the result bitmap to External Storage, with file name "test.jpg".


layout/activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout

android_layout_width="match_parent"
android_layout_height="match_parent"
android_padding="16dp"
android_orientation="vertical"
tools_context="com.blogspot.android_er.androiddrawbitmap.MainActivity">

<TextView
android_layout_width="wrap_content"
android_layout_height="wrap_content"
android_layout_gravity="center_horizontal"
android_autoLink="web"
android_text="http://android-er.blogspot.com/"
android_textStyle="bold" />

<Button
android_id="@+id/loadimage"
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_text="Load Image" />

<Button
android_id="@+id/saveimage"
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_text="Save Image" />

<ImageView
android_id="@+id/result"
android_scaleType="centerInside"
android_adjustViewBounds="true"
android_layout_gravity="center"
android_layout_width="wrap_content"
android_layout_height="wrap_content"
android_background="@android:color/background_dark" />
</LinearLayout>


MainActivity.java
package com.blogspot.android_er.androiddrawbitmap;

import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class MainActivity extends AppCompatActivity {

Button btnLoadImage, btnSaveImage;
ImageView imageResult;

final int RQS_IMAGE1 = 1;

Uri source;
Bitmap bitmapMaster;
Canvas canvasMaster;

int prvX, prvY;

Paint paintDraw;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

btnLoadImage = (Button)findViewById(R.id.loadimage);
btnSaveImage = (Button)findViewById(R.id.saveimage);
imageResult = (ImageView)findViewById(R.id.result);

paintDraw = new Paint();
paintDraw.setStyle(Paint.Style.FILL);
paintDraw.setColor(Color.WHITE);
paintDraw.setStrokeWidth(10);

btnLoadImage.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0) {
Intent intent = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, RQS_IMAGE1);
}
});

btnSaveImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(bitmapMaster != null){
saveBitmap(bitmapMaster);
}
}
});

imageResult.setOnTouchListener(new View.OnTouchListener() {

@Override
public boolean onTouch(View v, MotionEvent event) {

int action = event.getAction();
int x = (int) event.getX();
int y = (int) event.getY();
switch (action) {
case MotionEvent.ACTION_DOWN:
prvX = x;
prvY = y;
drawOnProjectedBitMap((ImageView) v, bitmapMaster, prvX, prvY, x, y);
break;
case MotionEvent.ACTION_MOVE:
drawOnProjectedBitMap((ImageView) v, bitmapMaster, prvX, prvY, x, y);
prvX = x;
prvY = y;
break;
case MotionEvent.ACTION_UP:
drawOnProjectedBitMap((ImageView) v, bitmapMaster, prvX, prvY, x, y);
break;
}
/*
* Return true to indicate that the event have been consumed.
* If auto-generated false, your code can detect ACTION_DOWN only,
* cannot detect ACTION_MOVE and ACTION_UP.
*/
return true;
}
});
}

/*
Project position on ImageView to position on Bitmap draw on it
*/

private void drawOnProjectedBitMap(ImageView iv, Bitmap bm,
float x0, float y0, float x, float y){
if(x<0 || y<0 || x > iv.getWidth() || y > iv.getHeight()){
//outside ImageView
return;
}else{

float ratioWidth = (float)bm.getWidth()/(float)iv.getWidth();
float ratioHeight = (float)bm.getHeight()/(float)iv.getHeight();

canvasMaster.drawLine(
x0 * ratioWidth,
y0 * ratioHeight,
x * ratioWidth,
y * ratioHeight,
paintDraw);
imageResult.invalidate();
}
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

Bitmap tempBitmap;

if(resultCode == RESULT_OK){
switch (requestCode){
case RQS_IMAGE1:
source = data.getData();

try {
//tempBitmap is Immutable bitmap,
//cannot be passed to Canvas constructor
tempBitmap = BitmapFactory.decodeStream(
getContentResolver().openInputStream(source));

Bitmap.Config config;
if(tempBitmap.getConfig() != null){
config = tempBitmap.getConfig();
}else{
config = Bitmap.Config.ARGB_8888;
}

//bitmapMaster is Mutable bitmap
bitmapMaster = Bitmap.createBitmap(
tempBitmap.getWidth(),
tempBitmap.getHeight(),
config);

canvasMaster = new Canvas(bitmapMaster);
canvasMaster.drawBitmap(tempBitmap, 0, 0, null);

imageResult.setImageBitmap(bitmapMaster);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

break;
}
}
}

private void saveBitmap(Bitmap bm){
File file = Environment.getExternalStorageDirectory();
File newFile = new File(file, "test.jpg");

try {
FileOutputStream fileOutputStream = new FileOutputStream(newFile);
bm.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
fileOutputStream.flush();
fileOutputStream.close();
Toast.makeText(MainActivity.this,
"Save Bitmap: " + fileOutputStream.toString(),
Toast.LENGTH_LONG).show();
} catch (FileNotFoundException e) {
e.printStackTrace();
Toast.makeText(MainActivity.this,
"Something wrong: " + e.getMessage(),
Toast.LENGTH_LONG).show();
} catch (IOException e) {
e.printStackTrace();
Toast.makeText(MainActivity.this,
"Something wrong: " + e.getMessage(),
Toast.LENGTH_LONG).show();
}
}
}


"android.permission.WRITE_EXTERNAL_STORAGE" is needed in AndroidManifest.xml. Also I add android_largeHeap="true" to require more heap for the app. But if you have a really big image, it still will closed, caused by Out Of Memory!
<?xml version="1.0" encoding="utf-8"?>
<manifest
package="com.blogspot.android_er.androiddrawbitmap">

<uses-permission android_name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android_largeHeap="true"
android_allowBackup="true"
android_icon="@mipmap/ic_launcher"
android_label="@string/app_name"
android_supportsRtl="true"
android_theme="@style/AppTheme">
<activity android_name=".MainActivity">
<intent-filter>
<action android_name="android.intent.action.MAIN" />

<category android_name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>


download filesDownload the files (Android Studio Format) .

more: Something about processing images in Android

Read More..

Saturday, April 2, 2016

Android emulator too large

sometimes after installing Android sdk and launching the emulator you find that the emulator is too large that some of it may be invisible.

to correct this do the following:
  1. from  eclipse go to Run->Run configurations.
  2. from the left pane choose your project name and from the right pane choose the target tab.
  3. you will see a list of available virtual devices. choose yours and youll find below the Additional Emulator Options section.
  4. enter the following command  -scale 0.7, where 0.7 is the ratio between the emulator size and your screen size.
  5. run the project and the emularot size will be adjusted to your screen
Read More..

Thursday, March 31, 2016

Install Android Studio on 64 bit Ubuntu 15 10 with Ubuntu Make umake

Ubuntu Make is a command line tool which allows you to download the latest version of popular developer tools (include Android Studio) on your installation, installing it longside all the required dependencies (which will only ask for root access if you dont have all the required dependencies installed already), enable multi-arch on your system if you are on a 64 bit machine, integrate it with the Unity launcher… Basically, one command to get your system ready to develop with!


To install Android Studio on Ubuntu:

- Add the Ubuntu Make ppa:
$ sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make
$ sudo apt-get update

- Install Ubuntu Make:
$ sudo apt-get install ubuntu-make

- Install android-studio:
$ umake android

Once finished, it will also install Java 7 (1.7.0_85 currently) on your system.

This video show how to install Android Studio on 64-bit Ubuntu-GNOME (run on VirtualBox) with Ubuntu Make.


Next:
- Setup Hardware Devices debugging for Android Studio on Ubuntu 15.10

Read More..

Wednesday, March 30, 2016

DialogFragment example something wrong on Android 6 Marshmallow emulator

Its a example to implement DialogFragment. Please check the screenshots of running on Android Emulators of Android 4.1 Jelly Bean with API 16, Android 5.1 Lollipop with API 22 and Android 6.0 Marshmallow with API 23. If the emulator of Android 6.0 Marshmallow work properly, DialogFragment display wrong on Marshmallow.



Check this video:


layout/fragment_dialog.xml, DialogFragment layout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout

android_padding="10dp"
android_orientation="vertical"
android_layout_width="match_parent"
android_layout_height="match_parent">

<ImageView
android_layout_width="wrap_content"
android_layout_height="wrap_content"
android_src="@mipmap/ic_launcher"/>

<TextView
android_id="@+id/dialogtext"
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_textSize="20dp"
android_textStyle="italic|bold"/>

</LinearLayout>

MainActivity.java with DialogFragment.
package com.blogspot.android_er.androiddialogfragment;

import android.app.DialogFragment;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

EditText inputTextField;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

inputTextField = (EditText)findViewById(R.id.inputtext);
Button btnOpen = (Button)findViewById(R.id.opendialog);
btnOpen.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showDialog();
}
});
}

void showDialog() {
FragmentTransaction ft = getFragmentManager().beginTransaction();
Fragment prev = getFragmentManager().findFragmentByTag("dialog");
if (prev != null) {
ft.remove(prev);
}
ft.addToBackStack(null);

String inputText = inputTextField.getText().toString();

DialogFragment newFragment = MyDialogFragment.newInstance(inputText);
newFragment.show(ft, "dialog");

}

public static class MyDialogFragment extends DialogFragment {

String mText;

static MyDialogFragment newInstance(String text) {
MyDialogFragment f = new MyDialogFragment();

Bundle args = new Bundle();
args.putString("text", text);
f.setArguments(args);

return f;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mText = getArguments().getString("text");

}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View dialogView = inflater.inflate(R.layout.fragment_dialog, container, false);
TextView dialogText = (TextView)dialogView.findViewById(R.id.dialogtext);
dialogText.setText(mText);

return dialogView;
}
}
}


layout/activity_main.xml, main layout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout


android_layout_width="match_parent"
android_layout_height="match_parent"
android_padding="16dp"
android_orientation="vertical"
tools_context=".MainActivity"
android_background="#808080">

<TextView
android_layout_width="wrap_content"
android_layout_height="wrap_content"
android_layout_gravity="center_horizontal"
android_autoLink="web"
android_text="http://android-er.blogspot.com/"
android_textStyle="bold" />

<EditText
android_id="@+id/inputtext"
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_hint="Type something"/>
<Button
android_id="@+id/opendialog"
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_text="Open DialogFragment"
android_textAllCaps="false"/>
</LinearLayout>


reference: http://developer.android.com/reference/android/app/DialogFragment.html


To fixed it, edit layout/fragment_dialog.xml, modify android:layout_width of <ImageView> from "wrap_content" to "match_parent".

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout

android_padding="10dp"
android_orientation="vertical"
android_layout_width="match_parent"
android_layout_height="match_parent">

<ImageView
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_src="@mipmap/ic_launcher"/>

<TextView
android_id="@+id/dialogtext"
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_textSize="20dp"
android_textStyle="italic|bold"/>

</LinearLayout>

android:layout_width="wrap_content"

android:layout_width="match_parent"

Read More..

Monday, March 21, 2016

Runtastic on Android Wear


By Austin Robison, Product Manager, Android Wear




Fitness apps make  great additions to Android Wear. Let’s take a look at one of our favorites, Runtastic. Runtastic is a fitness app that lets you track your walks, runs, bike rides and more. With Runtastic on Android Wear, youll see your time, distance, and calories burned at a glance on your wrist. You can also start, stop and pause your activity by touch. Tuck your phone away in a pocket or backpack and do everything on your watch.


Its challenging to build user experiences that really come alive on Android Wear because its such a new type of device. Runtastic does a great job of showing the right information and providing just the right controls on the screen on your wrist. Lets dig into some of the Android Wear platform features that Runtastic uses to make such a great user experience.

Voice Actions

Android Wear enables developers to launch their activities with voice. Runtastic responds to “Ok Google, start running” by beginning to track a session and displaying a card with your total time. This means you can start exercising without needing to pull your phone out of a pocket or arm strap. Android Wear is all about bringing you useful information just when you need it and enabling users to quickly and easily take action.


runtastic_01.png


Responding to platform voice intents on Wear is as simple as declaring a standard intent filter to start an activity.  For example, to launch your activity for the “start running” voice action, add the following to your activity’s entry in your AndroidManifest.xml:


<intent-filter>
   <action android_name="vnd.google.fitness.TRACK"/>
   <category android_name="android.intent.category.DEFAULT"/>
   <data android_mimeType="vnd.google.fitness.activity/running"/>
</intent-filter>


Custom Cards

Once a user has started a run, Runtastic inserts a card in the stream as an ongoing notification to ensure it is ranked near the top of the stream during the activity. This card uses the setDisplayIntent() function to display custom UI. It provides quick, glanceable information, showing your activity time. Cool!


When the user swipes to the right of the card to expose its actions, we see some quick and easy to understand options; following the Android Wear style guidelines means that Runtastic has a familiar UI and feels like a natural extension of the watch. There are actions for pausing, stopping, and an action to see more details on the run.  This action launches a full screen Activity where Runtastic draws a completely custom layout.




You’ll notice this data updates live; Runtastic makes use of the Wearable Data Layer API in Google Play Services to synchronize data between the phone and the watch. Its an easy to use API for syncing data between your devices.


Background Services

When a user finishes their run, Runtastic presents them with a special summary card that appears only on the watch. In this case, the notification is generated directly on the watch by a Service. This Service uses the Data Layer to receive information about the completed activity from the phone to the watch, including an image of a map of the user’s run generated through the Google Maps API.


To show that information, the app uses Android Wear’s NotificationManager, which functions just like the NotificationManager on a phone or tablet, except that instead of creating notifications in the pull-down shade, they appear in the stream.




Runtastics implementation on Android Wear is a perfect example of how to take advantage of wearables to make something truly useful for users. For more information on these and other great platform features, please see the developer documentation.


For more inspiring Android Wear user experiences, check out this collection on the Play Store!


Posted by Mano Marks, Google Developer Platform Team
Read More..

Sunday, March 20, 2016

Agile Android

Agile Android

This concise book walks you through how to get unit testing and test driven development done on Android, specifically using JUnit 4. Youll learn how to do agile development quickly and correctly, with a significant increase in development efficiency and a reduction in the number of defects.

Agile practices have made major inroads in Java development, however its very unusual to see something as basic as unit testing on an Android project. Done correctly, Agile development results in a significant increase in development efficiency and a reduction in the number of defects. Google have finally moved away from JUnit 3 and the developer can now do the more commonly accepted JUnit 4 tests in Android Studio.

Up until now getting JUnit testing up and running in Android was not for the "faint hearted." However, "now its in Android Studio, there is no excuse," according to the author Godrey Nolan, president of RIIS LLC. Android developers are faced with their own set of problems such as tightly coupled code, fragmentation, immature testing tools all of which can be solved using existing Agile tools and techniques that this short book will teach you.

What Youll Learn:
  • What are the key Android unit testing tools and how to use them in Android Studio
  • What is the Agile testing pyramid for Android
  • When to use Espresso and when to use JUnit
  • What is mock testing and how to use Mockito in your Android apps
  • What are and how to use third party tools like Hamcrest, Roblectric, Jenkins and more
  • How to apply test driven development (TDD) to Android
  • How to add unit testing to someone elses code
Audience:
This book is for Android app developers looking for an edge to build better quality Android apps.  Some experience with Java also helpful.

Read More..

Wednesday, March 16, 2016

Install Android Studio 2 0 Preview on Ubuntu Linux parallel with existing installed Android Studio


Android Studio 2.0 Preview is available to download in Canary Channel now. This video show how to download and run in Ubuntu (Ubuntu-GNOME 15.10 on VirtualBox/Windows 10), in parallel with existing installed Android Studio 1.5.


(reference: Android Developers Blog)

Related:
- Download and run Android Studio 2.0 Preview on Windows 10

Read More..

Friday, March 4, 2016

Android Error Error generating final archive Debug certificate expired on …

One day I opened eclipse to start a new android application, after creating the project and trying to run it I received the following error:

[2010-08-27 15:32:04 – (Project Name)] Error generating final archive: Debug certificate expired on 7/30/10 10:42 PM!

After searching I found this link which suggests the solution: http://www.androidian.de/?p=940.

The problem comes from the fact that Android required the applications to be signed even in the debug mode. So it uses a keystore file called debug.keystore to providde keys for signing applications in debug mode. This key store file has a validity period by default 365 days from its creation date.

The First Solution:


Navigate to the .android folder in your home directory “~/.android” (Linux,Mac OS) or c:Documents and Settings[User Name].android in windows XP or C:Users.android in windows Vista or Windows 7, and delete debug.keystore file. Then go to eclipse clean the project, this will create a new debug.keystore file with default validity period 365 days.

The Second Solution:


Create a new default.keystore file with custom validity period (say 1000 days).
  1. Navigate to the .android folder.
  2. Delete the old default.keystore file.
  3. We will use JDK Keytool.exe to generate the new key file. It is found in C:Program FilesJavajre6 in in windows or inside the Javajre6 in folder in Mac OS or Linux.
  4. Open the terminal app in Mac OS or Linux or the command prompt and navigate to keytool.exe directory.
  5. Run the following command:
    keytool -genkey -keypass android -keystore debug.keystore -alias androiddebugkey -storepass android -validity 1000 -dname “CN=Android Debug,O=Android,C=US”
  6. This will generate a new default.keystore file with validity period 1000 days.
  7. Copy the generated file to the .android folder, go to eclipse and clean projects and it should work.
The above command has the following options:
  • genkey: generates a key pair.
  • keystore <Key Store Name>: the name of the key store file.
  • alias <alias name>: an alias for the key store. If the alias name is more than 8 characters the first 8 only are used.
  • storepass <password>: the password for the key.
  • validity <Validty Period>: the validity period for the key in days.
  • dname <name>: A Distinguished Name that describes who created the key. The value is used as the issuer and subject fields in the self-signed certificate.
Read More..