실행환경

 Notebook

 SAMSUNG NT550p5c-s61r

 CPU

 Intel Core i5-3210M 2.50GHz

 Memory

 8 GB

 OS

 Window 7 ultimate 64bit

 Java

 1.8.0_05

 Android SDK : 4.4.2 (KitKat) / 테스트기기 : Galaxy S3 4.3 (Jelly Bean)

 WebServer

 Apache Tomcat 7.0


안드로이드 메일보내기

Intent it = new Intent(Intent.ACTION_SEND); String[] mailaddr = {"opid911@gmail.com"}; it.setType("plaine/text"); it.putExtra(Intent.EXTRA_EMAIL, mailaddr); // 받는사람 it.putExtra(Intent.EXTRA_SUBJECT, "[wisay]"); // 제목 it.putExtra(Intent.EXTRA_TEXT, "\n\n" + "v" + appVersion); // 첨부내용 startActivity(it);

받는주소에는 문자열배열이 아니면 안되는것 같다.


main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TabHost
        android:id="@+id/tabhost"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1" >
            </FrameLayout>

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        </LinearLayout>
    </TabHost>
</LinearLayout>

tabhost의 id가 @android:id/tabhost가 아닌 @+id/tabhost 이다.

위 tab은 FrameLayout 속성에 layout_weight="1" 때문에 하단에 위치하게 된다.


MainActivity.java

public class MainActivity extends ActivityGroup {
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		createTab();
	}

	private void createTab() {
		TabHost tabHost = (TabHost) findViewById(R.id.tabhost);
		tabHost.setup(getLocalActivityManager());

		tabHost.addTab(tabHost.newTabSpec("TAB1").setIndicator("TAB1")
				.setContent(new Intent(this, Tab1Activity.class)));
		tabHost.addTab(tabHost.newTabSpec("TAB2").setIndicator("TAB2")
				.setContent(new Intent(this, Tab2Activity.class)));

		}

	}
}


참고 사이트



+ Recent posts