Glass에 Immersion
유형의 앱을 만듭니다. 동적으로 TextView를 Activity
에서 변경하려고 시도하지만 해당 활동으로 갈 때 프로그램이 충돌합니다. 몰입 형 프로그램이므로 Cards
을 사용하지 않는 것이 좋습니다.Google Glass : TextView setText가 액티비티에서 작동하지 않습니다.
TextView.setText
을 정기적으로 사용하는 방법을 알려주세요.
감사합니다.
활동에서 OnCreate 메소드 된 setContentView 후에서 onCreate에
TextView tvTest = (TextView)findViewById(R.id.testText);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_checklist);
mGestureDetector = createGestureDetector(this);
readJson();
tvTest.setText("testing testing");
}
활동 XML
<FrameLayout
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:padding="40px"
tools:context=".NewChecklistActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center_horizontal"
android:text="@string/newChecklist"
android:textSize="50px"
android:textStyle="bold" />
<TextView
android:id="@+id/testText"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</FrameLayout>
몇 가지 코드를 게시 할 수 있습니까? 레이아웃을 부 풀리게하고 그로부터'TextView' 위젯을 얻는 방법은 다른 안드로이드 장치에서 할 수있는 것과 다르지 않아야합니다. 그래서 같은 기술이 그곳에서 작동해야합니다. –
@TonyAllevato가 코드를 추가했습니다. 이 방법은 일반적으로 내가 사용했던 Android 프로그램에서 Glass가 작동하지 않는 이유와 혼동을 일으킬 수 있습니다. –