|
Mike8855 wrote:
The only piece I'm missing is how do you get your app on the share to list? Modify your app's AndroidManifest.xml file. Check out the android:mimeType category. For example, I have an app that handles .txt files. For that activity in the AndroidManifest.xml file, I have this:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter> Now anytime a text file is selected, either through some sort of file manager (e.g., Astro), or opened as an email attachment, my app shows up in the list of apps that can handle that file type.
Mike8855 wrote: Can you pick and choose what apps can share to your app? Thanks! No, you let the Android framework know what file types your app can handle (e.g., text files, jpeg images, URLs).
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
modified 24-Apr-16 22:16pm.
|
|
|
|
|
|
 Next major roadblock....
I created a class within MainActivity to handle the intent. It just crashes when clicking the app on the share list. All this has to do is populate a string variable and MainActivity will see it in a background task.
The error:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.remoteapp.manderson.jboxcontroller/com.remoteapp.manderson.jboxcontroller.MainActivity$NextActivity}: java.lang.InstantiationException: java.lang.Class<com.remoteapp.manderson.jboxcontroller.MainActivity$NextActivity> has no zero argument constructor
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.InstantiationException: java.lang.Class<com.remoteapp.manderson.jboxcontroller.MainActivity$NextActivity> has no zero argument constructor
Manifest:
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity">
</activity>
<activity android:name=".MainActivity$NextActivity" >
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.SEND" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
MainActivity class heading:
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
Sub class:
public class NextActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent receivedIntent = getIntent();
String receivedText = receivedIntent.getStringExtra(Intent.EXTRA_TEXT);
if (receivedText != null){
MainActivity.this.playURL =receivedText;
}
}
In my first try in a separate activity:
public class ActivityFromExt extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent receivedIntent = getIntent();
String receivedText = receivedIntent.getStringExtra(Intent.EXTRA_TEXT);
if (receivedText != null) {
Intent i = new Intent(getApplicationContext(), MainActivity.NextActivity.class);
i.putExtra("URL", receivedText);
startActivity(i);
}
}
}
This would crash at startActivity.
Thanks
|
|
|
|
|
Mike8855 wrote:
This would crash at startActivity. Try surrounding the relevant parts of the code with a try/catch block. You should also consider stepping through the code using the debugger.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I tried a few things which led to either crashing or app failures. This app runs as a client using socket so it depends on constant pinging from the server end. Stepping through on most changes would typically get stuck at creating a new socket. startActivity would open the MainActivity with no connection because it was trying to connect to the same port. Sooooooo I modified the server end (.net) and opened a second port which the new activity opens, sends the link, then finishes. Nothing happens on MainActivity which means the connection remains.
I have one last thing to iron out and I can call this one done. If the server isn't running, the app hangs on opening the socket as it waits for a connection. If the connection does drop after a connection, the UI appears to work but it doesn't update, unless I turn the phone to landscape. I'm hoping connecting in the background rather than the main thread fixes this.
Thanks again David.
|
|
|
|
|
hi,
I am developing android application where I need to transfer money to one particular account. How it is possible?
|
|
|
|
|
It is possible by writing code. But since you have given us no context, nor any idea where the money comes from, or where the receiving account is located, it is anyone's guess as to the details.
|
|
|
|
|
Tell me where the money is coming from and I'll provide the rest.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
The Adaptive Payments option gives you a lot more control over the payment and is the future direction of the Paypal APIs, so that's where i'd start if i were you. It supports SOAP, NVP, JSON and plain XML.
|
|
|
|
|
hi all:
I have a problem:
"adb shell uiautomator dump /sdcard/dump.xml" this commond can run on pc cmd,but can't use Runtime.getRuntime().exec() api to excute in app , i don't konw what's wrong, beacause of no execption i got.
why other shell commond can run ok like "logcat", "ls " , ect
i also research the android resource,
find it use "app_process /system/bin com.android.commands.uiautomator.Launcher dump /scard/dump.xml"
what can i do to run success of the commond "uiautomator dump /sdcard/dump.xml"
|
|
|
|
|
What is the exact string you use in your call to exec ?
|
|
|
|
|
thanks, i use like that:
Runtime.getRuntime().exec("uiautomator dump /sdcard/dump.xml")
|
|
|
|
|
You need to provide the full path of the executable. Remember you are not running in a shell environment.
|
|
|
|
|
I couldn't get this to work either... what do you mean by provide the full path of the executable?
|
|
|
|
|
I mean the complete path of the program, from the root directory. As a CTO you should understand this.
|
|
|
|
|
That's helpful...
I'm currently trying to run the uiautomator from within an app in android... and I'm not being able to...
It keeps returning an exit code of 9.
I have no idea where the uiautomator is located in the android os.
Do you have any idea?
|
|
|
|
|
|
|
Hi,
Were you able to run this?
I've tried various solutions but none worked.
Please share solution if you have got one.
It would be great help.
|
|
|
|
|
How to display student record on screen by click on single button in android eclipse
|
|
|
|
|
|
Ok, overlooking my naivety in things Android, I'm looking to get into Android development and am thinking it maybe a good idea to get a phone to test with. I don't otherwise have anything Android so would it be worth getting a physical device?
Is there a specific device anyone can recommend? There seem to be a lot of cheapie Walmart/Walgreen specials that seem like they might fit the bill.
Is there a minimum threshold to look for? Example nothing below Lollipop(5.0)?
Thanks, 
|
|
|
|
|
|
Thanks Richard, it's a good point, I probably should make a few apps first.
|
|
|
|
|
Thousands of apps are being released to major app stores every day. Yet, most of them wither before they even have a chance to bloom.
The effort, money, and time that is put into developing apps are enormous. Once you’ve got a lot of negative feedback from the users, there will be hardly any second chance given to prove the worth of your app. So ensuring security should be a major step taken by app development companies.
what are some of the most common security vulnerabilities of android app development
|
|
|
|