بروز خطا
   [message]
اشتراک در سوال
رای ها
[dataList]
پرسش و پاسخ

مشکلم با btn

مدیریت گفتگو
Lion and the rabbit 10 سال پیش
آخرین تغییر: 10 سال پیش

سلام اگه میشه لطفا راهنمایی کنید مشکل این چیه(حل شد)

 package mohammadi.yasin.app;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;


public class MyStarup4Activity extends Activity {

public int Counter = 0;


@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

final TextView txtCaption = (TextView) findViewById(R.id.txtCaption);
final Button btnChangeVisibility = (Button) findViewById(R.id.btnChangeVisibility);

for (int i = 0; i < 2; i++) {
Toast.makeText(MyStarup4Activity.this, "Some Massege " + i, Toast.LENGTH_SHORT).show();
txtCaption.setText("I is: " + i);
}

txtCaption.setTextColor(Color.parseColor("#00ff00"));
txtCaption.setBackgroundColor(Color.parseColor("#7f7f7f"));
txtCaption.setTextSize(40);
//txtCaption.setVisibility(View.GONE);
txtCaption.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {
Log.i("LOG", "View Text Clicked");
Toast.makeText(MyStarup4Activity.this, "Text View Clicked", Toast.LENGTH_SHORT).show();
Counter++;
txtCaption.setText("Counter is: " + Counter);
}
});

btnChangeVisibility.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {
Log.i("LOG", "View Text Clicked");
Toast.makeText(MyStarup4Activity.this, "Text View Clicked", Toast.LENGTH_SHORT).show();
Counter++;
txtCaption.setText("Counter is: " + Counter);
}
});
}
}
 
 

نظرات

!M!KT 10 سال پیش
خب پیام خطایی که براتون اومده چیه. اونو بذار.
MarAnd 10 سال پیش
مشکلتون دقیقا کجاست ؟ چه خطایی میگیره ؟ باتن btnChangeVisibility که ویزیبیلیتی رو تغییر نمیده اصلا اینجا!. اگه میخواین تغییرش بده باید با متد ()getVisibility این کار رو انجام بدین .

پاسخ‌ها 3

Lion and the rabbit 10 سال پیش

نظرات

Lion and the rabbit 10 سال پیش

نمیدونم ولی وقتی کامپیوتر رو خاموش کردم و بعد از یه مدت روشن کردم دیگه ازم خطا نگرفت!

نظرات

Lion and the rabbit 10 سال پیش

وقتی هم که دیگه خطا نگرفت دیگه با اف5 نرم افزارم تو امولیتور بالا نیومد و پیغام has stoped رو میده

نظرات

آریا 10 سال پیش
الان بالاخره مشکلت حل شده؟ یا خیر

پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .