[Solved] Somethings wrong with my code TEXTVIEW

Make sure your verScore has the reference of TextView in XML. Try this: int verbalSc = 0; TextView verScore; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ……….. …………….. verScore = (TextView) findViewById(R.id.your_textview); } public void verbal1(){ verbalSc = verbalSc + 1; Toast.makeText(getBaseContext(), “1”, Toast.LENGTH_SHORT).show(); verScore.setText(Integer.toString(verbalSc)); } 1 solved Somethings wrong with my code TEXTVIEW

[Solved] Multiple fonts to a single custom TextView

This is how I achieved: Created a custom TextView public class CaptainTextView extends TextView { private HashMap<String, Typeface> mTypefaces; public CaptainTextView(Context context) { super(context); } public CaptainTextView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); super(context, attrs, defStyleAttr); if (mTypefaces == null) { mTypefaces = new HashMap<>(); } if (this.isInEditMode()) { return; } final TypedArray array … Read more

[Solved] GOOGLE SEARCH FROM TEXTVIEW IN ANDROID STUDIO 2.3.3

Let me get this straight. You want someone to use your app, type in a EditText, and when they click a button, it takes them to a browser and searches for the words they typed in? XML <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”Hello World!” android:textSize=”50dp” android:id=”@+id/textView” app:layout_constraintBottom_toBottomOf=”parent” app:layout_constraintLeft_toLeftOf=”parent” app:layout_constraintRight_toRightOf=”parent” app:layout_constraintTop_toTopOf=”parent” /> Java public class MainActivity extends AppCompatActivity … Read more

[Solved] Android: Error with adding textview to linearlayout

1. First create a file ids.xml in your /res directory and add the following XML schema to this file: <?xml version=”1.0″ encoding=”utf-8″?> <resources> <item type = “id” name = “mytextbox”></item> </resources> 2. Your onCreate() method should look like this: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_selection_screen); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); … Read more

[Solved] App stop working

Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet] 01-19 10:43:19.400: E/AndroidRuntime(1482): at java.lang.Class.getConstructorOrMethod(Class.java:472) You are not providing all of the constructors required for a custom view. Specifically, add this constructor. Read the documentation and tutorials for how to use the attribute set: public JustifiedTextView(Context context, AttributeSet attrs){ super(context, attrs); this.setWebChromeClient(new WebChromeClient() { }); } 2 … Read more

[Solved] How to pass EditText value in SharedPreferences

You called these functions in onCreate function. You should put theme in a button’s listener button.setOnClickListener(new View.OnClickListener { @Override private void onClick(View view){ // get text from EditText // put text to SharedPreferences } }); When application started, there is nothing in your EditText. 0 solved How to pass EditText value in SharedPreferences

[Solved] how to get strings from a string array and show it one by one in a TexttView using Buttons (android)

The function for onClick attribute in XML has to be something like, public void yourFunction (View view) { //Your code } Since you didn’t add View as the argument of your function, your layout is never going to get to it, hence when you click on your button, the app crashes. You also need to … Read more