-1

There is an error with this Android layout and class and I can't find it.

When I click on the button from the main activity, the application force close. I don't know where is the fault.

logcat

http://db.tt/IV0tJpgh

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<SeekBar
    android:id="@+id/seekBarSend"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:scrollbars="none" >

    <EditText
        android:id="@+id/id_send_txt"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#00000000"
        android:ems="10"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:gravity="center"
        android:inputType="textMultiLine"
        android:shadowColor="@color/black"
        android:shadowDx="2"
        android:shadowDy="2"
        android:shadowRadius="1.5"
        android:text="@string/s_send_txt"
        android:textColor="@color/Vanilla"
        android:textSize="30sp" >

        <requestFocus />
    </EditText>
</ScrollView>

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="5dp" >

    <Button
        android:id="@+id/id_send_send"
        style="@style/Button_Normal"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:background="@drawable/btn01"
        android:onClick="c_send_send"
        android:text="@string/s_send_send" />
</LinearLayout>
</LinearLayout>

package com.e_orthodoxy.orthodox_prayers;

public class SendActivity extends Activity {
private SharedPreferences prefs;
private SeekBar seekbar;
private EditText edittext;

@Override
protected void onCreate(Bundle savedInstanceState) {
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    Window window = getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
    window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    overridePendingTransition(R.anim.incoming,R.anim.outgoing);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_send);
    seekbar = (SeekBar) findViewById(R.id.seekBarSend);
    edittext = (EditText) findViewById(R.id.id_sunset_txt);
    prefs = getPreferences(MODE_PRIVATE);
    float fs = prefs.getFloat("fontsize", 50);
    seekbar.setProgress((int)fs);
    edittext.setTextSize(TypedValue.COMPLEX_UNIT_PX,seekbar.getProgress());
    seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

            @Override
            public void onStopTrackingTouch(SeekBar seekBar){
                prefs = getPreferences(MODE_PRIVATE);
                SharedPreferences.Editor ed = prefs.edit();
                ed.putFloat("fontsize", edittext.getTextSize());
                ed.commit();    
            }
            @Override
            public void onStartTrackingTouch(SeekBar seekBar){

            }
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress,
                                          boolean fromUser){
                edittext.setTextSize(TypedValue.COMPLEX_UNIT_PX,progress);
            }
        });


}

public void c_send_send (View v) {
    Uri uri = Uri.parse("mailto:prayers@e-orthodoxy.net");
    Intent send = new Intent(Intent.ACTION_SENDTO, uri);                                   
                send.putExtra(Intent.EXTRA_SUBJECT,"إقتراح أو تعليق");
    startActivity(Intent.createChooser(send, "إقتراح أو تعليق"));
}
@Override
public void onBackPressed() {
    Intent intent_send_main = new Intent (SendActivity.this, MainActivity.class);
    startActivity(intent_send_main);
    finish();
}}
4

1 に答える 1

0

更新: xml によると、渡した ID に edittext がありません! 私はそれがすべきだと思います:id_send_txtではなくid_sunset_txt

于 2013-08-31T22:53:33.233 に答える