미완성인 감사어플

프로그래밍|2014. 1. 25. 06:00
미완성인 감사어플


구글 개발자 등록을 저 번주에 드디어 마치고 간단히 앱을 개발을 하기 시작을 했습니다. 아직까지 허접한 앱이지만 그래도 나름 감사에 관련된 어플입니다. 오늘 하루 중 있었던 일이나 기뻤던 일을 감사를 하는 것인데 간단히 텍스트 박스에 오늘 하루 중에 기뻤던 일을 간단히 입력 후에 버튼을 누르면 메세지 뜨는 형태입니다.


초기에 많이 부족하지만 기능을 조금씩 바꾸어 나갈 예정입니다. 소스는 공개를 해드리겠습니다. 안드로이드 로컬에서만 돌아가기 때문에 서버와 연동을 하지 않았고 내부에 SQLite를 사용을 하지 않고 아주 기본적인 소스로 구성이 되어 있습니다.




위에서 말씀을 드린 앱이 어떻게 돌아가는지 과정을 스크린샷으로 찍었습니다. 쉬운 말로 캡쳐! ㅎㅎ 스마트폰 내에 캡쳐를 했어요. 캡쳐를 하는 방법을 몰라 어플을 다운 받았지만 허사였네요. 전원키, 홈키를 같이 누르면 캡쳐가 되더군요. 소스를 공개를 해드리겠습니다.



MainActivity.java

package com.example.intenttest;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends Activity {
 
 EditText edt1;
 Button btn;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       
        edt1 = (EditText)findViewById(R.id.edt1);
        btn = (Button)findViewById(R.id.btn);
        btn.setOnClickListener(new OnClickListener() {
         @Override
         public void onClick(View v) {
          String thank = edt1.getText().toString();
          
          Toast.makeText(getApplicationContext(), thank, Toast.LENGTH_LONG).show();
         }
        });
    }
}


위의 소스는 자바소스입니다. xml소스도 공개를 해드리겠습니다.

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >
    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="200dip"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:orientation="vertical" >
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="오늘 하루 중 제일 기뻤던일!" />
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >
            <EditText
                android:id="@+id/edt1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1" >
                <requestFocus />
            </EditText>
        </LinearLayout>
       
        <View
            android:layout_width="fill_parent"
            android:layout_height="10dip"/>
        <Button
            android:id="@+id/btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="감사하기" />
    </LinearLayout>
</RelativeLayout>


화면의 레이아웃을 구성을 하는 xml부분입니다. 보통 LinearLayout을 주로 쓰지만 RelativeLayout도 많이 쓰이는 추세입니다. 레이아웃 구성은 텍스트박스, 버튼, 텍스트 뷰로 구성이 되어 있습니다. 참으로 쉬운 구성이네요. 아직까지 안드로이드의 세부적인 기능을 접하질 못하였습니다. 심지어 센서부분까지 건드리지 못해봤습니다.


요즘에 꿈을 찾는 중인데 꿈을 찾기란 쉽지 않은거 같아요. 늘 그래왔듯이 꿈만 찾다가 왠지 모를 시간을 다 보내는 거 같아 직접 소스를 치고 있습니다. 부족한 소스이지만 이렇게 관심을 가져 주셔서 고맙습니다. 후에 완성을 하게 되면 마켓에 배포를 할 예정입니다. 처음 이지만 최선을 다해 만들어 보겠습니다.~

댓글()