posted by 네코냥이 2014. 7. 17. 16:32

I used this way to get code folding in Netbeans:

// <editor-fold defaultstate="collapsed" desc=" description">
....
// </editor-fold>

and Visual Studio:

#region description
...
#endregion

but I can't find the same usage in eclipse. How can i use code folding in Eclispe?

share|edit|flag
  
 
@Ajeet: This question was 2 years ago past. But, pls read my question and question in link you had provided carefully. They are different questions. –  PhatHV Mar 28 at 5:23
add comment

Eclipse supports code folding.

Go to workbench preferences -> General -> Editors -> Structured Text Editors, and check the "Enable folding" box.

Then go to workbench preferences -> Java -> Editor -> Folding, and adjust your folding preferences.

share|edit|flag
1
 
But, I still can't use code folding for a block of code (codes not in comment out block and parentheses block). –  PhatHV Nov 23 '12 at 1:25
6
 
As far as I know, such fine-level folding isn't available with Eclipse, at least not with Eclipse Juno (which is the version that I am using). A quick search in Eclipse's BugZilla database shows many feature requests related to folding with the Java editor, some of them date years back. –  Isaac Nov 23 '12 at 1:34
  
 
Thanks Isaac. Your answer helped me so much. –  PhatHV Nov 23 '12 at 2:42
add comment


'JAVA' 카테고리의 다른 글

이클립스 - Blacket 정렬 옵션  (0) 2015.04.02
[이클립스] 코드(폰트크기) 줌인 확대 축소  (2) 2014.07.02
[이클립스] 단축키 설정  (0) 2014.07.02
posted by 네코냥이 2014. 7. 15. 15:33


버전가져오기


You can get it by calling Build.VERSION.SDK.

From 1.6 on, you should use Build.VERSION.SDK_INT instead
because Build.VERSION.SDK is deprecated.

http://stackoverflow.com/questions/3506792/android-api-version-programmatically





매칭 시키기


Code Name             Version      Api level

(no code name)         1.0          API level 1

(no code name)         1.1          API level 2

Cupcake                1.5          API level 3, NDK 1

Donut                  1.6          API level 4, NDK 2

Eclair                 2.0          API level 5

Eclair                 2.0.1        API level 6

Eclair                 2.1          API level 7, NDK 3

Froyo                  2.2.x        API level 8, NDK 4

Gingerbread         2.3 - 2.3.2     API level 9, NDK 5

Gingerbread         2.3.3 - 2.3.7   API level 10

Honeycomb              3.0          API level 11

Honeycomb              3.1          API level 12, NDK 6

Honeycomb             3.2.x         API level 13

Ice Cream Sandwich 4.0.1 - 4.0.2    API level 14, NDK 7

Ice Cream Sandwich 4.0.3 - 4.0.4    API level 15, NDK 8

Jelly Bean           4.1.x          API level 16

Jelly Bean           4.2.x          API level 17

Jelly Bean           4.3.x          API level 18

KitKat      4.4 - 4.4.2     API level 19


posted by 네코냥이 2014. 7. 15. 15:23

07-15 15:19:04.680: E/AndroidRuntime(9733): java.lang.NoSuchMethodError: android.view.ViewTreeObserver.removeOnGlobalLayoutListener





There are two methods in ViewTreeObserver with almost the same name.

removeOnGlobalLayoutListener(ViewTreeObserver.OnGlobalLayoutListener victim)

(on then global) is a method that was added in API 16. It replaces

removeGlobalOnLayoutListener(ViewTreeObserver.OnGlobalLayoutListener victim)

(global then on) which has existed since API 1, but which is now deprecated. Compatibility libraries can cause confusion about these two methods; it can appear present at compile-time but fail subsequently.

This code thwarts the error:

try {
    thing.removeOnGlobalLayoutListener(victim);
} catch (NoSuchMethodError x) {
    thing.removeGlobalOnLayoutListener(victim);
}

So does this code:

if(Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
    thing.removeGlobalOnLayoutListener(victim);
} else {
    thing.removeOnGlobalLayoutListener(victim);
}





android - Why does removeOnGlobalLayoutListener throw a NoSuchMethodError_ - Stack Overflow.pdf


posted by 네코냥이 2014. 7. 10. 10:59

Unit of measurement of TextView.setTextSize()

The Soundcorset metronome and tuner, in which I wrote it with Scaloid, is keep growing and hits 70,000 downloads. Until recently, it has a strange problem that it displays very large text for some devices, so that some button texts are clipped away out of the layout. After some code investigation, I found that it is very tricky pitfall because the code does not seems to have any problem at first:
STextView("Hello").textSize(20 sp)  // not correct!
The unit specification like 20 sp is very common in Scaloid. The implicit function sp converts the number from the sp unit to the pixel unit. The code above looks fine because the most of the Android API receives a size as the pixel unit. But there was a single exception. The methodTextView.setTextSize(float) does not receives a size as the pixel unit, it receives sp unit instead. It may cause a mistake because the most of other APIs handles a size as the pixel unit, even inTextView.getTextSize()!!! So I overridden STextView.textSize so that the APIs have consistency in pixel units:
@inline def textSize  (p: Int) =  textSize_=(p)
@inline def textSize_=(p: Int) = { 
  basis.setTextSize(android.util.TypedValue.COMPLEX_UNIT_PX, p)
  basis 
}
Now we can safely use the method textSize with the implicit unit conversions:
STextView("Hello").textSize(20 sp)  // correct :-D
I patched the current snapshot, and it will be available at the next release of Scaloid.


posted by 네코냥이 2014. 7. 2. 17:55


android - Set two buttons to same width regardless of screen size_ - Stack Overflow.pdf


weight 속성은, 남은 width에서 가져온다.

그래서 뷰의 width=0으로 고정해줘야만, 길이가 균등분배된다.


아니면 해당 뷰들의 width가 동일해도 좋다.

posted by 네코냥이 2014. 7. 2. 17:54


android - findViewById within fragment - Stack Overflow.pdf


posted by 네코냥이 2014. 7. 2. 10:04


Eclipse IDE _ How to zoom in on text_ - Stack Overflow.pdf


'JAVA' 카테고리의 다른 글

이클립스 - Blacket 정렬 옵션  (0) 2015.04.02
[이클립스] 코드접기  (0) 2014.07.17
[이클립스] 단축키 설정  (0) 2014.07.02
posted by 네코냥이 2014. 7. 2. 09:38


java - Bookmarks in Eclipse, set and go using hotkeys, do they exist_ - Stack Overflow.pdf


'JAVA' 카테고리의 다른 글

이클립스 - Blacket 정렬 옵션  (0) 2015.04.02
[이클립스] 코드접기  (0) 2014.07.17
[이클립스] 코드(폰트크기) 줌인 확대 축소  (2) 2014.07.02
posted by 네코냥이 2014. 7. 1. 17:03

Context -> getResources();



int resID = getResources().getIdentifier("button_%i",
    "id", getPackageName());
View addButton = findViewById(resID);




posted by 네코냥이 2014. 7. 1. 10:15


ViewPager with FragmentPagerAdapter &middot; thecodepath_android_guides Wiki &middot; GitHub.pdf




Test_ViewPager_Ver01.zip


Test_ViewPager_Ver02.zip



프로젝트는 소스 보고 따라 작성한것. 내용이 상이할 수 있습니다.