Android studio list of useful shortcuts or like Eclipse
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).
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
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 -
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 -
396LW NO topic_id
AD
Další témata ....(Topics)
Díl 2.
V prvním dile jsme se něco dozvěděli od XML souborech
Používáme příklad i zip porojekt z https://developer.android.com/training/basics/fragments/creating.html
V tomto díle si rozebereme záludnosti v souboru MainActivity.java.
V prvním dile jsme se něco dozvěděli od XML souborech
a taky jaké označení procesoru pro rok 2016 - Intel® VT-x, Intel® EM64T - musí mít PC pro programování v Android Studiu, tedy hlavně pro spuštění emulátoru - virtuálního telefonu, tabletu atd. jinak nebudete moci testovat aplikace na nejnovějších zařízeních, které tento emulátor umí napodobit.
Dole na stránce odkazu je uvedena minimální konfigurace PC, ale protože Android je již plnokrevný OS, který se neustále rozrůstá, tak tyto hodnoty jsou prakticky nedostatečné a je třeba osadit PC nejnovějšími komponentami.
Používáme příklad i zip porojekt z https://developer.android.com/training/basics/fragments/creating.html
V tomto díle si rozebereme záludnosti v souboru MainActivity.java.
// název balíčku
package com.example.android.fragments;
import android.os.Bundle;
// knihovny nutné pro spuštění na starších zařízeních s verzí Androidu API 4
// API verze a příslušné číslo verze Androidu jsou zde
// https://cs.wikipedia.org/wiki/Historie_verz%C3%AD_Android
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
// HeadlinesFragment je třída se seznamem položek, která díky
// OnHeadlineSelectedListener bude vracet události kliknutí na položku
// Pokud při pokusech přídáme jiný soubor se seznamem, je nutno změnit i název HeadlinesFragment
// na nový název, jinak nic neodchytíme!!!!
public class MainActivity extends FragmentActivity
implements HeadlinesFragment.OnHeadlineSelectedListener {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// tady se rozhoduje zda si vezme XML pro malé obrazovky, jen s jedním panelem, nebo
// velké se dvěma panely
// Rozhoduje si o tom systém sám, ale můžeme to ovlivnit a pdstrčit mu
// i dvoupanel pro testování - viz předchozí díl //android.okhelp.cz/1-fragments-tutorial-xml-czech-language/
setContentView(R.layout.news_articles);
//// VELKE OBRAZOVKY - layout-large - dual panel /////////
// pokud si systém vybere news_articles.xml z layout-large (dual panel)
// budou fragmenty automaticky naloděny do tagů fragment, kde jsou
// uvedeny absolutní cesty fragmentů!!!!
// např. fragment android:name="com.example.android.fragments.HeadlinesFragment"
// si nalodí sám fragment s linkami - položkami ListView.
// Podobně se sám obslouží při nalodění i fragment s obsahem
// fragment android:name="com.example.android.fragments.ArticleFragment"
// Tyto tagy fragment, s absolutní cestou k fragmentu,
// neumožňují výměnu fragmentu za běhu aplikace!!!!!
// Dynamickou výměnu fragmenut však umožňují kontejnery tagu FrameLayout
//// MALE OBRAZOVKY - jen jeden fragment //////
// Zkontrolujeme, který XML byl naloděn, pokud je activováno R.id.fragment_container
// značí to, že byl vybrán XML ze složky layout, kde je pouze jeden panel a do něj
// vložíme pouze fragment se seznamem, tedy HeadlinesFragment a pak po vybrání položky
// v něm otevřeme ArticleFragment.java s vypsáním obsahu článku atd.
if (findViewById(R.id.fragment_container) != null) {
// Pokud obnovujeme seznam položek vrácením se z předchozího stavu - fragmentu
// pak nepotřebujeme nic dělat a měl bychom opustit tento if, jinak
// dojde překrývání fragmentů, tedy uvídíme překryv textů a dalších elementů původního
// fragmentu fragmentem novým proto uděláme podmínku:
if (savedInstanceState != null) {
return;
}
// vytvoříme instanci HeadlinesFragment s položkami seznamu v ListView
HeadlinesFragment firstFragment = new HeadlinesFragment();
// pokud chceme vložit speciální instrukce pro start odebrané z nějakého Intent,
// odchytíme je zde a vložíme je jako argumenty. Pak je při startu fragmentu
// možno odchytit v onCreate()
firstFragment.setArguments(getIntent().getExtras());
// vložíme fragment do fragment_container FrameLayout-u
// který umožňuje výměnu fragmentů
getSupportFragmentManager().beginTransaction()
.add(R.id.fragment_container, firstFragment).commit();
}
}
// uživatel klikl na nějakou položku ze seznamu v HeadlinesFragment!
public void onArticleSelected(int position) {
// vybereme určitý článek dle pozice položky vybrané v seznamu ListView
// Provedeme kontrolu jestli je naloděn dual panel, nebo jen jednoduchý
ArticleFragment articleFrag = (ArticleFragment)
getSupportFragmentManager().findFragmentById(R.id.article_fragment);
if (articleFrag != null) {
// VELKÉ OBRAZOVKY
// protože je aktivní id R.id.article_fragment z news_articles.xml v layout-large složce
// víme, že aplikace používá dual-panel, dva fragmenty vedle sebe
// zde se volá funkce která je obsažena v třídě v souboru ArticleFragment.java
// a provede patřičné příkazy, v našem případě se
// vypíše obsah článku z třídy Ipsum.java
// sloužící jako úložiště textů přiřazených k jednotlivým
// pozicím - položkám seznamu ListView
articleFrag.updateArticleView(position);
} else {
// MALÉ OBRAZOVKY
// jen JEDEN-PANEL se zobrazuje - vybrán soubor news_articles.xml v layout složce
// musíme vyměnit fragemnty !!!!
// Vytvoříme fragment a doplníme argumenty - hodnoty, poslané např. z HeadlinesFragment.java
// jedná se nám především o pozici položky, na kterou bylo kliknuto v ListView
// tato pozice bude určující pro výběr obsahu pro ArticleFragment
ArticleFragment newFragment = new ArticleFragment();
Bundle args = new Bundle();
args.putInt(ArticleFragment.ARG_POSITION, position);
newFragment.setArguments(args);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
// Zde vyměníme původní fragment HeadlinesFragment novým fragmentem s obsahem článku atd.
// Můžeme vyměnit fragment za jiný, protože id fragment_container v layout/news_articles.xml je tagu FrameLayout
transaction.replace(R.id.fragment_container, newFragment);
// addToBackStack umožní uživateli vrátit se zpět na seznam položek v HeadlinesFragment.java
transaction.addToBackStack(null);
// celou transakci předáme ke schválení :)
transaction.commit();
}
}
}
Landscape - portrait orientation change:
boolean mbOrientationLandscape = true;
if(mbOrientationLandscape ){
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
mbOrientationLandscape =false;
}else{
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
mbOrientationLandscape =true;
}
// warning
private static String DB_PATH = "/data/data/cz.okhelp.german_czech_phrases/databases/";
// OK
public DataBaseHelper(Context context) {
super(context, DB_NAME, null, 1);
this.myContext = context;
// OK
DB_PATH = context.getFilesDir().getParentFile().getPath()
+ "/databases/";
}
Issue: Cropped superscript index between tags sup /sup is not correctly visible in TextView or View as Button.

String s = "10<sup>12 </sup>";
textView.setText(Html.fromHtml(s)); // 12 will cropped
// solution:
s = "10<sup>12 </sup>\t "; // add behind ending of sup tag the tabulator \t,
// but not char \t but only press to TAB key!!! in source code
textView.setText(Html.fromHtml(s)); // 12 is visible correctly

If I trying
android-sdk_r22.6.2-windows.zip
adt-bundle-windows-x86_64-20140321.zip
and open xml layout graphic editor and xml layout file
memory continues to grow to crashes Eclipse
https://developer.android.com/sdk/index.html
I have to install old version adt-bundle-windows-x86-20131030.zip
what working fine.
I had to delete .metadata folder in workspace if I want open old version ADT
android-sdk_r22.6.2-windows.zip
adt-bundle-windows-x86_64-20140321.zip
and open xml layout graphic editor and xml layout file
memory continues to grow to crashes Eclipse
https://developer.android.com/sdk/index.html
I have to install old version adt-bundle-windows-x86-20131030.zip
what working fine.
I had to delete .metadata folder in workspace if I want open old version ADT
Editace: 2015-11-09 15:04:31
Počet článků v kategorii: 396
Url:android-studio-list-of-useful-shortcuts