|
|
Thank you for your answer, but your example doesn't answer my problem.
|
|
|
|
|
I'm sorry but you have not really given enough detail of what your problem is.
|
|
|
|
|
I have shared the problem and the source code. Can you tell me what I'm missing? Thanks.
|
|
|
|
|
What do you need help with, responding to the swipe gesture, or resizing the layout?
"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
|
|
|
|
|
Hi.. I am new to Xamarin Forms. I am building an application in using PCL. I have an external trigger event like trigger gun event. I am unable to find the triggered event. Please help me .
my sample code like below and it works in android but I am expecting PCL Xamarin Form
public override Boolean OnKeyDown(Keycode keyCode, KeyEvent e)
{
}
|
|
|
|
|
Any problem for my coding? Please help, thanks.
xml code
="1.0"="utf-8"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.user.myapplication.MyActivity">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_send"
android:layout_gravity="center_horizontal"
android:id="@+id/btnsubmit"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<EditText
android:layout_width="100dp"
android:layout_height="45dp"
android:text="key in here"
android:id="@+id/medittext" />
</RelativeLayout>
MyActivity.java
package com.example.user.myapplication;
import android.app.Activity ;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import static com.example.user.myapplication.R.*;
public class MyActivity extends Activity implements View.OnClickListener {
EditText mtext;
Button mbutton;
<a href="http://www.codeproject.com/Members/OverRide">@Override</a>
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(layout.activity_my);
mtext = (EditText)findViewById(id.medittext);
mbutton = (Button)findViewById(id.btnsubmit);
mbutton.setOnClickListener(this);
}
<a href="http://www.codeproject.com/Members/OverRide">@Override</a>
public void onClick(View v) {
Intent intent = new Intent(this, ViewActivity.class);
String message = mtext.getText().toString();
intent.putExtra("mtext",message);
startActivity(intent);
}
}
ViewActivity.java
package com.example.user.myapplication;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
public class ViewActivity extends Activity{
TextView tview;
<a href="http://www.codeproject.com/Members/OverRide">@Override</a>
protected void onCreate(Bundle saveInstancestate) {
super.onCreate(saveInstancestate);
setContentView(R.layout.view);
tview = (TextView)findViewById(R.id.tvView);
Intent intent = getIntent();
String abc = intent.getStringExtra("abc");
tview.setText(abc);
}
}
modified 31-May-16 11:13am.
|
|
|
|
|
Can you just move your head slightly to the left? You're in the way of the hidden camera we've installed behind you, and we can't see the error details on your screen.
Oh, wait; we don't have a camera pointing at your screen. We also don't have remote access to your computer, nor telepathy.
If you don't tell us what the error is, how do you think anyone will be able to fix it?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
No error checking, no try /catch clauses, and the name of the extra differs between the put (mtext) and the get (abc). How exactly are we supposed to help you?
"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'm new to Android programming and I'm not really sure what to search for to get an answer on this.
I'm writing an app that controls a 600W jukebox i made 15 years ago. I wrote the player code for wimdows and I want to be able to go into apps like YouTube, share the link to my app, send it to my Jukebox via TCP, and display it on the screen.
The only piece I'm missing is how do you get your app on the share to list? The list that comes up when you click a share button in say..... YouTube. How is it managed after your app is chosen? Can you pick and choose what apps can share to your app? Thanks!
|
|
|
|
|
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.
|
|
|
|