alireza javakar
شنبه 17 اسفند 1392, 15:31 عصر
با سلام من از کلاس persian reshape استفاده میکنم ولی یا ارور میده توی کد ها و یا برنامه force close میده اینم از کد هام در ضمن من در values و در strings لغات رو معرفی کردم:
package com.example.hackas;
import com.farzad.suduko.R;
import android.os.Bundle;
import android.app.Activity;
import android.graphics.Typeface;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends Activity {
public String fonts="BZar.ttf";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setFace();
}
protected void setFace()
{
View startButton = findViewById(R.id.start);
startButton.setOnClickListener((OnClickListener) this);
View aboutButton=findViewById(R.id.about);
aboutButton.setOnClickListener((OnClickListener) this);
View exitButton=findViewById(R.id.exit_button);
exitButton.setOnClickListener((OnClickListener) this);
Typeface face = Typeface.createFromAsset(getAssets(), "font/"+fonts+"");
TextView Amuzesh=(TextView) findViewById(R.id.Amuzeshhack);
Amuzesh.setTypeface(face);
String str_lbl=(String) Amuzesh.getText().toString();
Amuzesh.setText(PersianReshape.reshape(str_lbl));
Button tv =(Button) findViewById(R.id.about);
tv.setTypeface(face);
String str_tv = (String) tv.getText().toString();
tv.setText(PersianReshape.reshape(str_tv));
Button btn_continue=(Button)findViewById(R.id.exit_button );
btn_continue.setTypeface(face);
String str_tv1 = (String) btn_continue.getText().toString();
btn_continue.setText(PersianReshape.reshape(str_tv 1));
Button btn_new=(Button)findViewById(R.id.start);
btn_new.setTypeface(face);
String str_tv2 = (String) btn_new.getText().toString();
btn_new.setText(PersianReshape.reshape(str_tv2));
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId())
{
case R.id.about :
// Intent in1=new Intent(Farsi.this,add.class);
//startActivity(in1);
break;
case R.id.exit_button:
finish();
break;
case R.id.start:
//Intent intent=new Intent(Farsi.this,about.class);
//startActivity(intent);
break;
}
}
}
package com.example.hackas;
import com.farzad.suduko.R;
import android.os.Bundle;
import android.app.Activity;
import android.graphics.Typeface;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends Activity {
public String fonts="BZar.ttf";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setFace();
}
protected void setFace()
{
View startButton = findViewById(R.id.start);
startButton.setOnClickListener((OnClickListener) this);
View aboutButton=findViewById(R.id.about);
aboutButton.setOnClickListener((OnClickListener) this);
View exitButton=findViewById(R.id.exit_button);
exitButton.setOnClickListener((OnClickListener) this);
Typeface face = Typeface.createFromAsset(getAssets(), "font/"+fonts+"");
TextView Amuzesh=(TextView) findViewById(R.id.Amuzeshhack);
Amuzesh.setTypeface(face);
String str_lbl=(String) Amuzesh.getText().toString();
Amuzesh.setText(PersianReshape.reshape(str_lbl));
Button tv =(Button) findViewById(R.id.about);
tv.setTypeface(face);
String str_tv = (String) tv.getText().toString();
tv.setText(PersianReshape.reshape(str_tv));
Button btn_continue=(Button)findViewById(R.id.exit_button );
btn_continue.setTypeface(face);
String str_tv1 = (String) btn_continue.getText().toString();
btn_continue.setText(PersianReshape.reshape(str_tv 1));
Button btn_new=(Button)findViewById(R.id.start);
btn_new.setTypeface(face);
String str_tv2 = (String) btn_new.getText().toString();
btn_new.setText(PersianReshape.reshape(str_tv2));
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId())
{
case R.id.about :
// Intent in1=new Intent(Farsi.this,add.class);
//startActivity(in1);
break;
case R.id.exit_button:
finish();
break;
case R.id.start:
//Intent intent=new Intent(Farsi.this,about.class);
//startActivity(intent);
break;
}
}
}