Friday, February 14, 2014

Android - How To Get Screen Size

Android - How To Get Screen Size

from http://stackoverflow.com/questions/2485697/getting-the-size-of-the-window-without-title-notification-bars

15down voteaccepted
Use View.MeasureSpec.getSize method in onMeasure override.
    @Override
protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)
{
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    int width = MeasureSpec.getSize(widthMeasureSpec);
    int height = MeasureSpec.getSize(heightMeasureSpec);
    ...
}
share|improve this answer
 
Evgeny's answer led me here, which answered the rest of my questions developer.android.com/guide/topics/ui/custom-components.html –  Stanley.Goldman Sep 10 '10 at 0:09
add comment

To accomplish this in my app, I had to find a View's dimensions within the main Activity. It looked something like this:
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    gestureScanner = new GestureDetector(this);   //Object for handling gestures.

    mvView = new MyView(this);  //MyView is class that extends View.
    setContentView(myView);
}

@Override
public void onShowPress(MotionEvent e) {

    //Returns the size of the entire window, including status bar and title.
    DisplayMetrics dm = new DisplayMetrics();
    this.getWindowManager().getDefaultDisplay().getMetrics(dm);

    //Try to find the dimension of the view without the status/title bars.
    int iViewHeight = mvMountain.getHeight();
    int iViewWidth = mvMountain.getWidth();


    Toast toast = Toast.makeText(this," View:" + iViewWidth + ","+iViewHeight + " Window: " + dm.widthPixels + " by " + dm.heightPixels, 2);
    toast.show();
}
share|improve this answer
add comment

I have a tutorial on my blog that give you the ability to save your screen size on launch, You can read it here: http://evgeni-shafran.blogspot.com/2011/01/android-screen-size-problem.html
Basicly you need to overide an onMeasure method of the first layout that hold you full screen, and get the width and height from there
share|improve this answer
add comment

have a look at getwidth() and getheight() maybe? that should give you the size of the screen. though, I don't know If it takes the bars or not. But I don't think so...
share|improve this answer
1  
Which getWidth/getHeight methods are you talking about? I might not have been clear enough in the question, sorry. I'm developing for Android, not BlackBerry, so Screen.getWidth() isn't what I'm looking for. –  Victor Mar 22 '10 at 1:02
 
getwidth does not apply to the screen but to a view or layout. (I understood you were on android as you tagged your question so ;)) So if you put for instance a Relative layout with attributes fill_parent for its width and height and do getwidth and getheight in your code, I think it should give you satifaction –  Sephy Mar 22 '10 at 7:44
add comment

in the first onDraw, call getWidth, getHeight. these will not be valid before then.
if you are not using a custom view/layout then you can instead call getWidth/getHeight during the first onWindowFocusChanged

Thursday, February 13, 2014

How To Quit Android Application - You Don't

  1. How To Quit Android Application - You Don't

  2. How to quit android application programmatically - Stack Overflow

    stackoverflow.com/.../how-to-quit-android-application-...
    Stack Overflow
    Jun 13, 2011 - Is it good way to quit the app in Android? ... There are so many posts already here. stackoverflow.com/search?q=how+to+exit+an+android+app  ...
  3. android - Quitting an application - is that frowned upon? - Stack ...

    stackoverflow.com/.../quitting-an-application-is-that-fro...
    Stack Overflow
    Jan 3, 2010 - No matter what you dodo not put a "quit" or "exitapplication button. It is useless with Android's application model. This is also contrary to how  ...
  4. How to exit or quit android application? - Stack Overflow

    stackoverflow.com/.../how-to-exit-or-quit-android-appl...
    Stack Overflow
    Apr 3, 2011 - I have created an sample application for android and tested it in my htcandroid mobile. I want to know how to exit the applicationcan anyoneQu

Meaning of Java @Override

Meaning of Java @Override

found here: http://stackoverflow.com/questions/4736212/meaning-of-android-override

@Override is a Java annotation. It tells the compiler that the following method overrides a method of itssuperclass. For instance, say you implement a Person class.
public class Person {
   public final String firstName;
   public final String lastName;

   //some methods

   @Override public boolean equals(Object other) {
      ...
   }
}
The person class has an equals() method. The equals method is already defined in Person's superclassObject. Therefore the above implementation of equals() is a redefinition of equals() for Persons. That is to say, Person overrides equals().
It is legal to override methods without explicitly annotating it. So what is the @Override annotation good for? What if you accidentally tried to override equals() that way:
public boolean equals(Person other) {
   ...
}
The above case has a bug. You meant to override equals() but you didn't. Why? because the real equals() gets an Object as a parameter and your equals() gets a Person as a parameter. The compiler is not going to tell you about the bug because the compiler doesn't know you wanted to override. As far as the compiler can tell, you actually meant to overload equals(). But if you tried to override equals using the @Override annotation:
@Override public boolean equals(Person other) {
   ...
}
Now the compiler knows that you have an error. You wanted to override but you didn't. So the reason to use the @Override annotation is to explicitly declare method overriding

Wednesday, February 12, 2014

Minnesota Minneapolis Rochester Software Computer Jobs

Minnesota Tech Computer Jobs

Employers

Wednesday, January 29, 2014

Charting DragonChart using HTML5 Canvas

http://www.codeproject.com/Articles/715977/Introduction-to-dragonchart-Open-Source-Infographi

Tutorial

http://www.w3schools.com/html/html5_canvas.asp Draws a box with a line through it

Try this test.html:

<canvas id="myCanvas" width="200" height="100"
style="border:1px solid #000000;">
</canvas>
<script>
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.fillStyle="#FF0000";
ctx.fillRect(0,0,150,75);
ctx.moveTo(0,0);
ctx.lineTo(200,100);
ctx.stroke();
</script>


Tuesday, November 12, 2013

Microsoft and Yahoo Doomed By Forced Firing By Ranking

Microsoft and Yahoo Doomed By Forced Firing By Ranking



  • See also: More stories · Top stories
  • Microsoft does away with stack ranking | ZDNet

    Microsoft does away with stack ranking
    www.zdnet.com/microsoft-does-away-with-stack-ranking-7000023103
    Nov 12, 2013 · Stack ranking, an employee-evaluation process that has been roundly criticized by many current and former Microsoft employees, is …
  • Microsoft kills Ballmer’s morale-wrecking employee ranking ...

    Microsoft kills Ballmer’s morale-wrecking employee ranking system
    news.yahoo.com/microsoft...employee-ranking-system...
    Here’s how you know the Steve Ballmer era is truly ending at Microsoft: The company has finally killed off stack ranking. ZDNet reports that Microsoft …
  • Why Microsoft Dumped "Stack-Ranking" - Digits - WSJ

    Why Microsoft Dumped ‘Stack Ranking’
    blogs.wsj.com/digits/2013/11/12/why-microsoft-dumped-stack-ranking
    Nov 12, 2013 · The sometimes loathed employee-review system has been a fixture of Microsoft for years. Lately, critics said the system — under which 


  • www.businessweek.com/.../yahoos-latest-hr...ranking-workers-on-a-curve
    Nov 12, 2013 · If Marissa Mayer is as good at identifying winning startups as she is at embracing contentious human resources practices, Yahoo! is going to be just fine.
    If Marissa Mayer is as good at identifying winning startups as she is at embracing contentious human resources practices, Yahoo! (YHOO) is going to be just fine. Several months after the great work-at-home kerfuffle of 2013, Yahoo employees were up in arms about a new policy that forces managers to rank employees on a bell curve, then fire those at the low end. According to AllThingsD, Marissa Mayer reportedly told Yahoo workers that the rankings weren’t mandatory, but many people disagree... Yahoo has waded into the “third rail of human resource management.” Forcing managers to rank their employees along a bell curve was popularized in the 1980s (thanks, Jack Welch), but lately it has fallen out of favor. 
    Just over 5 percent of high-performing companies used a forced ranking system in 2011, down from almost 20 percent two years earlier. ..research suggests that employee performance doesn’t follow a bell curve at all. Instead, most people are slightly worse than average (PDF), with a few superstars

  • http://valleywag.gawker.com/yahoo-is-forcing-employees-to-rank-each-other-and-they-1462900871/@maxread

    Yahoo! has recently implemented an archaic bell curve ranking system, compelling employees to artificially spread colleagues over a range of bad to good—even if reality doesn't actually reflect itself on a curve. That's the thing about bell curves: they look so great on paper, but not so much when you're looking around the room and thinking of who might get fired over it. Maybe it's you! And indeed, heads are rolling from the artificial curvature:
    According to a multitude of top-ranking posts on an anonymous internal message board used by Yahoo to vent their frustrations to top staff, employees there are becoming increasingly upset by an evaluation system instituted by CEO Marissa Mayer that has apparently resulted in the firings of more than 600 people in recent weeks...the "Quarterly Performance Review" system forces managers to rank some of their staff with designations of "Occasionally Misses" and "Misses," even if it is not the case
    Businessweek also points out that this kind of rationalized review is just bad for business. Of course, it's horrible for morale: AllThingsD says livid employees, who are basically being asked to betray their coworkers in the name of statistical neatness, are taking to an internal message board with their gripes:











    http://www.businessinsider.com/microsoft-was-destroyed-by-its-stack-review-process-according-to-new-vanity-fair-expose-2012-7
    Microsoft Just Killed The Controversial 'Stack Ranking' Review System That Killed Employee Morale


    Here's one big internal problem with Microsoft, according to Vanity Fair:
    Eichenwald’s conversations reveal that a management system known as “stack ranking”—a program that forces every unit to declare a certain percentage of employees as top performers, good performers, average, and poor—effectively crippled Microsoft’s ability to innovate. “Every current and former Microsoft employee I interviewed—every one—cited stack ranking as the most destructive process inside of Microsoft, something that drove out untold numbers of employees,” Eichenwald writes. “If you were on a team of 10 people, you walked in the first day knowing that, no matter how good everyone was, 2 people were going to get a great review, 7 were going to get mediocre reviews, and 1 was going to get a terrible review,” says a former software developer. “It leads to employees focusing on competing with each other rather than competing with other companies.”


    Read more: http://www.businessinsider.com/microsoft-was-destroyed-by-its-stack-review-process-according-to-new-vanity-fair-expose-2012-7#ixzz2kSxfHZKR


    She implemented the same system at Google, which was just ripped off from Microsoft. (which I think was ripped off from G.E.) 



    THAT'S FASCINATING
    @Sam Biddle


    This ranking system is actually a performance evaluation method that, while no longer perhaps the most popular system, is certainly not "archaic".
    Basically she's trying to cut the fat in a bloated company and keep the superstars. Can't blame her. I will acknowledge it sucks for the employees but major organizational change is never easy. Her communication could be better.





    NICK DENTON
    @GarrisonKeebler


    And the diagnosis of Microsoft's decline usually centers on the system of stack review, which turned individuals in departments against each other.
    But any system of evaluation organized around groups would have its own perverse effects.
    Let's say that the groups were measured against each other and the weakest 1 in 10 disbanded. The marginal work groups would be highly reluctant to cooperate with others, lest they be dragged down. And the better performers in each group would try to leave for a team of their peers, fearful of being dragged down.
    Whatever system is chosen, individuals will game. So the only real question for top management is this: at what more or less granular level do you need cooperation to obtain?Reply1