I am not able to get the ACTION_WEB_SEARCH to work correctly, does this require any permissions on the AndriodManifest.xml?

This is my code:

 String q = edittext.getText().toString();
 Intent myIntent = new Intent(Intent.ACTION_WEB_SEARCH, Uri.parse(q));

Any help would be much appreciated.

Platform 2.0.


 String q = edittext.getText().toString();
 Intent intent = new Intent(Intent.ACTION_WEB_SEARCH );
 intent.putExtra(SearchManager.QUERY, q);

Date earlier than a month ago

How to check whether the given date is earlier than a month ago? What is the fastest algorithm? I have to take into account that different months have different numbers of days.


Updated to Java 8

The class LocalDate class can be used:

LocalDate aDate = LocalDate.parse("2017-01-01");
return aDate.isBefore(;

For previous versions, the Calendar class would work.

Calendar calendar = Calendar.getInstance();
calendar.add( Calendar.MONTH ,  -1 );
return aDate.compareTo( calendar.getTime() ) < 0;

Sample code:

import static java.lang.System.out;
import java.time.LocalDate;

public class Sample {
    public static void main( String [] args ) {
        LocalDate aMonthAgo =;
        out.println( LocalDate.parse("2009-12-16").isBefore(aMonthAgo));
        out.println( LocalDate.parse("2017-12-24").isBefore(aMonthAgo));



Is it possible to run the Chromium Browser on Android?

Since you should be able to build Chromium browser on any reasonably modern Linux distribution, can we assume that you should be able to build it onto Android ?


No, Android is not exactly a Linux distribution. It’s based on a Linux kernel, but it doesn’t include an X server nor other dependencies for building Chromium on Linux.

However the Android Browser is also based on WebKit and includes the V8 JavaScript engine.


I need a cycle which iterates through dates interval

I have the start date and the end date. I need to iterate through every day between these 2 dates.

What’s the best way to do this?

I can suggest only something like:

Date currentDate = new Date (startDate.getTime ());
while (true) {
   if (currentDate.getTime () >= endDate.getTime ())
   doSmth ();
   currentDate = new Date (currentDate.getTime () + MILLIS_PER_DAY);


ready to run 😉

public static void main(String[] args) throws ParseException {
    GregorianCalendar gcal = new GregorianCalendar();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
    Date start = sdf.parse("2010.01.01");
    Date end = sdf.parse("2010.01.14");
    while (gcal.getTime().before(end)) {
        gcal.add(Calendar.DAY_OF_YEAR, 1);
        System.out.println( gcal.getTime().toString());

android memory management outside heap

I am working on an application for android and we since we have lots of graphics, we use a lot of memory.

I monitor the memory heap size and its about 3-4 Mb , and peeks of 5Mb when I do something that requires more memory (and then goes back to 3). This is not a big deal, but some other stuff is handled outside the heap memory, like loading of drawables.

For example if I run the ddms tool outside eclipse, and go to sysinfo, I see that my app is taking 20Mb on the Droid and 12 on the G1, but heap size are the same in both, because data is the same but images are different.

So the questions are:
How do I know what is taking the memory outside the heap memory?
What other stuff takes memory outside the heap memory? Complex layouts (big tree) ? Animations?




Bitmap objects takes a quite alot of memory.

Ex. if your app downloads a 10KB jpg from net and use BitmapFactory to decode it into a Bitmap that bitmap objects needs about 30-100KB memory, depending on the resolution of your image. 3bytes for each pixel (1 byte for each color)

And yes, all kind of object uses memory, like LinearLayouts, ImageViews etc… If you are creating and destroying many of these objects, ex. as you scroll / page through your images, there will be memory leaks. The gc() does not handle so-called short lived objects as fast as we would like.

*Keep the number of view objects at a stable level**, and recycle them instead of destroying and creating new ones.


If your app reaches 20MB in memory, it may FC as the BitmapFactory is trying to decode the next image.

Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..