lundi 29 juin 2015

Getting data from an application in SDK and storing in Database

I have created a sdk to get the name of button clicked so that i can use it in multiple applications and get the name of button in sdk and store it in Database(SQLite).

I have successfully got the value in my sdk from application but the problem i m facing is how to store it in database. it is giving an exception(screen shot of logcat attached).It shows the error while passing the data from my sdk's main class to Database's class

Code i used to transfer data in my main class of sdk is :

public void onClick(View v){
        //String s=(String) ((TextView) v).getText();
        buttonText = ((Button)v).getText().toString();
        Intent intt=new Intent(MainActivity.this,DatabaseHelper.class);
        Bundle bundle=new Bundle();
        bundle.putString(EVENT_FIELD, buttonText);
        intt.putExtras(bundle);
        startActivity(intt);
    }

Code i used in my Database class of sdk is:

    protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                
                Intent intent=getIntent();
                Bundle extras=intent.getExtras();
                String eventTextDB=extras.getString(EVENT_FIELD1);
                
                 
                 
                 
        

    }

Aucun commentaire:

Enregistrer un commentaire