Adding AnyChart to Android - android

So, I installed AnyChart library and tried to do the simplest pie chart and it does not show up. I searced for proper samples of code and all of them don't work for me
So, here is my code:
layout:
<LinearLayout
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"
android:orientation="vertical"
tools:context="com.anychart.charts.Overall">
<com.anychart.AnyChartView
android:layout_weight="1"
android:id="#+id/any_chart_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
My java class:
package com.anychart.charts;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import com.anychart.AnyChart;
import com.anychart.AnyChartView;
import com.anychart.chart.common.dataentry.DataEntry;
import com.anychart.chart.common.dataentry.ValueDataEntry;
import com.example.project.R;
import java.util.ArrayList;
import java.util.List;
public class Overall extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_overall);
Pie pie = AnyChart.pie();
List<DataEntry> data = new ArrayList<>();
data.add(new ValueDataEntry("John", 10000));
data.add(new ValueDataEntry("Jake", 12000));
data.add(new ValueDataEntry("Peter", 18000));
pie.data(data);
AnyChartView anyChartView = findViewById(R.id.any_chart_view);
anyChartView.setChart(pie);
}
}

Related

ListView is not visible on the output screen

I am creating a ListView in which contents of an ArrayList(Declared Globally) is to be displayed. I am using a custom layout here. Everything looks good but the ListView is just not showing on the output screen. While the same coding used on some other project is giving the desired output. Please tell me if there is any problem with the code or some other thing.
Globalvar.java //where the ArrayList is declared
package com.example.tale;
import java.util.ArrayList;
import java.util.List;
public class Globalvar
{
public static int value=0;
public static List<String> list = new ArrayList<String>();
}
activity_cart2.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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".cart2">
<ListView
android:id="#+id/lvl"
android:layout_width="match_parent"
android:layout_height="404dp">
</ListView>
cart2.java
package com.example.tale;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.List;
public class cart2 extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cart2);
Globalvar.list.add("Example 1");
ListView listView = (ListView)findViewById(R.id.lvl);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,R.layout.forcart2,Globalvar.list);
listView.setAdapter(adapter);
}
}
forcart2.xml //custom layout
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/lable"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="40sp">
</TextView>

How to add and view child objects in Firebase (Android)?

I am having a similar issue in which I have my files as follow in which I want to be able to view all child items and add new child items.
I understand that you will have to modify the code in the Java file, but I am having trouble understanding how to manipulate my own code and I tried to follow the confusing documentation provided by Firebase.
Below is the structure of my database followed by my code. Any help would be greatly appreciated.
The only problem I have now is how to properly populate the listview with the values of the following structure of my database.
It is as follows: Messages --> Message --> value of which has concatenated string
I hope this isn't confusing
Here is my MainActivity.java
package com.example.sean.messengerappsean;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import com.firebase.client.DataSnapshot;
import com.firebase.client.Firebase;
import com.firebase.client.FirebaseError;
import com.firebase.client.Query;
import com.firebase.client.ValueEventListener;
import com.firebase.client.collection.ArraySortedMap;
import com.firebase.client.realtime.util.StringListReader;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
//TextView mTextFieldCondition;
EditText editUsername, editValue;
ArrayAdapter arrayAdapter;
Button btnSend;
Firebase mRef;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
protected void onStart() {
super.onStart();
//mTextFieldCondition = (TextView) findViewById(R.id.textViewCondition);
editUsername = (EditText) findViewById(R.id.editUsername);
editValue = (EditText) findViewById(R.id.editValue);
btnSend = (Button) findViewById(R.id.btnSend);
mRef = new Firebase("https://androidmessagetest.firebaseio.com/"); //CAN USE THE CODE HERE TO PUBLISH TO SPECIFIC LOCATION OR DB
//TRYING TO SET LISTVIEW
final ListView listView = (ListView) findViewById(R.id.listview);
final ArrayList<String> msgsArray = new ArrayList<String>(); //USE THIS FOR POPULATING THE VIEW
final ValueEventListener valueEventListener = mRef.addValueEventListener(new ValueEventListener() {
#Override
public void onDataChange(DataSnapshot dataSnapshot) {
//----------CONDITION FOR LISTING DATA----------------
//MIGHT NEED TO PUT VALUES INTO ARRAY AND READ THEM OUT IN ORDER OF PUBLISH
//String text = dataSnapshot.child("Message").child("Enter Username3").getValue(String.class);
//mTextFieldCondition.setText(text);
//POPULATE LISTVIEW
for (DataSnapshot Datasnapshot : dataSnapshot.getChildren()) {
msgsArray.add(Datasnapshot.child("Messages").child("Message").getKey());
}
ArrayAdapter arrayAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, msgsArray);
listView.setAdapter(arrayAdapter);
}
#Override
public void onCancelled(FirebaseError firebaseError) {
}
});
btnSend.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
//NEED TO DYNAMICALLY CHANGE VALUE TO USERNAME: MESSAGE
String textoutput = String.valueOf(editUsername.getText());
String MessageText = String.valueOf(editValue.getText());
//FIXED MESSAGE ADD CHILD AND HOW TO ADD VALUE TO MESSAGE
//TRY TO USE BELOW CODE FOR MESSAGES LATER ON
mRef.child("Messages").child("Message").push().setValue(textoutput + ": " + MessageText);
}
});
//ADD FUNCTION TO LOOK FOR DATA
}
}
Here is my XML file activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_main"
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"
tools:context="com.example.sean.messengerappsean.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--<TextView
android:id="#+id/textViewCondition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/mTextFieldCondition"
android:layout_centerHorizontal="true"
android:layout_marginBottom="89dp"
android:text="Condition" />-->
//ENTER IN CODE BELOW FOR VIEWING OUTPUT OF DATA
<ListView
android:id="#+id/listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
></ListView>
</LinearLayout>
<Button
android:id="#+id/btnSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:text="Send" />
<EditText
android:id="#+id/editValue"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignTop="#+id/btnSend"
android:layout_toLeftOf="#+id/btnSend"
android:layout_toStartOf="#+id/btnSend"
android:backgroundTint="#color/colorPrimaryDark"
android:inputType="textMultiLine"
android:text="Enter Message Here" />
<EditText
android:id="#+id/editUsername"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_above="#+id/btnSend"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_gravity="bottom"
android:background="#color/colorAccent"
android:inputType="textCapWords"
android:text="Enter Username" />
</RelativeLayout>
These imports are for classes in the legacy SDK:
import com.firebase.client.DataSnapshot;
import com.firebase.client.Firebase;
import com.firebase.client.FirebaseError;
import com.firebase.client.Query;
import com.firebase.client.ValueEventListener;
These are for the new SDK:
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
You cannot mix the two SDKs. You should use the new SDK only. Remove this statement from your build.gradle dependencies:
compile 'com.firebase:firebase-client-android:2.x.x'
and make the approriate code changes to use the new SDK. Documentation and examples are here. There is also an Upgrade Guide.

Multiple Recyclerview

I want to create a chatapp. But in the recyclerview i only can receive the messages from the usermsg databasereference. I dont know how I should code it that i shows 2 recyclerviews. Does someone got an idea? Thanks
Chat Activity
package highelo.drivetogether;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.provider.ContactsContract;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class Chat extends AppCompatActivity {
RecyclerView mFriendMsg;
RecyclerView mUserMsg;
private Button SendMsg;
private EditText EditMsg;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat);
final Intent s = getIntent();
final String userID = s.getStringExtra("UID");
final Intent i = getIntent();
final String post_UserID = i.getStringExtra("FID");
SendMsg = (Button) findViewById(R.id.send_msg);
EditMsg = (EditText) findViewById(R.id.edit_msg);
mUserMsg = (RecyclerView) findViewById(R.id.chat_conr);
mUserMsg.setHasFixedSize(true);
mUserMsg.setLayoutManager(new LinearLayoutManager(this));
mFriendMsg = (RecyclerView) findViewById(R.id.chat_conr);
mFriendMsg.setHasFixedSize(true);
mFriendMsg.setLayoutManager(new LinearLayoutManager(this));
}
#Override
protected void onStart() {
super.onStart();
final Intent s = getIntent();
final String userID = s.getStringExtra("UID");
final Intent i = getIntent();
final String post_UserID = i.getStringExtra("FID");
DatabaseReference FriendMsg = FirebaseDatabase.getInstance().getReference().child("Users").child(userID).child("Chats").child(post_UserID).child("Chat");
DatabaseReference UserMsg = FirebaseDatabase.getInstance().getReference().child("Users").child(post_UserID).child("Chats").child(userID).child("Chat");
final FirebaseRecyclerAdapter<Blog, BlogViewHolder2> firebaseRecyclerAdapter2 = new FirebaseRecyclerAdapter<Blog, BlogViewHolder2>(
Blog.class,
R.layout.inchat_row2,
BlogViewHolder2.class,
UserMsg) {
#Override
protected void populateViewHolder(BlogViewHolder2 viewHolder, Blog model, int position) {
viewHolder.setNachricht(model.getNachricht());
viewHolder.setImage(Chat.this, model.getFImage());
}
};
mUserMsg.setAdapter(firebaseRecyclerAdapter2);
final FirebaseRecyclerAdapter<Blog, BlogViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<Blog, BlogViewHolder>(
Blog.class,
R.layout.inchat_row,
BlogViewHolder.class,
FriendMsg) {
#Override
public void populateViewHolder(final BlogViewHolder viewHolder, Blog model, int position) {
viewHolder.setNachricht(model.getNachricht());
viewHolder.setImage(Chat.this, model.getFImage());
}
};
mFriendMsg.setAdapter(firebaseRecyclerAdapter);
}
public static class BlogViewHolder2 extends RecyclerView.ViewHolder{
View mView;
public BlogViewHolder2(View itemView) {
super(itemView);
mView = itemView;
}
public void setNachricht(String Nachricht){
TextView post_Nachricht = (TextView)mView.findViewById(R.id.finchat_mess);
post_Nachricht.setText(Nachricht);
}
public void setImage(Context ctx, String FImage){
ImageView post_image = (ImageView)mView.findViewById(R.id.finchat_image);
Picasso.with(ctx).load(FImage).fit().centerCrop().into(post_image);
}
}
public static class BlogViewHolder extends RecyclerView.ViewHolder{
View mView;
public BlogViewHolder(View itemView) {
super(itemView);
mView = itemView;
}
public void setNachricht(String Nachricht){
TextView post_Nachricht = (TextView)mView.findViewById(R.id.uinchat_mess);
post_Nachricht.setText(Nachricht);
}
public void setImage(Context ctx, String FImage){
ImageView post_image = (ImageView)mView.findViewById(R.id.uinchat_image);
Picasso.with(ctx).load(FImage).fit().centerCrop().into(post_image);
}
}
}
chat_activity
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="492dp"
android:id="#+id/chat_conr"
android:layout_weight="1.11"
android:layout_alignParentTop="true"
android:layout_alignRight="#+id/send_msg"
android:layout_alignEnd="#+id/send_msg"
android:layout_above="#+id/edit_msg" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/edit_msg"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toStartOf="#+id/send_msg"
android:layout_toLeftOf="#+id/send_msg" />
<Button
android:layout_width="80dp"
android:layout_height="wrap_content"
android:text="Senden"
android:id="#+id/send_msg"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
Inchat_row
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_margin="1dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="54dp"
android:layout_height="54dp"
android:id="#+id/uinchat_image"
app:civ_border_width="1dp"
app:civ_border_color="#ff0000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/uinchat_mess"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:paddingLeft="5dp"
android:textSize="13dp"
android:paddingBottom="4dp"
android:singleLine="true"
android:layout_alignParentTop="true"
android:layout_toEndOf="#+id/uinchat_image"
android:layout_alignBottom="#+id/uinchat_image" />
</RelativeLayout>
</android.support.v7.widget.CardView>
Inchat2_row
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_margin="1dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="54dp"
android:layout_height="54dp"
android:id="#+id/finchat_image"
app:civ_border_width="1dp"
app:civ_border_color="#ff0000"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/finchat_mess"
android:layout_alignParentEnd="false"
android:paddingLeft="5dp"
android:textSize="13dp"
android:paddingBottom="4dp"
android:singleLine="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/finchat_image"
android:layout_alignBottom="#+id/finchat_image" />
</RelativeLayout>
</android.support.v7.widget.CardView>
The usual way to have a chat between two people is to model that chat room in your database:
ChatRooms
ChatRoomBetweenUser1AndUser2
-KLM.......24
name: "User One"
uid: "uidOfUser1"
text: "Hello there. This is your friend User One"
-KMN.......35
name: "User Two"
uid: "uidOfUser2"
text: "Hello User One, this is User Two. Over"
That way you only need to load data from one location and need only one RecyclerView.
For more information on how to efficiently model chat rooms names for this scenario, see Best way to manage Chat channels in Firebase.
To get a good start on building a chat app, follow the Firebase Codelab for Android.
For a good introduction into modeling your data as your app needs it, see this article on NoSQL data modeling.

Use Glide to Show Large Vector Drawable on Lollipop and above Devices

I'm able to use BumpTech Glide to show a large Vector Drawable on pre-lollipop devices but unable to do so on lollipop and above...The activity starts but the Imageview is not shown.
Here is the layout file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
android:background="#FF5722"
tools:context=".Main.SplashScreen2.SplashScreen2">
<ImageView
android:id="#+id/imageViewSplashScreen2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="#string/image_of_ahilya_ghat_river_bank_of_varanasi" />
</FrameLayout>
here is the java file
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.example.raviseth.searchviewtrials.Main.MainActivityListViewPage.activities.MainActivity;
import com.example.raviseth.searchviewtrials.R;
import uk.co.senab.photoview.PhotoViewAttacher;
public class SplashScreen2 extends AppCompatActivity {
FloatingActionButton fabSplashScreen2;
ImageView imageViewSpashScreen2;
PhotoViewAttacher photoViewAttacher = null;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splashsreen2);
imageViewSpashScreen2 = (ImageView) findViewById(R.id.imageViewSplashScreen2);
if (imageViewSpashScreen2 != null) {
photoViewAttacher = new PhotoViewAttacher(imageViewSpashScreen2);
Glide.with(getApplicationContext())
.load(R.drawable.ghat)
.into(imageViewSpashScreen2);
photoViewAttacher.update();
}
}
}

List Crashes App when updated

I'm trying to get a ListView to show the contents of a simple array but my program crashes at the setAdapeter line. As I understand this is supposed to be because the final value comes out as null but I don't see why that would be the case or how to fix it. I have already tried using ArrayAdapeter instead as well as catching the null exception with a try block. The former changes nothing and the latter simply shows a blank activity with no list to speak of. Please help.
Here's Main Activity
package ballton.fowdeckbuilder;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ArrayAdapter;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnDecks = (Button) (findViewById(R.id.btnDecks));
Button btnCards = (Button) (findViewById(R.id.btnCards));
btnDecks.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, DeckCatalogue.class));
}
});
btnCards.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, CardCatalogue.class));
}
});
}
}
Here's the activity with the Problem
package ballton.fowdeckbuilder;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
public class DeckCatalogue extends AppCompatActivity {
ListView Ldecks;
String TAG = "TAG";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_deck_catalogue);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Ldecks = (ListView) (findViewById(R.id.DeckList));
String Decks[] = new String[] {"Faria","Melgis"};
ListAdapter feed = (new ArrayAdapter<String>(this, R.layout.show_deck, Decks));
Ldecks.setAdapter(feed);
}
}
Here's the Layout for that activity
<?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"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="ballton.fowdeckbuilder.DeckCatalogue"
tools:showIn="#layout/activity_deck_catalogue">
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/DeckList"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
And Here's the layout XML I use for the list times
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/Deck" />
</LinearLayout>
Use this code instead of yours:
ListAdapter feed = (new ArrayAdapter<String>(this, R.layout.show_deck, R.id.Deck, Decks));
This happened because you must supply the resource ID (as your xml: R.id.Deck) for the TextView you used for ListView.

Categories

Resources