•      Sign In
• Create Account

### #Actualjellomaj

Posted 08 April 2013 - 11:31 AM

So I'm trying to make AOuth work in android for twitter. Here's the code I'm having errors with in my activity:

@Override
public Loader<OAuthConsumer> onCreateLoader(int id, Bundle arg1) {

consumerLoader = new getCommonsHttpOAuthConsumer(); //consumerLoader is declared in the activity as "private Loader<OAuthConsumer> consumerLoader;"
return consumerLoader;
// After this method you're going in loadInBackground()
}


Here's the code for my asyncTaskLoader:

class getCommonsHttpOAuthConsumer extends AsyncTaskLoader<OAuthConsumer>{

public getCommonsHttpOAuthConsumer(Context context) {
super(context);
// TODO Auto-generated constructor stub
}

@Override
public OAuthConsumer loadInBackground() {
// TODO Auto-generated method stub

return new CommonsHttpOAuthConsumer(Constants.CONSUMER_KEY, Constants.CONSUMER_SECRET);
}

}


This is a 2 part question. 1st question: I get an error when I use import android.support.v4.app.LoaderManager The error is on Loader<OAuthConsumer>. It says "The return type is incompatible with LoaderManager.LoaderCallbacks.onCreateLoader(int, Bundle)". But the error goes away if I use import android.app.LoaderManager instead. My question is: Should I try to fix the error with using the support library, so that more devices will be compatible with my app? If yes, how can I fix that error?

2nd question: No matter what import I use, I get an error on new getCommonsHttpOAuthConsumer(); The error says: "Type mismatch: cannot convert from getCommonsHttpOAuthConsumer to Loader". What am I doing wrong?

### #2jellomaj

Posted 08 April 2013 - 11:14 AM

So I'm trying to make AOuth work in android for twitter. Here's the code I'm having errors with in my activity:

@Override
public Loader<OAuthConsumer> onCreateLoader(int id, Bundle arg1) {

consumerLoader = new getCommonsHttpOAuthConsumer(); //consumerLoader is declared in the activity as "private Loader<OAuthConsumer> consumerLoader;"
return consumerLoader;
// After this method you're going in loadInBackground()
}


Here's the code for my asyncTaskLoader:

class getCommonsHttpOAuthConsumer extends AsyncTaskLoader<OAuthConsumer>{

public getCommonsHttpOAuthConsumer(Context context) {
super(context);
// TODO Auto-generated constructor stub
}

@Override
public OAuthConsumer loadInBackground() {
// TODO Auto-generated method stub

return new CommonsHttpOAuthConsumer(Constants.CONSUMER_KEY, Constants.CONSUMER_SECRET);
}

}


This is a 2 part question. 1st question: I get an error when I use import android.support.v4.app.LoaderManager The error is on Loader<OAuthConsumer>. It says "The return type is incompatible with LoaderManager.LoaderCallbacks.onCreateLoader(int, Bundle)". But the error goes away if I use import android.app.LoaderManager instead. My question is: Should I try to fix the error with using the support library, so that more devices will be compatible with my app? If yes, how can I fix that error?

2nd question: No matter what import I use, I get an error on new getCommonsHttpOAuthConsumer(); The error says: "Type mismatch: cannot convert from getCommonsHttpOAuthConsumer to Loader". What am I doing wrong?

### #1jellomaj

Posted 08 April 2013 - 11:13 AM

So I'm trying to make AOuth work in android for twitter. Here's the code I'm having errors with in my activity:

@Override
public Loader<OAuthConsumer> onCreateLoader(int id, Bundle arg1) {

consumerLoader = new getCommonsHttpOAuthConsumer(); //consumerLoader is declared in the activity as "private Loader<OAuthConsumer> consumerLoader;"
return consumerLoader;
// After this method you're going in loadInBackground()
}


Here's the code for my asyncTaskLoader:

class getCommonsHttpOAuthConsumer extends AsyncTaskLoader<OAuthConsumer>{

public getCommonsHttpOAuthConsumer(Context context) {
super(context);
// TODO Auto-generated constructor stub
}

@Override
public OAuthConsumer loadInBackground() {
// TODO Auto-generated method stub

return new CommonsHttpOAuthConsumer(Constants.CONSUMER_KEY, Constants.CONSUMER_SECRET);
}

}


This is a 2 part question. 1st question: I get an error when I use import android.support.v4.app.LoaderManager The error is on Loader<OAuthConsumer>. It says "The return type is incompatible with LoaderManager.LoaderCallbacks.onCreateLoader(int, Bundle)". But the error goes away if I use import android.app.LoaderManager instead. My question is: Should I try to fix the error with using the support library, so that more devices will be compatible with my app? If yes, how can I fix that error?

2nd question: No matter what import I use, I get an error on new getCommonsHttpOAuthConsumer(); The error says: "Type mismatch: cannot convert from getCommonsHttpOAuthConsumer to Loader". What am I doing wrong?

PARTNERS