For some reason, I am unable to access the ActivityChooserModel
class in my Android activity. I am trying to access it as follows:
ActivityChooserModel dataModel = ActivityChooserModel.get(this, ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
But when I try to build the project I get the following:
cannot find symbol class ActivityChooserModel
I have attempted using both of the following imports, but neither of them works:
import android.widget.ActivityChooserModel;
import android.support.v7.internal.widget.ActivityChooserModel;
This is especially frustrating because in Android Studio I can open ActivityChooserModel.java
and I can see that it is a public class. My activity is using a ShareActionProvider
and importing it with no problems, and when I browse through the SDK source I can clearly view both that class and ActivityChooserModel
so I have no idea why I'm not able to access it.
Here is a snippet of my build.gradle
, although I'm not sure if related:
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
}
}
Thanks a lot!
This compiled for me:
import android.support.v7.internal.widget.ActivityChooserModel;
import android.support.v7.widget.ShareActionProvider;
public class MainActivity extends AppCompatActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ActivityChooserModel dataModel = ActivityChooserModel.get(this, ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
}
build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:22.1.1"
}