Skip to main content

Posts

Showing posts from November, 2017

Copy to clipboard

In my upcoming app, I have codes which I display. These are some times lengthy, and I want the app to be able to copy this to clipboard. Once it is in clipboard, users can paste it anywhere.

So how do you copy some text from your app to clipboard.

You need to use clipboard manager.

Clipboard Manager This class sets and gets data for the clipboard using Clipdata objects. 
You can get the object of this class using system service.  - using statement
context.getSystemService(Context.CLIPBOARD_SERVICE)
Example I have a dummy project with a button, onclick of which copies content to clipboard.
Here is my activity file

package com.hegdeapps.testapp;importandroid.content.ClipData;importandroid.content.ClipboardManager;importandroid.support.v7.app.AppCompatActivity;importandroid.os.Bundle;importandroid.view.View;importandroid.widget.Button;importandroid.widget.TextView;publicclassMainActivityextends AppCompatActivity {@OverrideprotectedvoidonCreate(Bundle savedInstanceState){super.onCreate(sa…

Hundred - a number game updated

Shataka - my number game which is very simple but really good, has been updated.

First of all, its name is changed to "Hundred". Because that is the aim of the game, right?

There are some UI changes too. May be for better :) :)

And I have added a how to section, which guides the user step by step.

The game has a grid of 9 cells , 3 rows and 3 columns. The aim of the game is to fill this grid with  numbers so that each row and each column adds up to 100. And all the required numbers are given at the bottom of the grid.

In this version( v 3.0), in level 1,  6 numbers are already provided in the grid. (In older versions 3 numbers were filled in the grid). So user needs to fill only 3 more numbers. So level 1 is pretty easy. You can see that in the above screen shot, 2nd row and 3rd column are already filled and their sums are 100.

In level 2, 5 numbers are provided and user should fill the remaining 4. And so on.

From level 8 onwards, the game is slightly more challenging. No…