android.widget.RelativeLayout cannot be cast to android.widget.EditText - java

I'm attempting to create a note taker using Firebase and I'm falling at the first hurdle as I'm getting the error as per the title of this question.
My XML file is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.android.frapp.NoteTakerActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay"
android:id="#+id/appBarLayout2">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimaryDark"
app:popupTheme="#style/ThemeOverlay.AppCompat.Dark" />
</android.support.design.widget.AppBarLayout>
<include
android:id="#+id/noteTitleTxt"
layout="#layout/content_note_taker" />
<EditText
android:id="#+id/noteTitleTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="#+id/appBarLayout2"
android:ems="10"
android:hint="Enter Title"
android:inputType="text" />
<Spinner
android:id="#+id/spinnerNoteType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="#+id/noteTitleTxt"
android:layout_marginTop="13dp"
android:entries="#array/type" />
<Button
android:id="#+id/addNoteBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/spinnerNoteType"
android:layout_centerHorizontal="true"
android:layout_marginTop="19dp"
android:text="Add Note" />
</RelativeLayout>
The java class in question is:
package com.example.android.frapp;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class NoteTakerActivity extends AppCompatActivity {
EditText editNoteTitle; // It's this causing the issue
Button addButton;
Spinner spinnerType;
DatabaseReference databaseNotes;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_note_taker);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
databaseNotes = FirebaseDatabase.getInstance().getReference("notes");
editNoteTitle = (EditText) findViewById(R.id.noteTitleTxt);
addButton = (Button) findViewById(R.id.addNoteBtn);
spinnerType = (Spinner) findViewById(R.id.spinnerNoteType);
addButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
addNote();
}
});
}
private void addNote() {
String title = editNoteTitle.getText().toString().trim();
String type = spinnerType.getSelectedItem().toString();
if (!TextUtils.isEmpty(title)) {
String id = databaseNotes.push().getKey(); // id being created is unique every time
Notes notes = new Notes(id, title, type);
databaseNotes.child(id).setValue(notes); // to send data to database
Toast.makeText(this, "Title added", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "You must give the note a title", Toast.LENGTH_SHORT).show();
}
}
}
I've made sure I don't have any duplicate edit text names and got rid of any classes and xml files that are no longer needed just to be sure.
I've cleaned and rebuilt I don't know how many times but can't get past this issue. Does anyone have any other ideas I can use/try?
Thanks

Here you have it twice!
<include
android:id="#+id/noteTitleTxt" // <-----------------
layout="#layout/content_note_taker" />
<EditText
android:id="#+id/noteTitleTxt" // <-----------------
Just remove the one id in your include tag. While not shown in your post, I bet its top container is RelativeLayout.

Related

Android Studio : When ever i run my app, it says Unfortunately app has stopped [duplicate]

This question already has answers here:
Unfortunately MyApp has stopped. How can I solve this?
(23 answers)
Closed 4 years ago.
I am trying to get an input from user and then covert it into double and divide it by 1000 and then set the value in a textview but i while running the app, the app closes and says Unfortunately the app has stopped.
Here's my MainActivity.java file :
package com.blogspot.techtutorialsajen.androiddevelopmentpractice;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity{
private Button btn1;
private EditText get;
private TextView result;
#Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn1 = (Button)findViewById(R.id.btn1);
result = (TextView)findViewById(R.id.result);
get = (EditText)findViewById(R.id.get);
final double value = Double.parseDouble(get.getText().toString()) / 1000;
btn1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
result.setText(String.valueOf(value));
}
});
}
}
And My activity_main.xml file :
?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<EditText
android:id="#+id/get"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:hint="#string/enter_a_number"
android:layout_marginTop="48dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:id="#+id/btn1"
android:text="#string/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/result"
android:layout_centerHorizontal="true"
android:layout_marginBottom="28dp" />
<TextView
android:id="#+id/result"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textSize="20pt"
android:text="0"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
Well, Your app is crashes because of java.lang.RuntimeException:java.lang.NumberFormatException: Invalid double: ""
that means you are trying to convert empty string to Double.
So, Because the EditText is empty your app is crashes and I have re-write your code so that you can copy-paste.
Here is your MainActivity.Java
package com.blogspot.techtutorialsajen.androiddevelopmentpractice;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity{
private Button btn1;
private EditText get;
private TextView result;
#Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn1 = (Button)findViewById(R.id.btn1);
result = (TextView)findViewById(R.id.result);
get = (EditText)findViewById(R.id.get);
btn1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
if (get.getText().toString().isEmpty()) {
Toast.makeText(MainActivity .this, "Please input something", Toast.LENGTH_LONG).show();
} else {
final double value = Double.parseDouble(get.getText().toString()) / 1000;
result.setText(String.valueOf(value));
}
}
});
}
}
and here is your activity_main.XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<EditText
android:id="#+id/get"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:hint="#string/enter_a_number"
android:layout_marginTop="48dp"
android:inputType="number"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:id="#+id/btn1"
android:text="#string/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/result"
android:layout_centerHorizontal="true"
android:layout_marginBottom="28dp" />
<TextView
android:id="#+id/result"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textSize="20pt"
android:text="0"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
I have added android:inputType="number" property to your EditText so that, now on, it will only take Number from the user.
From your xml file and activity code, it clearly says your edittext is empty while launching app.
And you are using this code in oncreate()
final double value = Double.parseDouble(get.getText().toString()) / 1000;
which throws java.lang.NumberFormatException: empty String
You can change your code like,
btn1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
if(!get.getText().toString().isEmpty)
final double value = Double.parseDouble(get.getText().toString()) / 1000;
result.setText(String.valueOf(value));
}
});
}

attempt to invoke a virtual method on null object with onclicklistener

I'm sure this question has been asked a few times; however, after searching for a while, all I find is "to declare the variable before calling the clicklistner" I've done that already. But still getting the same error. If someone can let me know why the clicklistener called on the getQuoteBotton is giving the following error.
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
mainActivity
package com.example.george.radonquote;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import static com.example.george.radonquote.R.layout.activity_main;
public class MainActivity extends AppCompatActivity {
TextView titleTextView;
ImageView mainImageView;
Button getQuoteBotton;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(activity_main);
titleTextView = (TextView) findViewById(R.id.main_title);
mainImageView = (ImageView) findViewById(R.id.main_image);
getQuoteBotton = (Button) findViewById(R.id.get_quote_btn);
getQuoteBotton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent quoteActivityIntent = new Intent(getApplicationContext(), QuotesActivity.class);
startActivity(quoteActivityIntent);
}
});
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#154350"
tools:context="com.example.george.radonquote.MainActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Random Quotes"
android:textColor="#fff"
android:textSize="27dp"
android:textAlignment="center"
android:id="#+id/main_title"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="55dp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:src="#drawable/vector_socrates"
android:id="#+id/main_image"
android:layout_below="#+id/main_title"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="84dp" />
<Button
android:id="#+id/get_quote_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/main_image"
android:layout_centerHorizontal="true"
android:layout_marginTop="70dp"
android:text="get quote" />
</RelativeLayout>

OnItemClick redirects to blank screen?

listview.xml
<!--?xml version="1.0" encoding="utf-8"?-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:id="#+id/lstText">
</ListView>
</LinearLayout>
ListView Code
package saint.animaltracking;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import java.util.List;
import saint.animaltracking.helper.AnimalAdapter;
import saint.animaltracking.helper.DatabaseHelper;
/**
* Created by Kodie on 3/28/2016.
*/
public class selectAnimal extends AppCompatActivity
{
private ListView lv;
private List<animal> animal;
private DatabaseHelper db;
AnimalAdapter adapter;
#Override
protected void onCreate(final Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
db = new DatabaseHelper(this.getApplicationContext());
setContentView(R.layout.main);
animal = db.getAllAnimal();
lv = (ListView) findViewById(R.id.lstText);
adapter = new AnimalAdapter(this, R.layout.list_item, animal);
lv.setAdapter(adapter);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
animal anim = (animal) lv.getItemAtPosition(position);
Intent intent = new Intent(getApplicationContext(), specific.class);
intent.putExtra("animal", anim);
startActivity(intent);
}
});
}
}
specific.class xml (Generic as I am trying to debug the issue)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="#+id/btnButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 1"/>
<Button
android:id="#+id/btnButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 2"
android:layout_toRightOf="#+id/btnButton1"/>
<Button
android:id="#+id/btnButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 3"
android:layout_below="#+id/btnButton1"/>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btnButton3"
android:layout_marginTop="94dp"
android:text="User :"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/textView1"
android:layout_toRightOf="#+id/btnButton3" />
<Button
android:id="#+id/btnSubmit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/editText1"
android:text="Submit" />
</RelativeLayout>
Specific.java code
package saint.animaltracking;
import android.content.Intent;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
/**
* Created by Kodie on 5/2/2016.
*/
public class specific extends AppCompatActivity {
String id;
private SQLiteOpenHelper AT;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.specific);
Intent intent = getIntent();
}
}
The issue I am running into is that when I click the specific listview item to go to the specific animal, all it shows is a blank page. I'm not really sure why though, but I have a strong feeling it has something to do with the way I am writing the OnItemClickListener and OnItemClick or how it is passing the intent to the specific.java class? I've done just about everything I can think of (I've been working in android for about three weeks) to resolve this, outside of trying to rewrite the OnItemClickListener section. Any tips in the right direction are greatly appreciated. Thanks in advance.
UPDATE:
I get the following messages repeatedly when clicking the listitem
W/ViewRootImpl: Cancelling event due to no window focus: MotionEvent...
E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb40d53a0
Try to define some textview with random text in spesific class.. or something like Toast, to prove that spesific class is running or not.

Trying to convert from lowercase to uppercase and viceversa. strange result using .toUpperCase()

I'm a real noob and my question may be stupid.
I'm building an app to convert from uppercase to lowercase and vice versa.
I have two editText and 2 buttons.
One editText is the user input and the other is the converted text; one button is to convert to lowercase and the other is to convert to uppercase.
this is my .xml so far:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="myapplication.example.falcoleo.lettercaseconverter.MainActivity"
tools:showIn="#layout/activity_main"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="#+id/card_originalText"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_weight="1"
app:cardBackgroundColor="#color/grey800"
card_view:cardCornerRadius="4dp">
<EditText
android:id="#+id/originalText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:gravity="top"/>
</android.support.v7.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="8dp"
android:orientation="horizontal">
<Button
android:id="#+id/buttonSetToUppercase"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="convertToUpperCase" />
<Button
android:id="#+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="convertToLowerCase" />
</LinearLayout>
<android.support.v7.widget.CardView
android:id="#+id/card_convertedText"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:cardBackgroundColor="#color/grey800"
card_view:cardCornerRadius="4dp">
<EditText
android:text="TEST"
android:id="#+id/convertedText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:gravity="top"
android:editable="false"
android:inputType="none"
android:textIsSelectable="false"
android:background="#00000000"
/>
</android.support.v7.widget.CardView>
it's far from perfect but the real problem lies in the .java
package myapplication.example.falcoleo.lettercaseconverter;
import android.content.ClipData;
import android.content.Context;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.content.ClipboardManager;
import android.util.Log;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
TextView textView;
Button copyText;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final TextView textView = (TextView) findViewById(R.id.convertedText); //the second editText is called textView
final TextView original =(TextView) findViewById(R.id.originalText); //the first editTExt is called original
final String upper = original.toString().toUpperCase(); //Convert to uppercase
final String lower = original.toString().toLowerCase(); //Convert to lowercase
Button convertToUpperCase=(Button)findViewById(R.id.buttonSetToUppercase); // il primo pulsante si chiama convertToUpperCase
convertToUpperCase.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
textView.setText(upper);//Set Text on button click via this function.
}
});
Button convertToLowerCase = (Button)findViewById(R.id.buttonSetToUppercase); // il secondo pulsante si chiama convertToLowerCase
convertToLowerCase.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
textView.setText(lower); //Set Text on button click via this function.
}
});
}
}
When I build the app it doesn't give any error.
If I run it on a device, when I tap the convertToLowerCase button it does nothing; and when i tap convertToUpperCase button it writes android.support.v7.widget.appcompatedittext{28f38fb7 vfed..cl......i. 0,0-0,0 #7f0c006b app:id/originaltext} on the convertedText EditText.
Nothing to see on the log.
What is it doing? i'm not even sure it is an error message.
You should do the following
final String upper = original.getText().toString().toUpperCase(); //Convert to uppercase
final String lower = original.getText().toString().toLowerCase(); //Convert to lowercase
The one thing that might be causing you problems is the element type;
You are referencing :
TextView original;
But the actual elements are:
EditText
Can you please fix those first then try?
Then make sure once you get the typed text, convert to String and perhaps check for empty strings?
I hope this helps!

Android Studio - App Crashes

How can I change or add more code to make this app to stop crashing? This activity is called "WhatBin", I simply wanted to make a button listen to when a person would click and change a text view. (VIEW PICTURES BELOW FOR MORE DETAILS.)
PICTURES: http://imgur.com/a/ODvHb
package com.example.tiffany.whatbin;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import org.w3c.dom.Text;
public class WhatBin extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_what_bin);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final TextView txt_answer = (TextView) findViewById(R.id.txt_answer);
Button btn_go = (Button) findViewById(R.id.btn_go);
btn_go.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
txt_answer.setText("Marker - Recycle Bin");
}
});
};
}
HERE IS THE XML FILE:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_padddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:showIn="#layout/activity_what_bin" tools:context=".WhatBin">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Go"
android:id="#+id/btn.go"
android:layout_marginBottom="113dp"
android:textColor="#drawable/abc_dialog_material_background_dark"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textEdit"
android:layout_alignBottom="#+id/btn.go"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="#+id/btn.go"
android:layout_toStartOf="#+id/btn.go" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="#string/instructiontext"
android:id="#+id/textinstruc"
android:layout_below="#+id/textEdit"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="#+id/btn.go"
android:layout_toStartOf="#+id/btn.go" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="#string/txt.1"
android:id="#+id/txt.answer"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
UPDATE
You are currently using abc_dialog_material_background_dark as textcolor. As you can see in the source of this resource, it is basically a shape. And, shape cannot be used for textcolor.
In your XML file at line 17 you have used a color. That color is of wrong type. My guess, you have used a drawable instead of a color.
Post your activity_what_bin.xml for further explanation.

Categories