안드로이드 개발 질문/답변
(글 수 45,052)
typedef struct _FX_Margin {
int gDataCnt;
int gDispCnt;
int sdispCnt;
int gRealDataIndex;
double gfXScale;
double gfYScale;
float gMinMain;
float gMaxMain;
int LHBand;
int gMinIndex;
int gMaxIndex;
int gTimeKind;
int gMAValue1;
int gMAValue2;
} FX_Margin;
있습니다. 여기서
-(void) CalcuXScale:(int) nWidth{
pMe.gfXScale = (double)nWidth /(double)pMe.gDispCnt;
}
쓰는데 자바에선 어떻게 하는지요? 클래스를 만들어서 하는지.. 예를 보여 주시면 감사드립니다.
int gDataCnt;
int gDispCnt;
int sdispCnt;
int gRealDataIndex;
double gfXScale;
double gfYScale;
float gMinMain;
float gMaxMain;
int LHBand;
int gMinIndex;
int gMaxIndex;
int gTimeKind;
int gMAValue1;
int gMAValue2;
} FX_Margin;
있습니다. 여기서
-(void) CalcuXScale:(int) nWidth{
pMe.gfXScale = (double)nWidth /(double)pMe.gDispCnt;
}
쓰는데 자바에선 어떻게 하는지요? 클래스를 만들어서 하는지.. 예를 보여 주시면 감사드립니다.
2010.07.27 13:22:29
class _FX_Margin {
int gDataCnt;
int gDispCnt;
int sdispCnt;
int gRealDataIndex;
double gfXScale;
double gfYScale;
float gMinMain;
float gMaxMain;
int LHBand;
int gMinIndex;
int gMaxIndex;
int gTimeKind;
int gMAValue1;
int gMAValue2;
void CalcuXScale(int nWidth){
gfXScale = (double)nWidth /(double)gDispCnt;
}
}
2010.07.27 13:59:08
@interface DrawBong : UIView {
id <drawBongDelegate> BongDelegate;
Line pline;
RectSize *pRectSize;
FX_Margin *pMe;
ViewInFo *pVInFo; //구조체변수
UIView * view;
UILabel *indexLabel[12];
UILabel *timeLabel[5];
UILabel *timeLabel1[5];
UILabel *minLable;
UILabel *maxLable;
float distance;
BOOL bPoint2First;
CGPoint beforePoint;
int movingCount;
int JongFlag;
int viewFlag;
NSString *strJong;
}
이런 값들은;; 어떻게 하나요 그럼?? 휴....하나하나가 고비네요.
2010.07.27 14:05:33
Objective C네요.
포인터를 자바로 풀어서 사용해야하지 않을까요?
NSString의 경우 자바의 String api를 이용하면 될테고,
UIView나 UILable의 경우는 Xcode의 IB와 연동되는 부분이니. 안드로이드일 경우에는
View 나 TextView로 변환해서 사용해야 할것 같은데요.
RectSize *pRectSize의 경우는 RectSize자체도 구조체니깐,
그에 해당하는 public class RectSize {
int x;
int y;
int width;
int height;
}
등으로 하면 될것은 같은데요.
저도 해보지는 않았지만 ^^;
C의 포인터로 사용하는 struct의 경우 자바에서는 그냥 클래스로 만들어서 new해서 생상하고 -> 대신 .을 한다고 생각하는게,..
좋을것 같습니다.
구조적으로는 둘다 alloc를 해서 process에서 heap 구조에 배치 하는것으로 알고 있거든요.
서로 호출하는 방법이 다른것이고요..
포인터를 자바로 풀어서 사용해야하지 않을까요?
NSString의 경우 자바의 String api를 이용하면 될테고,
UIView나 UILable의 경우는 Xcode의 IB와 연동되는 부분이니. 안드로이드일 경우에는
View 나 TextView로 변환해서 사용해야 할것 같은데요.
RectSize *pRectSize의 경우는 RectSize자체도 구조체니깐,
그에 해당하는 public class RectSize {
int x;
int y;
int width;
int height;
}
등으로 하면 될것은 같은데요.
저도 해보지는 않았지만 ^^;
C의 포인터로 사용하는 struct의 경우 자바에서는 그냥 클래스로 만들어서 new해서 생상하고 -> 대신 .을 한다고 생각하는게,..
좋을것 같습니다.
구조적으로는 둘다 alloc를 해서 process에서 heap 구조에 배치 하는것으로 알고 있거든요.
서로 호출하는 방법이 다른것이고요..