Android - try to connect to Dropbox API version 2 - java

I'm try to connect to Dropbox api version 2 via Android Studio but I get this exception:
04-27 23:49:33.356 6482-6482/com.example.user.trackyournevi
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.user.trackyournevi, PID: 6482
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.user.trackyournevi/com.example.user.trackyournevi.Drop
boxActivity}: android.content.ActivityNotFoundException: Unable to find
explicit activity class
{com.example.user.trackyournevi/com.dropbox.client2.android.AuthActivity};
have you declared this activity in your AndroidManifest.xml?
My Dropbox Activity:
public class DropboxActivity extends AppCompatActivity implements
View.OnClickListener {
private LinearLayout container;
private boolean isUserLoggedIn;
private Button btnLogin;
private Button btnUpload;
private Button btnDownload;
private DropboxAPI<AndroidAuthSession> mDropboxApi;
private final static String DROPBOX_FILE_DIR = "/TrackYourNevi/";
private static final int IMAGE_GALLERY_REQUEST = 20;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dropbox);
loggedIn(false);
//callback method
initializeSession();
}
private void initializeSession() {
//store app key and secret key
AppKeyPair appKeys = new AppKeyPair(getResources().getString(R.string.DROPBOX_APP_KEY),
getResources().getString(R.string.DROPBOX_APP_SECRET));
AndroidAuthSession session = new AndroidAuthSession(appKeys);
//Pass app key pair to new DropboxApi object
mDropboxApi = new DropboxAPI<AndroidAuthSession>(session);
//start session
mDropboxApi.getSession().startOAuth2Authentication(DropboxActivity.this);
}
#Override
public void onResume() {
super.onResume();
if(mDropboxApi.getSession().authenticationSuccessful()) {
try {
// Required to complete auth, sets the access token on the session
mDropboxApi.getSession().finishAuthentication();
String accessToken = mDropboxApi.getSession().getOAuth2AccessToken();
loggedIn(true);
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
}
#Override
public void onClick(View v) {
switch (v.getId()){
case R.id.dxbLoginButton:
if(isUserLoggedIn) {
mDropboxApi.getSession().unlink();
loggedIn(false);
} else
mDropboxApi.getSession().startOAuth2Authentication(DropboxActivity.this);
break;
case R.id.dxbUploadButton:
//invoke the image gallery using an implict intent
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
//Where do we want to find the data
File pictureDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
String pictureDitrectoryPath = pictureDirectory.getPath() + "/" + getResources().getString(R.string.image_folder_name);
//Get URI representation
Uri data = Uri.parse(pictureDitrectoryPath);
//Set the data and type. get all images from jpg type
photoPickerIntent.setDataAndType(data, "image/jpg");
startActivityForResult(photoPickerIntent, IMAGE_GALLERY_REQUEST);
break;
case R.id.dxbDownloanButton:
break;
default:
break;
}
}
}
And my manifiest.xml contains the following data:
activity android:name=".DropboxActivity" android:launchMode="singleTask"
intent-filter
data android:scheme="db-key"
action android:name="android.intent.action.VIEW"
category android:name="android.intent.category.BROWSABLE"
category android:name="android.intent.category.DEFAULT"
intent-filter
activity
It looks like I defined everything as I saw in other tutorials but still it's not working.
Is someone see the problem and can help me?

Related

launch Camera causing crash Android

I followed this simple app AndroidScannerDemo which has two main button open camera and open gallery. The Camera is working fine on my phone API 19, but when I try to launch the camera on other devices or emulator the app crash.
From what I could understand this could be due to permission
Edit : Apparently this was asked here awhile ago as well but the issue remain
Wrong Update : the root problem coming from createImageFile method
I tried changing
//cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, tempFileUri); to
cameraIntent.putExtra(ScanConstants.OPEN_INTENT_PREFERENCE, preference);
I'm able to start the camera but I get crash right after taking picture
Update 2 : I'm trying following this article provided the answer below the only issue I'm using fragment
So How do I change this line
tempFileUri = FileProvider.getUriForFile(getActivity().getApplicationContext(),
"com.scanlibrary.provider", // As defined in Manifest
file);
to
tempFileUri = FileProvider.getUriForFile(PickImageFragment.this,
getString(R.string.file_provider_authority),
file); inside a fragment !
Wrong First argument PickImageFragment
EDIT : Changed openCamera() method inside PickImageFragment
What Im I missing ?
Stack trace
2019-11-29 23:45:05.750 27993-27993/com.nabeeltech.capturedoc E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.nabeeltech.capturedoc, PID: 27993
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nabeeltech.capturedoc/com.scanlibrary.ScanActivity}: java.lang.SecurityException: UID 10091 does not have permission to content://com.scanlibrary.provider/external_files/scanSample/IMG_20191129_224505.jpg [user 0]
Caused by: java.lang.SecurityException: UID 10091 does not have permission to content://com.scanlibrary.provider/external_files/scanSample/IMG_20191129_224505.jpg [user 0]
at com.scanlibrary.PickImageFragment.openCamera(PickImageFragment.java:131)
at com.scanlibrary.PickImageFragment.handleIntentPreference(PickImageFragment.java:79)
at com.scanlibrary.PickImageFragment.init(PickImageFragment.java:60)
at com.scanlibrary.PickImageFragment.onCreateView(PickImageFragment.java:50)
PickImageFragment
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.pick_image_fragment, null);
init();
return view;
}
private void init() {
cameraButton = (ImageButton) view.findViewById(R.id.cameraButton);
cameraButton.setOnClickListener(new CameraButtonClickListener());
galleryButton = (ImageButton)
view.findViewById(R.id.selectButton);
galleryButton.setOnClickListener(new GalleryClickListener());
if (isIntentPreferenceSet()) {
handleIntentPreference();
} else {
getActivity().finish();
}
}
private void handleIntentPreference() {
int preference = getIntentPreference();
if (preference == ScanConstants.OPEN_CAMERA) {
openCamera();
} else if (preference == ScanConstants.OPEN_MEDIA) {
openMediaContent();
}
}
public void openCamera() {
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
Uri tempFileUri = null;
File file = createImageFile();
boolean isDirectoryCreated = file.getParentFile().mkdirs();
Log.d("", "openCamera: isDirectoryCreated: " + isDirectoryCreated);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
tempFileUri = FileProvider.getUriForFile(getActivity().getApplicationContext(),
"com.scanlibrary.provider", // As defined in Manifest
file);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, tempFileUri);
} else {
tempFileUri = Uri.fromFile(file);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, tempFileUri);
}
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) {
cameraIntent.setClipData(ClipData.newRawUri("", tempFileUri));
cameraIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
}
startActivityForResult(cameraIntent, ScanConstants.START_CAMERA_REQUEST_CODE);
private File createImageFile() {
clearTempImages();
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new
Date());
File file = new File(ScanConstants.IMAGE_PATH, "IMG_" + timeStamp +
".jpg");
fileUri = Uri.fromFile(file);
return file;
}
private void clearTempImages() {
try {
File tempFolder = new File(ScanConstants.IMAGE_PATH);
for (File f : tempFolder.listFiles())
f.delete();
} catch (Exception e) {
e.printStackTrace();
}
}
ScanConstants
public class ScanConstants {
public final static int PICKFILE_REQUEST_CODE = 1;
public final static int START_CAMERA_REQUEST_CODE = 2;
public final static String OPEN_INTENT_PREFERENCE = "selectContent";
public final static String IMAGE_BASE_PATH_EXTRA = "ImageBasePath";
public final static int OPEN_CAMERA = 4;
public final static int OPEN_MEDIA = 5;
public final static String SCANNED_RESULT = "scannedResult";
public final static String IMAGE_PATH = Environment
.getExternalStorageDirectory().getPath() + "/scanSample";
public final static String SELECTED_BITMAP = "selectedBitmap";
}
You've written the code Fileprovider.getUriforFile which is fine, but have you declare the permissions required.
The only way to solve this is to grant permissions to all of the packages that might need it, like this:
List<ResolveInfo> resInfoList = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
for (ResolveInfo resolveInfo : resInfoList) {
String packageName = resolveInfo.activityInfo.packageName;
context.grantUriPermission(packageName, uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
If above doesn't solve issue i'd suggest to refer this article by Lorenzo Quiroli that solves this issue for older Android versions.
He discovered that you need to manually set the ClipData of the Intent and set the permissions for it, like so:
if ( Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP ) {
takePictureIntent.setClipData( ClipData.newRawUri( "", photoURI ) );
takePictureIntent.addFlags( Intent.FLAG_GRANT_WRITE_URI_PERMISSION|Intent.FLAG_GRANT_READ_URI_PERMISSION );
}

Unit Testing on a Xmpp Android app on Android Studio

I'm trying to code some unit test for some OnCreate() methode on my XMPP app on android Studio, the problem is that i have never done that and i'm a little bit lost.
Here is my methode :
public class ChatActivity extends AppCompatActivity {
private static final String TAG ="ChatActivity";
private String contactJid;
private ChatView mChatView;
private SendButton mSendButton;
private BroadcastReceiver mBroadcastReceiver;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat);
mChatView =(ChatView) findViewById(R.id.rooster_chat_view);
mChatView.setEventListener(new ChatViewEventListener() {
#Override
public void userIsTyping() {
//Here you know that the user is typing
}
#Override
public void userHasStoppedTyping() {
//Here you know that the user has stopped typing.
}
});
mSendButton = mChatView.getSendButton();
mSendButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
//Only send the message if the client is connected
//to the server.
if (RoosterConnectionService.getState().equals(RoosterConnection.ConnectionState.CONNECTED)) {
Log.d(TAG, "The client is connected to the server,Sending Message");
//Send the message to the server
Intent intent = new Intent(RoosterConnectionService.SEND_MESSAGE);
intent.putExtra(RoosterConnectionService.BUNDLE_MESSAGE_BODY,
mChatView.getTypedString());
intent.putExtra(RoosterConnectionService.BUNDLE_TO, contactJid);
sendBroadcast(intent);
//Update the chat view.
mChatView.sendMessage();
} else if (RoosterConnectionService.getState().equals(RoosterConnection.ConnectionState.DISCONNECTED)){
Toast.makeText(getApplicationContext(),
"Client not connected to server ,Message not sent!",
Toast.LENGTH_LONG).show();
}
}
});
Intent intent = getIntent();
contactJid = intent.getStringExtra("EXTRA_CONTACT_JID");
setTitle(contactJid);
}
My question is that i don't know how to proceed and what to put in my OnCreateTest() method and what to test, could anyone help please :(

DownloadImage when login

I've created an app where the user registers with his credentials and also uploads a profile picture. While logging the user enters his username,password and name of the image which he has uploaded. Till now the user is successfully able to register with his credentials along with his profile pic. I've stored the credentials of the user in the MySql while the image of the user is getting stored in the folder in the same server. Now when I'm trying to login, it gives me a NullPointerException and my app crashes. I don't know why this is happening, I've checked my code, I didn't find any error. I'm uploading it here. Please provide me with the answer. Thank you.
Login.java
public void onClick(View view) {
switch (view.getId()) {
case R.id.bLogin:
String username = etUsername.getText().toString();
String password = etPassword.getText().toString();
String name1=etimagen.getText().toString();
User user = new User(username, password,name1);
DownloadImage di=new DownloadImage(etimagen.getText().toString());
di.execute();
authenticate(user);
break;
case R.id.tvRegisterLink:
Intent registerIntent = new Intent(Login.this, Register.class);
startActivity(registerIntent);
break;
}
}
private void authenticate(User user) {
ServerRequests serverRequest = new ServerRequests(this);
serverRequest.fetchUserDataAsyncTask(user, new GetUserCallback() {
#Override
public void done(User returnedUser) {
if (returnedUser == null) {
showErrorMessage();
} else {
logUserIn(returnedUser);
}
}
});
}
private void showErrorMessage() {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(Login.this);
dialogBuilder.setMessage("Incorrect user details");
dialogBuilder.setPositiveButton("Ok", null);
dialogBuilder.show();
}
private void logUserIn(User returnedUser) {
userLocalStore.storeUserData(returnedUser);
userLocalStore.setUserLoggedIn(true);
startActivity(new Intent(this, MainActivity.class));
}
public class DownloadImage extends AsyncTask<Void, Void, Bitmap>
{
String name1;
public DownloadImage(String name1)
{
this.name1=name1;
}
#Override
protected Bitmap doInBackground(Void... arg0) {
String url=SERVER_ADDRESS + "pictures1/" + name1 + ".JPG";
try
{
URLConnection connection=new URL(url).openConnection();
connection.setConnectTimeout(1000*30);
connection.setReadTimeout(1000*30);
return BitmapFactory.decodeStream((InputStream) connection.getContent(),null,null);
}
catch(Exception e)
{
e.printStackTrace();
}
return null;
}
#Override
public void onPostExecute(Bitmap bitmap) {
super.onPostExecute(bitmap);
if(bitmap!=null)
{
MainActivity main=new MainActivity();
main.bitmap=bitmap;
main.image();
}
}
}
MainActivity.java
#Override
public void onClick(View v) {
switch(v.getId()){
case R.id.bLogout:
userLocalStore.clearUserData();
userLocalStore.setUserLoggedIn(false);
Intent loginIntent = new Intent(this, Login.class);
startActivity(loginIntent);
break;
}
}
#Override
protected void onStart() {
super.onStart();
if (authenticate() == true) {
displayUserDetails();
}
}
private boolean authenticate() {
if (userLocalStore.getLoggedInUser() == null) {
Intent intent = new Intent(this, Login.class);
startActivity(intent);
return false;
}
return true;
}
private void displayUserDetails() {
User user = userLocalStore.getLoggedInUser();
etUsername.setText(user.username);
etName.setText(user.name);
etAge.setText(user.age + "");
}
public Bitmap image() {
image2.setImageBitmap(bitmap);
return bitmap;
}
}
Error Log
09-05 15:39:34.179: E/AndroidRuntime(4236): FATAL EXCEPTION: main
09-05 15:39:34.179: E/AndroidRuntime(4236): Process: com.example.loginregister, PID: 4236
09-05 15:39:34.179: E/AndroidRuntime(4236): java.lang.NullPointerException
09-05 15:39:34.179: E/AndroidRuntime(4236): at com.example.loginregister.MainActivity.image(MainActivity.java:86)
09-05 15:39:34.179: E/AndroidRuntime(4236): at com.example.loginregister.Login$DownloadImage.onPostExecute(Login.java:132)
09-05 15:39:34.179: E/AndroidRuntime(4236): at com.example.loginregister.Login$DownloadImage.onPostExecute(Login.java:1)
09-05 15:39:34.179: E/AndroidRuntime(4236): at android.os.AsyncTask.finish(AsyncTask.java:632)
09-05 15:39:34.179: E/AndroidRuntime(4236): at android.os.AsyncTask.access$600(AsyncTask.java:177)
09-05 15:39:34.179: E/AndroidRuntime(4236): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
Replace your code with,
public Bitmap image() {
if(bitmap!=null)
image2.setImageBitmap(bitmap);
return bitmap;
}
Your bitmap object in null, that's why it is giving you NullPointerExcepition at line ,
image2.setImageBitmap(bitmap);
Let me know if it works for you...
And mark it as an answer so that it would be useful to others...
Firstly i assume you are a beginner for Android Development.
You are trying to download the user image and display it on MainActivity.
There is two issues with the architecture.
First
The below piece of code initiates two async request. There is no guarantee that the image request will complete after login or vice versa. I suggest you to place the image request inside MainActivity after ensuring the user has successfully logged in. Meaning, place it after authenticate(user) success.
User user = new User(username, password,name1);
DownloadImage di=new DownloadImage(etimagen.getText().toString());
di.execute();
authenticate(user);
Second
The below piece of code creates a new instance of MainActivity and tries to assigns the retrieved bitmap to ImageView. One must know that onCreate gets executed just before the activity is displayed. It wont be called when new MainActivity() is done. So there is no chance of image2 being set with a value. Which is why you are getting the error.
public void onPostExecute(Bitmap bitmap) {
super.onPostExecute(bitmap);
if(bitmap!=null)
{
MainActivity main=new MainActivity();
main.bitmap=bitmap;
main.image();
}
}
I assume since you want to set the image somewhere on MainActivity, you should make the image request inside MainActivity probably in onCreate.
Also this startActivity(new Intent(this, MainActivity.class)); in method login will start a new activity. This is completly different MainActivity instance from the one you are creating in onPostExecute.
Pass the image url via bundle extra to activity, retrieve it in onCreate, make the image call and display it on the imageView.
Hope this helps :) ::)

How to open browser in android app?

i'm doing a project where i have to call a browser via my android app, but when i call it, the app stops.
the code can be found here: https://github.com/coppetti/android-pulsometer
but for fast view, i have a "Pulsometro" class where
public void onPreviewFrame(byte[] data, Camera cam) {
...
Browser browser = new Browser();
browser.callBrowser(beats);
return;
...
}
and a Browser class where:
public class Browser extends Activity{
public void callBrowser(int beats){
String url = "http://www.higia.info/?q="+beats;
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
return;
}
}
There's a way to call a browser and my app doesn't breaks?
Try this:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onOpenWebBrowser(View v)
{
Intent webPageIntent = new Intent(Intent.ACTION_VIEW);
webPageIntent.setData(Uri.parse("https://www.google.co.in/"));
try {
startActivity(webPageIntent);
} catch (ActivityNotFoundException ex) {
}
}
Do not just randomly choose superclasses. Do not just create some subclass of Activity and expect it to work.
Move your callBrowser() method into some real Activity implementation, and get rid of Browser entirely.
Or, remove the superclass from Browser, have callBrowser() take a Context as a parameter, and call startActivity() on that Context.
Try this class. Call the callBrowser method and give it and Activity for the context parameter.
public class Browser{
public void callBrowser(Context context, int beats){
String url = "http://www.higia.info/?q="+beats;
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
context.startActivity(i);
}
}

Error:java.lang.NoClassDefFoundError

Sorry, It's a repetitive question, but i haven't find my answer yet.
To make a FileChooser in my Android application i used this. So I added 2 jar files in my Properties-> Java Build path( one of them is android-support-v4.jar and the other is a handmade library(afilechooser)), but when it comes to run i face with these errors in onResume() method.
1-Is it possible that there is a problem with libs?
2-What is your solution?
3-Is there any problem with the FileChooserActivity?
The class is:
public class FileChooserActivity extends FragmentActivity implements
OnBackStackChangedListener {
public static final String PATH = "path";
public static final String EXTERNAL_BASE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath();
private FragmentManager mFragmentManager;
private BroadcastReceiver mStorageListener = new BroadcastReceiver() {
#Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, R.string.storage_removed, Toast.LENGTH_LONG).show();
finishWithResult(null);
}
};
private String mPath;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.chooser);
mFragmentManager = getSupportFragmentManager();
mFragmentManager.addOnBackStackChangedListener(this);
if (savedInstanceState == null) {
mPath = EXTERNAL_BASE_PATH;
addFragment(mPath);
} else {
mPath = savedInstanceState.getString(PATH);
}
setTitle(mPath);
}
#Override
protected void onPause() {
super.onPause();
unregisterStorageListener();
}
#Override
protected void onResume() {
super.onResume();
registerStorageListener();
}
#Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(PATH, mPath);
}
#Override
public void onBackStackChanged() {
mPath = EXTERNAL_BASE_PATH;
int count = mFragmentManager.getBackStackEntryCount();
if (count > 0) {
BackStackEntry fragment = mFragmentManager
.getBackStackEntryAt(count - 1);
mPath = fragment.getName();
}
setTitle(mPath);
}
/**
* Add the initial Fragment with given path.
*
* #param path The absolute path of the file (directory) to display.
*/
private void addFragment(String path) {
FileListFragment explorerFragment = FileListFragment.newInstance(mPath);
mFragmentManager.beginTransaction()
.add(R.id.explorer_fragment, explorerFragment).commit();
}
/**
* "Replace" the existing Fragment with a new one using given path.
* We're really adding a Fragment to the back stack.
*
* #param path The absolute path of the file (directory) to display.
*/
private void replaceFragment(String path) {
FileListFragment explorerFragment = FileListFragment.newInstance(path);
mFragmentManager.beginTransaction()
.replace(R.id.explorer_fragment, explorerFragment)
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.addToBackStack(path).commit();
}
/**
* Finish this Activity with a result code and URI of the selected file.
*
* #param file The file selected.
*/
private void finishWithResult(File file) {
if (file != null) {
Uri uri = Uri.fromFile(file);
setResult(RESULT_OK, new Intent().setData(uri));
finish();
} else {
setResult(RESULT_CANCELED);
finish();
}
}
/**
* Called when the user selects a File
*
* #param file The file that was selected
*/
protected void onFileSelected(File file) {
if (file != null) {
mPath = file.getAbsolutePath();
if (file.isDirectory()) {
replaceFragment(mPath);
} else {
finishWithResult(file);
}
} else {
Toast.makeText(FileChooserActivity.this, R.string.error_selecting_file, Toast.LENGTH_SHORT).show();
}
}
/**
* Register the external storage BroadcastReceiver.
*/
private void registerStorageListener() {
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_MEDIA_REMOVED);
registerReceiver(mStorageListener, filter);
}
/**
* Unregister the external storage BroadcastReceiver.
*/
private void unregisterStorageListener() {
unregisterReceiver(mStorageListener);
}
}
The errors are:
06-04 04:30:57.547: E/AndroidRuntime(605): FATAL EXCEPTION: main
06-04 04:30:57.547: E/AndroidRuntime(605): java.lang.NoClassDefFoundError: com.ipaulpro.afilechooser.R$layout
06-04 04:30:57.547: E/AndroidRuntime(605): at com.ipaulpro.afilechooser.FileChooserActivity.onCreate(FileChooserActivity.java:65)
06-04 04:30:57.547: E/AndroidRuntime(605): at android.app.Activity.performCreate(Activity.java:5104)
06-04 04:30:57.547: E/AndroidRuntime(605): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
06-04 04:30:57.547: E/AndroidRuntime(605): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
.
.
.
In Eclipse:
Right click on your Project
Select Properties -> Java Build Path-> Order and Export
Check the Android Private Libraries and then click OK button.
You should import the library as an existing Android project into Eclipse workspace. Check in the properties that it is defined as a library.
Then you have to import it in your project. This is done in Properties => Android => Add (in the library section). Choose the library, and then it should be working
Please Replace android-support-v4.jar file. and put ActivityNot Found Exception.
Intent target = FileUtils.createGetContentIntent();
Intent intent = Intent.createChooser(
target, getString(R.string.chooser_title));
try {
startActivityForResult(intent, REQUEST_CODE);
} catch (ActivityNotFoundException e) {
}

Categories

Resources