|
How Could I retrive Input , Output stream of connected Usb Device in android?
I have following code.
Int fd = UsbDeviceConnection.getFileDescriptor();
FileDescriptor fdesc = new FileDescriptor(fd);
FileInputStream fin=new FileInputStream(fdesc);
but it did not work.
modified 10-Dec-14 23:41pm.
|
|
|
|
|
I have planed the following thing,please tell me will it possible?
1.Decided to execute lsof command in android program itself for the process
(Android each app is represented by separate process,so i will able to retrieve its process id)
so command will be
>lsof processIDOfApp
output will be table containing FD as well as is name including other information
2.Map the FD to its name
when we get the file name we will able to create the input/output stream.
|
|
|
|
|
hello
how i can make card game in unity
modified 9-Dec-14 12:23pm.
|
|
|
|
|
Start here and here.
"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 guys, I'm new in android programming and I want to start this on the right path. my current employer is working on a huge project (web/mobile) and was't me to start working on android version. I have studied it before know how it works, I'm looking for a guide, on how to develope it right, anything from naming folders to code structure. do we have such a thing ?
thanx alot
K1
|
|
|
|
|
|
mrkeivan wrote: I'm new in android programming......huge project...and was't (sic) me to start working on android version. Good luck with that. You should spend the better part of a year, if not more, working on smaller projects to get a feel for how things work on this new platform.
"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
|
|
|
|
|
Hello,
i am shree, can any one tell me about how to give the Google Maps API Key for Android , my system OS is Ubuntu, so how can i setting and found the Google map API key values...
|
|
|
|
|
Read here.
"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
|
|
|
|
|
How to show up number of notification in application icon Android like Facebook, Skype
|
|
|
|
|
See if this helps.
"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 have a simple chat website http://mynotyfy.somee.com/[^]
-- And simple code Android , I recieved succeed from Server web but I send 1 message from client to web, application unfortunly
package com.signalr_client;
import java.util.concurrent.ExecutionException;
import microsoft.aspnet.signalr.client.Action;
import microsoft.aspnet.signalr.client.ConnectionState;
import microsoft.aspnet.signalr.client.ErrorCallback;
import microsoft.aspnet.signalr.client.MessageReceivedHandler;
import microsoft.aspnet.signalr.client.Platform;
import microsoft.aspnet.signalr.client.http.android.AndroidPlatformComponent;
import microsoft.aspnet.signalr.client.hubs.HubConnection;
import microsoft.aspnet.signalr.client.hubs.HubProxy;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
public class MainActivity extends Activity {
HubConnection chatConnection;
HubProxy SignalRChatHub;
Button ChatButton;
EditText ChatInput;
TextView ChatMessages;
<a href="http://www.codeproject.com/Members/override">@Override</a>
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
chatConnection = new HubConnection("http://www.mynotyfy.somee.com/");
SignalRChatHub = chatConnection.createHubProxy("ChatHub");
chatConnection.error(new ErrorCallback() {
<a href="http://www.codeproject.com/Members/override">@Override</a>
public void onError(final Throwable error) {
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(getApplicationContext(),
error.getMessage(), Toast.LENGTH_LONG).show();
}
});
}
});
Init();
ChatButton.setOnClickListener(new View.OnClickListener() {
<a href="http://www.codeproject.com/Members/override">@Override</a>
public void onClick(View v) {
runThread();
}
});
SignalRChatHub.subscribe(new Object() {
@SuppressWarnings("unused")
public void broadcastMessage(final String name, final String message) {
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(getApplicationContext(),
name + ": " + message, Toast.LENGTH_LONG)
.show();
}
});
}
});
chatConnection.start().done(new Action<Void>() {
<a href="http://www.codeproject.com/Members/override">@Override</a>
public void run(Void obj) throws Exception {
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(getApplicationContext(),
"Done Connecting!", Toast.LENGTH_LONG).show();
}
});
}
});
chatConnection.received(new MessageReceivedHandler() {
<a href="http://www.codeproject.com/Members/override">@Override</a>
public void onMessageReceived(final JsonElement json) {
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(getApplicationContext(),
"testing!", Toast.LENGTH_LONG).show();
JsonObject jsonObject = json.getAsJsonObject();
JsonArray jsonArray = jsonObject.getAsJsonArray("A");
String messagex = jsonArray.get(0).getAsString() + ": "
+ jsonArray.get(1).getAsString();
ChatMessages.append(messagex + "\n");
Toast.makeText(getApplicationContext(),
"loading!", Toast.LENGTH_LONG).show();
}
});
}
});
}
public void Init() {
ChatButton = (Button) findViewById(R.id.ChatButton);
ChatInput = (EditText) findViewById(R.id.ChatInput);
ChatMessages = (TextView) findViewById(R.id.ChatMessages);
}
public void runThread() {
new Thread(new Runnable() {
public void run() {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
MainActivity.this.runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(getApplicationContext(),
"Click button1", Toast.LENGTH_SHORT).show();
try{
SignalRChatHub.invoke("Send", "Android", "hixhix");
}catch(Exception e){
ChatMessages.setText(e.getMessage().toString());
}
}
});
}
}).start();
}
}
modified 29-Nov-14 3:50am.
|
|
|
|
|
What is the problem, where does it occur, what is the error message ...? Please provide some useful detail if you want help.
|
|
|
|
|
When I call
ChatButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
runThread();
}
}); , occur this error
E/AndroidRuntime(2268): FATAL EXCEPTION: main
E/AndroidRuntime(2268): Process: com.signalr_client, PID: 2268
E/AndroidRuntime(2268): java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.gson.JsonElement com.google.gson.JsonArray.get(int)' on a null object reference
E/AndroidRuntime(2268): at com.signalr_client.MainActivity$5$1.run(MainActivity.java:104)
E/AndroidRuntime(2268): at android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime(2268): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(2268): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime(2268): at android.app.ActivityThread.main(ActivityThread.java:5221)
E/AndroidRuntime(2268): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(2268): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(2268): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/AndroidRuntime(2268): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
|
|
|
|
|
thientamtita wrote: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.gson.JsonElement Check which reference is null.
|
|
|
|
|
|
Have you looked at line 104 of MainActivity.java? What size is jsonArray (is it >= 2)? What is the value of messagex and ChatMessages ?
"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
|
|
|
|
|
android src code for bluetooth file and data transfer
|
|
|
|
|
42 message received all your base are belong to us resistance is futile
|
|
|
|
|
Thanks for this advice. I will reward you.
|
|
|
|
|
|
I have small project using SignalR wrote C# (using Xamarin in Visual Studio 2013)
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Microsoft.AspNet.SignalR.Client;
using System.Collections.Generic;
namespace SignalRWithXamarin
{
[Activity(Label = "SignalRWithXamarin", MainLauncher = true)]
public class MainActivity : Activity
{
HubConnection chatConnection;
IHubProxy SignalRChatHub;
public event EventHandler<string> OnMessageReceived;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
chatConnection = new HubConnection("http://www.mynotyfy.somee.com/");
SignalRChatHub = chatConnection.CreateHubProxy("ChatHub");
SignalRChatHub.On("broadcastMessage", (string name, string message) =>
{
if (OnMessageReceived != null)
OnMessageReceived(this, string.Format("{0}: {1}", name, message));
});
var input = FindViewById<EditText>(Resource.Id.ChatInput);
var messages = FindViewById<ListView>(Resource.Id.ChatMessages);
var adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, new List<string>());
JoinChat();
messages.Adapter = adapter;
OnMessageReceived += (sender, message) => RunOnUiThread(() =>
adapter.Add(message));
Button button = FindViewById<Button>(Resource.Id.ChatButton);
button.Click += delegate
{
if (string.IsNullOrEmpty(input.Text))
return;
Chat(input.Text);
input.Text = "";
};
}
public async virtual void JoinChat()
{
try
{
await chatConnection.Start();
}
catch (Exception)
{
}
}
public async virtual void Chat(string phoneChatMessage)
{
if (chatConnection.State == ConnectionState.Connected)
await SignalRChatHub.Invoke("Send", "Android", phoneChatMessage);
}
}
}
Now I wanna Convert to Project in Eclipse.
|
|
|
|
|
thientamtita wrote: Now I wanna Convert to Project in Eclipse. Then please feel free to do so. The eclipse system will generate a standard framework for your app and you just need to fill in the specifics of your code.
|
|
|
|
|
Calling anyone with Google Glass app development, design, or testing experience. I need participants for a quick card sort regarding glass application design principles. It takes less than 10 minutes to do and your participation is highly appreciated! Thank you.
The card sort can be found here:
https://704302s2.optimalworkshop.com/optimalsort/glassdesignprinciples
|
|
|
|
|