Why my spinner unable to display outcome?

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

36 Replies - 3486 Views - Last Post: 29 October 2015 - 10:18 PM

#1 minseungjin   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 65
  • Joined: 11-October 15

Why my spinner unable to display outcome?

Posted 28 October 2015 - 02:33 AM

Why is it my code is unable to display the spinner? My textview works fine but the spinner unable to work. I have already enter the information for the database

NearablesDemoActivity.java

private void displayCurrentNearableInfo() {

        stickerdb = new Database_sticker(this);
        dbRow = stickerdb.getResult(currentNearable.identifier);
        dbRow.getId();
        dbRow.getIdentifier();
        //dbRow.getSa();
        //dbRow.getCa();
       
        String desc = dbRow.getDesc().toString();
        String sa = dbRow.getSa().toString();
        String ca = dbRow.getCa().toString();
        String coo = dbRow.getCoo().toString();
        String sm = dbRow.getSm().toString();
        String price = dbRow.getPrice().toString();

        //Set the text to the TextView
        Desc.setText(desc);
        SA.setText(sa);
        CA.setText(ca);
        COO.setText(coo);
        SM.setText(sm);
        Price.setText(price);
    }


ListNearablesActivity.java

private AdapterView.OnItemClickListener createOnItemClickListener() {
       return new AdapterView.OnItemClickListener() {
           @Override
           public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
               if (getIntent().getStringExtra(EXTRAS_TARGET_ACTIVITY) != null){
                   try {
                       Class<?> clazz = Class.forName(getIntent().getStringExtra(EXTRAS_TARGET_ACTIVITY));
                       Intent intent = new Intent(ListNearablesActivity.this, clazz);
                       intent.putExtra(EXTRAS_NEARABLE, adapter.getItem(position));
                       startActivity(intent);
                   } //close for try
                   catch (ClassNotFoundException e) {
                       Log.e(TAG, "Finding class by name failed", e);
                   } //close for catch (ClassNotFoundException e)
               } //close for getintent.getStringExtra()
           } //close for public void onitemclick
       };   //close for return new adapterview
   }  //close for private adapter


Is This A Good Question/Topic? 0
  • +

Replies To: Why my spinner unable to display outcome?

#2 EndLessMind   User is offline

  • Android Expert
  • member icon

Reputation: 273
  • View blog
  • Posts: 1,252
  • Joined: 13-March 09

Re: Why my spinner unable to display outcome?

Posted 28 October 2015 - 02:46 AM

You need to post the complete code for the acitivty in which you want to display the Spinner. :)
Was This Post Helpful? 1
  • +
  • -

#3 minseungjin   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 65
  • Joined: 11-October 15

Re: Why my spinner unable to display outcome?

Posted 28 October 2015 - 05:44 PM

Hi, I have pasted the full code for NearablesDemoActivity.java below
NearablesDemoActivity.java
package sg.edu.nyp.stickers.activities;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;

import com.estimote.sdk.BeaconManager;
import com.estimote.sdk.Nearable;

import java.util.List;

import sg.edu.nyp.stickers.R;
import sg.edu.nyp.stickers.activities.ratingbar.RatingBar_main;

/**
 * Created by bhjxheng on 10/21/2015.
 */
public class NearablesDemoActivity extends BaseActivity {

    private static final String TAG = NearablesDemoActivity.class.getSimpleName();

    private Nearable currentNearable;
    private BeaconManager beaconManager;
    private String scanId;

    TextView Desc, COO, SM, Price, SA, CA;  //description, country of origin, shoe model, price, size avail, colours avail
    Spinner spinnerDropDown;  //for size available
    String[] size = {};                   //for size available
    Spinner spinnerDropDown2;   //for colours available
   String[] colour = {};                      //for colours available
    Button btnRating;  //for button
    private Database_sticker stickerdb;
    Sresult dbRow;


    @Override
    protected int getLayoutResId() {
        return R.layout.nearable_demo;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.nearable_demo);
        currentNearable = getIntent().getExtras().getParcelable(ListNearablesActivity.EXTRAS_NEARABLE);


        beaconManager = new BeaconManager(this);

        Desc = (TextView) findViewById(R.id.textview1);   //for description

        // Get reference of SpinnerView from layout/nearable_demo.xml
        spinnerDropDown = (Spinner) findViewById(R.id.spinner1);  //For size available
        ArrayAdapter<String> adapter= new ArrayAdapter<>
                (this,android.R.layout.simple_spinner_dropdown_item ,size);  //for size available
        spinnerDropDown.setAdapter(adapter);

        spinnerDropDown2 = (Spinner) findViewById(R.id.spinner2);//for colours available
        ArrayAdapter<String> adapter1= new ArrayAdapter<>
                (this,android.R.layout.simple_spinner_dropdown_item ,colour); //for colours available
        spinnerDropDown2.setAdapter(adapter1);

        COO = (TextView) findViewById(R.id.textview2);//for country of origin
        SM = (TextView) findViewById(R.id.textview3); //for shoe model
        Price = (TextView) findViewById(R.id.textview4); //for price

        displayCurrentNearableInfo();


        toolbar = (Toolbar) findViewById(R.id.toolbar);
        toolbar.setNavigationIcon(R.drawable.ic_action_navigation_arrow_back);
        toolbar.setTitle(getTitle());
        toolbar.setNavigationonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View v) {
                onBackPressed();
            }
        });

        btnRating=(Button)findViewById(R.id.rd);

        btnRating.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View v) {
                // TODO Auto-generated method stub
                Intent pageforRatingBar = new Intent(getApplicationContext(), RatingBar_main.class);
                startActivity(pageforRatingBar);
            }
        });
    }

    @Override
    protected void onresume() {
        super.onresume();
        beaconManager.setNearableListener(new BeaconManager.NearableListener() {
            @Override
            public void onNearablesDiscovered(List<Nearable> nearables) {
                updateCurrentNearable(nearables);
                displayCurrentNearableInfo();

            }
        });

        beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
            @Override
            public void onServiceReady() {
                scanId = beaconManager.startNearableDiscovery();
            }
        });
    }

    @Override
    protected void onstop() {
        beaconManager.disconnect();
        super.onstop();
    }

    private void displayCurrentNearableInfo() {

        stickerdb = new Database_sticker(this);
        dbRow = stickerdb.getResult(currentNearable.identifier);
        dbRow.getId();
        dbRow.getIdentifier();
        //dbRow.getSa();
        //dbRow.getCa();

        String desc = dbRow.getDesc().toString();
        String sa = dbRow.getSa().toString();
        String ca = dbRow.getCa().toString();
        String coo = dbRow.getCoo().toString();
        String sm = dbRow.getSm().toString();
        String price = dbRow.getPrice().toString();

        //Set the text to the TextView
        Desc.setText(desc);
        SA.setText(sa);
        CA.setText(ca);
        COO.setText(coo);
        SM.setText(sm);
        Price.setText(price);
    }

    private void updateCurrentNearable(List<Nearable> nearables) {
        for (Nearable nearable : nearables) {
            if (nearable.equals(currentNearable)) {
                currentNearable = nearable;
            }
        }
    }
}


Was This Post Helpful? 0
  • +
  • -

#4 EndLessMind   User is offline

  • Android Expert
  • member icon

Reputation: 273
  • View blog
  • Posts: 1,252
  • Joined: 13-March 09

Re: Why my spinner unable to display outcome?

Posted 28 October 2015 - 06:19 PM

From what I can see you're not adding any items to the Spinners.
Both arrays (size and colour) are empty.


To test, change String[] size = { };
to String[] size = { "Some size", "some other size", "a third size" };

If the size-spinner now that contains items, then we know it works.

After that, you'll need to fill the arrays with items from your data-source (or how ever you like it).
Was This Post Helpful? 1
  • +
  • -

#5 minseungjin   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 65
  • Joined: 11-October 15

Re: Why my spinner unable to display outcome?

Posted 28 October 2015 - 06:29 PM

But by doing this: change String[] size = { };
to String[] size = { "Some size", "some other size", "a third size" }; Somehow will be like hard coding and I want to be able to enter the information manually through another application downloaded in playstore using asqlite

Any suggestions to fill the arrays with items from your data-source
Was This Post Helpful? 0
  • +
  • -

#6 EndLessMind   User is offline

  • Android Expert
  • member icon

Reputation: 273
  • View blog
  • Posts: 1,252
  • Joined: 13-March 09

Re: Why my spinner unable to display outcome?

Posted 28 October 2015 - 06:52 PM

Yes, the data will be hardcoded, but it's just for testing.

A simple way to add the sized to your database would be to create new column (field) to hold the sizes as string.
They should be separated by a specific char like a "," so you can just split the string at that char and end up with a String-array where each string represent a single size.

This is not the best way to do it.
The best way would be to make a new database table, that has 3 fields
id (key, auto increase), size, product id.

If the product tables looks like this

 -------------------------------
 |  id  | product name | price |
 -------------------------------
 |  1   |  Shoe-1      | $30   |
 |  2   |  Shoe-2      | $25   |
 |  3   |  Shoe-3      | $70   |
 -------------------------------




Then the size-table would look like this

 -------------------------------
 |  id  |  size  |  productID  |
 -------------------------------
 |  1   |   4    |      1      |
 |  2   |   4.5  |      1      |
 |  3   |   5    |      1      |
 |  4   |   5.5  |      1      |
 |  5   |   6    |      1      |
 |  6   |   6.5  |      1      |
 |  7   |   7    |      1      |
 |  8   |   7.5  |      1      |
 |  9   |   6.5  |      2      |
 |  10  |   7    |      2      |
 |  11  |   8    |      2      |
 |  12  |   9    |      2      |
 |  13  |   10.5 |      2      |
 -------------------------------



productID tells you what product we're referring to and is the value of the 'id' column for the product-table.

To get all the availabe sizes for a product, you get the value of the 'id' column from the product-table and query all rows that has the same value in productID.

Example:
 SELECT * FROM shoe_size WHERE shoe_size.productID = '2' ORDER BY shoe_size.id ASC 


That would return data like this

 -------------------------------
 |  id  |  size  |  productID  |
 -------------------------------
 |  9   |   6.5  |      2      |
 |  10  |   7    |      2      |
 |  11  |   8    |      2      |
 |  12  |   9    |      2      |
 |  13  |   10.5 |      2      |
 -------------------------------




But for now, let's just test that the adapters are working.
When they're working, then you can move over to adding the data that will be loaded late.

To be able to modify the sql-database from an other app, the devices needs to be rooted or the database need to be placed on the internal or external storage.
When adding the database to the project-folders in Eclipse/Android Studio (or what ever you're using to write the app), the database-file will be placed in the apps private folder and can only be accessed by that app unless the devices is rooted.

This post has been edited by EndLessMind: 28 October 2015 - 06:53 PM

Was This Post Helpful? 1
  • +
  • -

#7 minseungjin   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 65
  • Joined: 11-October 15

Re: Why my spinner unable to display outcome?

Posted 28 October 2015 - 06:55 PM

I have rooted my tablet, the adapter is working, what is the code I have to add to my NearablesDemoActivity.java. I have 2 spinner, one is for colours available, one is for size available

This post has been edited by minseungjin: 28 October 2015 - 06:57 PM

Was This Post Helpful? 0
  • +
  • -

#8 EndLessMind   User is offline

  • Android Expert
  • member icon

Reputation: 273
  • View blog
  • Posts: 1,252
  • Joined: 13-March 09

Re: Why my spinner unable to display outcome?

Posted 28 October 2015 - 07:07 PM

As I'm not going to do all the work for you, I'll just sum up what needs to be done.

To add the new table (for shoe sizes), I would recommend to use an sql-editor to make it easier.
But if you don't want to do that, then you can just run this query (should work, not tested)
CREATE TABLE shoe_size ( id int IDENTITY(1,1) PRIMARY KEY, size varchar(255), productID int(11) )

After that you need to write code that execute this query (should work directly)

SELECT * FROM shoe_size WHERE shoe_size.productID = '" + prodID + "' ORDER BY shoe_size.id ASC

prodID should be the variable you pass to the function that execute the query.
It should (as said before) be the 'id'-value of the product in the product-table of your database.


From the results of the query, you want to grap the size-column and add to a array.
This array will then be set to the spinners adapter.
Was This Post Helpful? 1
  • +
  • -

#9 minseungjin   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 65
  • Joined: 11-October 15

Re: Why my spinner unable to display outcome?

Posted 28 October 2015 - 07:10 PM

I really don't understand how to do it, can you please help me :helpsmilie:
Was This Post Helpful? 0
  • +
  • -

#10 EndLessMind   User is offline

  • Android Expert
  • member icon

Reputation: 273
  • View blog
  • Posts: 1,252
  • Joined: 13-March 09

Re: Why my spinner unable to display outcome?

Posted 28 October 2015 - 07:31 PM

Your app is already fetching data from the database, correct?
If so, then you have that bit nailed. So you only need to expand it with a new function that
executes an other query to get data from the other table.


To create the new table, you need to just make an other function that executes an different query. As you don't need to to fetch data, you only need to execute the query and the you're done.
This function show be run every time you start the app.

Here is a better version of the query, that will only create the table if it does not already exist
CREATE TABLE IF NOT EXISTS shoe_size ( id int IDENTITY(1,1) PRIMARY KEY, size varchar(255), productID int(11) )


Again, if you're already fetching data from the sql-database, then it should be very simple to just create 2 new similar functions to the one you're already using.
One for executing the above query to create the table, and the other for fetching data from that table.

This post has been edited by EndLessMind: 28 October 2015 - 07:45 PM

Was This Post Helpful? 1
  • +
  • -

#11 minseungjin   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 65
  • Joined: 11-October 15

Re: Why my spinner unable to display outcome?

Posted 28 October 2015 - 07:41 PM

Sorry I'm just confused, I hope you can help me with the coding, because even after the tips you have given me, I have no idea what to do, sorry to be a burden
Was This Post Helpful? 0
  • +
  • -

#12 EndLessMind   User is offline

  • Android Expert
  • member icon

Reputation: 273
  • View blog
  • Posts: 1,252
  • Joined: 13-March 09

Re: Why my spinner unable to display outcome?

Posted 28 October 2015 - 07:50 PM

Lets take it step by step.

First, i'm guessing that Database_sticker handles the connection to the sql-database, Correct?

It contains the function getResult that returns a Sresult.
Please post the code for the Database_sticker class
Was This Post Helpful? 1
  • +
  • -

#13 minseungjin   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 65
  • Joined: 11-October 15

Re: Why my spinner unable to display outcome?

Posted 28 October 2015 - 07:55 PM

Hi this is my database java

public class Database_sticker extends SQLiteOpenHelper {

    private static final int DATABASE_VERSION = 2;
    private static final String DATABASE_NAME = Environment.getExternalStorageDirectory().toString() + "/sresult.db";
    private static final String TABLE_SRESULT = "Sresult";
    private static final String KEY_ID = "id";   /* Inner class that defines the table contents */
    private static final String KEY_IDENTIFIER = "identifier";
    private static final String KEY_DESC = "desc";
    private static final String KEY_SA = "sa";
    private static final String KEY_CA = "ca";
    private static final String KEY_COO = "coo";
    private static final String KEY_SM = "sm";
    private static final String KEY_PRICE = "price";

    public Database_sticker(Context context){
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    //creating Tables
    @Override
    public void onCreate(SQLiteDatabase db){
        String CREATE_SRESULTS_TABLE = "CREATE TABLE " + TABLE_SRESULT + "(" + KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + KEY_IDENTIFIER +
                " TEXT," + KEY_DESC + " TEXT," + KEY_SA + " TEXT," + KEY_CA + " TEXT," + KEY_COO + " TEXT," + KEY_SM + " TEXT," + KEY_PRICE + " REAL" + ")";
        db.execSQL(CREATE_SRESULTS_TABLE); //create sql sresults table
    }

    //upgrading database
    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion){
        //drop older table if existed
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_SRESULT);
        //create tables again
        onCreate(db);
    }

     public Sresult getResult(String identifier) {
        String selectQuery = "SELECT * FROM " + TABLE_SRESULT + " WHERE " + KEY_IDENTIFIER + "='" + identifier + "'";
        SQLiteDatabase db = this.getWritableDatabase();   //open database
        Cursor cursor = db.rawQuery(selectQuery, null);
        //looping through all rows and adding to list
        Sresult sresult = new Sresult();
        if (cursor.moveToFirst()) {
            do {
                sresult.setId(Integer.parseInt(cursor.getString(0)));
                sresult.setIdentifier(cursor.getString(1));
                sresult.setDesc(cursor.getString(2));
                sresult.setSa(cursor.getString(3));
                sresult.setCa(cursor.getString(4));
                sresult.setCoo(cursor.getString(5));
                sresult.setSm(cursor.getString(6));
                sresult.setPrice(Float.parseFloat(cursor.getString(7)));
            } while (cursor.moveToNext());
        }
        return sresult;
    }

}

Was This Post Helpful? 0
  • +
  • -

#14 EndLessMind   User is offline

  • Android Expert
  • member icon

Reputation: 273
  • View blog
  • Posts: 1,252
  • Joined: 13-March 09

Re: Why my spinner unable to display outcome?

Posted 28 October 2015 - 08:24 PM

So we start with added the strings for the new table-name and the column-names (if they don't already exist)
We're going to use the same code-structure to keep it clean

The name of the new table will be 'shoe_size' and the names for the columns will be 'id', 'size' and 'productID'.
As 'id' is already defined (KEY_ID) we don't need define yet an other string with the same content.

So, we add there strings
private static final String KEY_SIZE = "size";
private static final String KEY_PRODUCTID = "productID";
private static final String TABLE_SHOE_SIZE = "shoe_size"; 



Great! Now we need to create the new table if needed.
So we make a new function that will execute the query that creates the table. Are you with me so far?

This function looks like this
private void createSizeTable() {
	String CREATE_SIZE_TABLE_QUERY = "CREATE TABLE IF NOT EXISTS " + TABLE_SHOE_SIZE + "(" + KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + KEY_SIZE +
		 " varchar(255)," + KEY_PRODUCTID + " int(11) )";
	SQLiteDatabase db = this.getWritableDatabase();   //open
	db.execSQL(CREATE_SIZE_TABLE_QUERY); //create sql table
} 


This will create the new table for us.
As you might notice, the function is private. This is because we only call it internally inside the "onCreate" void of the Database_sticker class.
So you need to add createSizeTable(); to the onCreate-method of the Database_sticker class.

Next we need to create a function that executes a query to fetch the sizes.
This function will only return an array of strings, as that's all we need when displaying the data in the spinner.

This is what that functions looks like
public String[] getSizes(int id) {
		String selectQuery = "SELECT * FROM " + TABLE_SHOE_SIZE + " WHERE " + KEY_productid + "='" + id + "'";
		SQLiteDatabase db = this.getWritableDatabase();   //open database
        Cursor cursor = db.rawQuery(selectQuery, null);
		ArrayList<String> sizes = new ArrayList<String>();
		if (cursor.moveToFirst()) {
            do {
                sizes.add(cursor.getString(1));
            } while (cursor.moveToNext());
        }
		return sizes.toArray(new String[sizes.size()]);
	}


Now, back in the NearablesDemoActivity class, we need to modify displayCurrentNearableInfo and onCreate.

First we modify displayCurrentNearableInfo to look like this
private void displayCurrentNearableInfo() {

        stickerdb = new Database_sticker(this);
        dbRow = stickerdb.getResult(currentNearable.identifier);
        //dbRow.getId();
        //dbRow.getIdentifier();

		size = stickerdb.getSizes(dbRow.getId()); //Fetch the sized from the database
		
		ArrayAdapter<String> adapter= new ArrayAdapter<>(this,android.R.layout.simple_spinner_dropdown_item ,size);  //for size available
        spinnerDropDown.setAdapter(adapter);
		

        //Set the text to the TextView
        Desc.setText(dbRow.getDesc().toString());
        SA.setText(dbRow.getSa().toString());
        CA.setText(dbRow.getCa().toString());
        COO.setText(dbRow.getCoo().toString());
        SM.setText(dbRow.getSm().toString());
        Price.setText(dbRow.getPrice().toString());
    }


And in the onCreate we just remove the adapters.

So, we change this
  // Get reference of SpinnerView from layout/nearable_demo.xml
        spinnerDropDown = (Spinner) findViewById(R.id.spinner1);  //For size available
        ArrayAdapter<String> adapter= new ArrayAdapter<>
                (this,android.R.layout.simple_spinner_dropdown_item ,size);  //for size available
        spinnerDropDown.setAdapter(adapter);

        spinnerDropDown2 = (Spinner) findViewById(R.id.spinner2);//for colours available
        ArrayAdapter<String> adapter1= new ArrayAdapter<>
                (this,android.R.layout.simple_spinner_dropdown_item ,colour); //for colours available
        spinnerDropDown2.setAdapter(adapter1);



to this
        // Get reference of SpinnerView from layout/nearable_demo.xml
        spinnerDropDown = (Spinner) findViewById(R.id.spinner1);  //For size available
        spinnerDropDown2 = (Spinner) findViewById(R.id.spinner2);//for colours available


Because there is really no reason to set the adapters when we know they are empty.

Note: I've written this code in Notepad++, so I've not tested it. You WILL have to add some imports for ArrayList, the other should work right out of the box!
Was This Post Helpful? 1
  • +
  • -

#15 minseungjin   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 65
  • Joined: 11-October 15

Re: Why my spinner unable to display outcome?

Posted 28 October 2015 - 08:41 PM

Hi I add in your codes and still got error :no:


10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: FATAL EXCEPTION: main
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: Process: sg.edu.nyp.stickers, PID: 12306
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{sg.edu.nyp.stickers/sg.edu.nyp.stickers.activities.NearablesDemoActivity}: java.lang.IllegalStateException: getDatabase called recursively
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2345)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2407)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.app.ActivityThread.access$800(ActivityThread.java:149)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1324)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.os.Looper.loop(Looper.java:211)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5321)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1016)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: Caused by: java.lang.IllegalStateException: getDatabase called recursively
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:203)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at sg.edu.nyp.stickers.activities.Database_sticker.createSizeTable(Database_sticker.java:57)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at sg.edu.nyp.stickers.activities.Database_sticker.onCreate(Database_sticker.java:40)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at sg.edu.nyp.stickers.activities.Database_sticker.onUpgrade(Database_sticker.java:51)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:256)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at sg.edu.nyp.stickers.activities.Database_sticker.getResult(Database_sticker.java:76)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at sg.edu.nyp.stickers.activities.NearablesDemoActivity.displayCurrentNearableInfo(NearablesDemoActivity.java:121)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at sg.edu.nyp.stickers.activities.NearablesDemoActivity.onCreate(NearablesDemoActivity.java:67)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5933)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2407) 
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.app.ActivityThread.access$800(ActivityThread.java:149) 
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1324) 
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) 
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.os.Looper.loop(Looper.java:211) 
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5321) 
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372) 
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1016) 
10-29 11:40:33.979 12306-12306/sg.edu.nyp.stickers E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811) 
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3