Android and JFileChooser - java

I've developed a desktop application that allows the user to extract images from their phone.
When I first started this project, my android was running Gingerbread. When I plugged my phone into the laptop via USB, it would appear as a "Device with removable storage". Therefore, the JFileChooser would pick it up.
nwdir = new JFileChooser();
nwdir.setCurrentDirectory(new java.io.File("C:\\"));
nwdir.setDialogTitle(choosertitle);
nwdir.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
nwdir.setAcceptAllFileFilterUsed(true);
However, I recently upgraded the phone's o/s to Icecream and it now shows up on the desktop as a "portable device". This is something that the JFileChooser cannot see?!
Has anyone got any suggestions on how to get around this problem? I was going to roll back the O/S of the phone, but this somewhat limits the application's device support.

The default transfer mode has been changed in Android 4.0 Ice Cream Sandwich from USB Mass Storage mode to MTP (Media Transfer Protocol) which doesn't use a standard filesystem mount. On some phones it is possible to change the USB mode while on others it may be necessary to install an apk to enable it

I've found a way around it by doing this.... Settings > Wireless & Network > USB utilities and click the button > then (and ONLY then) plug in USB cable

Related

How to connect android devices to vs code in flutter for check the code?i turned on debugging too

I am stuck here. I connect a USB drive from my laptop to the android device but still vs code shows no device. Image Attached
Considering that you have successfully installed Flutter and Dart and their respective VS Code Plugins.
There are 2 ways to do it
If you have a physical Android Device, you must enable USB debugging on your device and then you can connect it directly to your machine. Once the device is successfully connected and detected by your machine, then its name would appear on bottom right corner in VS Code window.
If you don't have a physical device, then you must create an emulator image of Android platform of your choice. The emulator image must be created from AVD manager present in Android SDK. Once the AVD image is ready and running, the name of the AVD would appear on bottom right corner of VS Code window.
If you see your device name on bottom corner of VS Code, then press F5 and wait for the app to load on the device/emulator.
There are basically two ways before the app is released.
USB Debugging
Wireless Debugging
Connect via USB: adb tcpip 5555
Disconnect USB, Get Phone Ip Address Settings > About Phone > Status.
Now adb connect <Your IP Address>
Refer:
How to connect a device with ADB over WiFi when making app with Flutter?
https://appmaking.com/run-flutter-apps-on-android-device

Android Device not detecting in ecclips

I have installed all required drivers of mobile. My device is able to detect in' adb device'. but while running application, my mobile device is not coming..
In "device" it is able to locate.
I have gone through: "Run-> Run Configuration-> target" but there is no any active device.
yeah, I experienced that too. The reason can be anything... Try updating you adb / usb drivers. Maybe you gonna need a vendor-specific usb-driver.
Last time when I had problems with detecting my Sony Xperia S, I solved them by turning USB Modem in Preferences on.
this issue solved...
I changed SDK folder with another latest version of SDK externally.
Restarted Computer. Configured device.

How to write files from Android to PC and back?

The Situation:
Client has an Android phone that is not activated to use cellular services and his office does not have wifi. He wants me to write him a simple customized contact list that he can view the names and the phone numbers of people(already completed). However, he wants a Desktop Client (done in Java) where he can update the contacts, as he is a bit older and prefers using a standard sized keyboard instead of the slider keyboard on his phone.(this is completed as well).
I need to complete a class for the app that will read a file on the PC's local hard drive and update the contacts file on the SD card.
Options:
As far as I can tell, my only option in this case would be to use the USB port from the phone. I will have the desktop client write the contacts file to the SD card on the Android Device.
Question:
Can I use the USBManager class to have the app:
1. Look for xml contact file on PC.
2. Read the file on the PC and update the file on the SD card.
Additional Information:
Client's Phone Model: Motorola Droid II Global
Android OS version: 2.3.4
Perhaps it may be easier to have the Desktop Client access the SDCard and write the files to the Android Device. I am willing to review all concepts and ideas about this process. Thank you.
If the device is in "Development Mode" you can use the Android Debug Bridge (adb) to push/pull files from a device over a USB connection.
http://developer.android.com/tools/help/adb.html#copyfiles
If the SD card is removable than it sounds like it might be easier to purchase a SD card reader for a PC and have the PC java program write to the SD card, remove it from the PC and then re-insert it into the Android device and then the Android app can read it back from the SD card. Which is what you said in your last paragraph...
What about Bluetooth using Androids BluetoothSocket class, on the device? You can purchase USB Bluetooth dongles for PC's if needed. However, Using a USB cable connection would be easier.

blackberry device not detected when debugging on Mac

I have a problem when I want to debug my application from eclipse using device (I use 9700 for debugging). It's used to be like this: the device is connected to Mac using usb cable, and automatically desktop manager pops up, gives sign that my device is successfully connected, thus I can debug my project from eclipse.
Now I can't do it like that anymore. when I connect the device to Mac, desktop manager (or Mac) doesn't detect my device. I use:
Desktop Manager 2.3.1 build 5
BlackBerry Java Plug-in Version: 1.5.2.201204302029
Does anybody know how I can make my device be detected again by the system?
You might compare the results from either of these two USB utilities:
/Applications/Utilities/System Profiler.app
/Developer/Applications/Utilities/USB Prober.app

Install j2me application in samsung mobile

We developing j2me application for low end mobile devices (like Nokia s40 mobiles) which supports java. In our application we used JSR75 and JSR135 its working in nokia and sony ericsson but while trying to install the same application in Samsung devices(GT-S3310 ) we getting error like "File Format not supported". Please help how to install the jar file in samsung mobiles.
How are you installing the app? Side-loading the jar directly on to the device via USB or Bluetooth? Some handsets don't support that. Try installing it over the air instead, by pointing the web browser to the JAD which should be online somewhere.
I already checked on some samsung mobiles. They could not allow direct installation through with bluetooth or with USB cable. Because they following certain security norms of java apps installation. You need to install it from WAP sites.

Categories