Okhelp.cz

Recepty, články, nápady, programování. Dříve dum-zahrada, finance, internet a know-how.okhelp.cz Pro lepší výsledky hledání používejte i diakritiku.

Android studio list of useful shortcuts or like Eclipse


AD MOB

File -> Settings -> Keymap you can do select Eclipse keymap from drop down menu

Ctrl+Shift+A (Help | Find Action on the main menu) and start typing the name of the action. Choose the desired action from the suggestion list.

Ctrl+Click (on Windows) or Cmd+Click (on MacOS) a tab in the editor to navigate to any part of the file path. Select the necessary element in the drop-down, and the corresponding file path opens in an external browser (e.g., in the Explorer, if your OS is Windows).

 

Find - Rename


Ctrl+F find

Refactor | Rename: Shift+F6  ( +F6)

Find and replace: CTRL + R

Go to variable declaration: CTRL + B

Ctrl+Shift+I (View | Quick Definition)

Ctrl+Alt+F7  (Edit | Find | Show Usages in the main menu)

Ctrl+Shift+F find in project

Ctrl+Shift+F7 (Edit | Find | Highlight Usages in File) to quickly highlight usages of some variable in the current file.
Use F3 and Shift+F3 keys to navigate through highlighted usages.
Press Escape to remove highlighting.

Ctrl+W (extend selection) in the editor selects the word at the caret and then selects expanding areas of the source code. For example, it may select a method name, then the expression that calls this method, then the whole statement, then the containing block, etc. You can also select the word at the caret and the expanding areas of the source code by double-clicking the target areas in the editor.

To search through the classes, files, tool windows, actions, settings, and symbols of your project by double pressing the Shift key

Ctrl+P (View | Parameter Info) e.g. localURL = new URL(localUrlString); select localUrlString and press Ctrl + P

Show html documentation tooltips:  CTRL + Q

 

Edit


Comment uncomment single line: CTRL + /

Comment uncomment selected text: CTRL + SHIFT + /

Code completion (Ctrl+Space)

Alt key and mouse pointer dragging for column selection

If nothing is selected in the editor, and you press Ctrl+C, then the whole line at caret is copied to the clipboard.

Ctrl + Delete  delete word from caret to end.

Ctrl + Backspace delete word from caret to start.

Duplicate line: CTRL + D

To compare two directories,or  jar files, select one or both of them in the Project view and press Ctrl+D.

Editor Delete Line: CTRL + Y

Move line UP, DOWN. Select a code fragment and press Ctrl+Shift+Up or Ctrl+Shift+Down.

To open any class or file in the editor at the desired line, press Ctrl+Shift+N (Navigate | File), start typing the name, and choose the one from the suggestion list. Then type the colon (:) and a line number

Ctrl+Shift+Enter to complete a current statement such as if, do-while, try-catch, return (or a method call)

Alt+Enter to invoke a quick fix or intention action, press the right arrow key to reveal the list of additional options.

To quickly review your recent changes to the project: Alt+Shift+C

Code Completion, you can accept the currently highlighted selection in the popup list with the period character (.), comma (,), semicolon (;), space and other characters.

Quickly move between methods in the editor:  Alt+Up and Alt+Down

Ctrl+Shift+J shortcut joins two lines into one and removes unnecessary space to match your code style

Ctrl+Shift+V to choose and insert recent clipboard contents into the text

Inheritance hierarchy for a selected class: Ctrl+H

Right-clicking on a breakpoint marker  you can quickly enable/disable the breakpoint or adjust its properties.

Evaluate the value of any expression while debugging the program, select its text in the editor (you may press a Ctrl+W a few times to efficiently perform this operation) and press Alt+F8.

Quickly evaluate the value of any expression while debugging the program, hold Alt and click this expression to see its value and calculate it, call a method, etc.

You can use the Extract Variable refactoring even on incomplete statements. Just select the necessary block in the editor and press Ctrl+Alt+V.

To open any particular method or field in editor: Ctrl+Alt+Shift+N

Add unimplemented methods: CTRL + I

Override methods: CTRL + O

Format code: CTRL + ALT + L

Show project: ALT + 1

Show logcat: ALT + 6

Hide project - logcat: SHIFT + ESC

Build: CTRL + F9

Build and Run: CTRL + F10

Alt+Shift+F10  access the Run/Debug dropdown on the main toolbar

Collapse all: CTRL + SHIFT + NumPad +

Expand all: CTRL + SHIFT + NumPad -

397LW NO topic_id




AD

Další témata ....(Topics)


233

ACRA allows your Android application to send Crash Reports | acra-allows-your-android-application-to-send-crash-reports


ACRA allows your Android application to send Crash Reports to various destinations:

a Google Docs spreadsheet (default and original behavior)
an email
your own server-side HTTP POST script
any other possible destination by implementing your own report sender

ACRA wiki and download page of project library
239

Admob ads not visible on emulator Android 4.1 | admob-ads-not-visible-on-emulator-android-4-1


If you using GoogleAdMobAdsSdk-4.0.4.jar in your project and set android:targetSdkVersion="17" in AndroidManifest.xml , ads will not visible on emulator with Android 4.0.3 or 4.1.
You have to set as android:targetSdkVersion="17"


<uses-sdk android:minSdkVersion="4" 
        android:targetSdkVersion="17" />


Update project.properties file - row with target to 17:

# Project target.
target=android-17
165

How to clear or hide an ImageView in Android | how-to-clear-or-hide-an-imageview-in-android



// solution 1
ImageView imageView = (ImageView)findViewById(R.id.myimage);
imageView.setImageDrawable(null);
// or
imageView.setImageResource(0);

// solution 2  hide ImageView
imageView.setVisibility(View.INVISIBLE);

// solution 3 resize ImageView 0, 0
 hImageViewSemafor.setLayoutParams(new LinearLayout.LayoutParams(0,0));
150

drawBitmap, clipPath, UNION, DIFFERENCE, INTERSECT, REPLACE, XOR Android example | drawbitmap-clippath-union-difference-intersect-replace-xor-android-example



public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(new SampleView(this));
	}

	private static class SampleView extends View {

		// CONSTRUCTOR
		public SampleView(Context context) {
			super(context);
			setFocusable(true);

		}

		@Override
		protected void onDraw(Canvas canvas) {
			Paint paint = new Paint();

			canvas.drawColor(Color.YELLOW);

			 Bitmap b = Bitmap.createBitmap(200, 200,
			 Bitmap.Config.ARGB_8888);

			// you need to insert a image flower_blue into res/drawable folder

			paint.setFilterBitmap(true);
			Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),
					R.drawable.flower_blue);
			canvas.drawBitmap(bitmapOrg, 10, 10, paint);
			int width, height;

		    Canvas c = new Canvas(b);
		    paint.setAlpha(255); //0x80
		    c.translate(0, 30);
		    c.drawBitmap(bitmapOrg, new Matrix(), paint);
		    paint.setColor(Color.BLUE);
        Path mPath = new Path();
		    mPath.addCircle(50, 50, 50, Path.Direction.CCW);
            //c.clipPath(mPath, Region.Op.UNION);
            //c.clipPath(mPath, Region.Op.DIFFERENCE);
            c.clipPath(mPath, Region.Op.INTERSECT);
            //c.clipPath(mPath, Region.Op.REPLACE);
            //c.clipPath(mPath, Region.Op.XOR);
           paint.setColor(Color.GREEN);
           paint.setAntiAlias(true);
           c.drawCircle(30, 20, 30, paint);

		    int h = bitmapOrg.getHeight();
			//canvas.drawBitmap(bitmapOrg, 10, 10, paint);
			canvas.drawBitmap(b, 0, 10 + h + 10, paint);

		}

	}
}



bitmap xor android


regions
234

tag should specify a target API level Warning | uses-sdk-tag-should-specify-target-api


Warning in AndroidManifest.xml:
tag should specify a target API level (the highest verified version; when running on
later versions, compatibility behaviors may be enabled) with android:targetSdkVersion="?"

Solution:

    <uses-sdk android:minSdkVersion="4"
         android:targetSdkVersion="16" />


Editace: 2015-11-09 15:04:31
Počet článků v kategorii: 397
Url:android-studio-list-of-useful-shortcuts

AD
11 Share
Share
Tweet