|
|
I've written a few articles on CodeProject that may help, including an introductory article.
Introduction to Xamarin.Android[^]
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
Home | LinkedIn | Google+ | Twitter
|
|
|
|
|
i have a code which get contacts from vcf file and ask user where to save these contact like phone,SIM,google account but i want to directly insert contacts into phonebook with any dialog for asking to save.My code is :-
String tmptype = mime.getMimeTypeFromExtension("vcf");
final File file = new File(Environment.getExternalStorageDirectory().toString()
+ "/contacts.vcf");
Intent i = new Intent();
i.setAction(android.content.Intent.ACTION_VIEW);
i.setDataAndType(Uri.fromFile(file), "text/x-vcard");
startActivity(i);
I am searching on net net but did not get any answer.Please help me to find out solution
modified 23-Dec-14 0:18am.
|
|
|
|
|
I have the following code for mouse detection.
public void detect()
{
Intent intent = getIntent();*
if(intent==null)
{
Toast.makeText(this,"Intent is null",Toast.LENGTH_SHORT).show();
return ;
}
UsbDevice device = (UsbDevice) intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
if(device==null)
{
Toast.makeText(this,"Device is null:",Toast.LENGTH_SHORT).show();
return ;
}
Toast.makeText(this,"Device Connected :"+device.getDeviceName(),Toast.LENGTH_SHORT).show();
}
AndroidManifest.xml are as follows,
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
="" package="com.example.detectmouse" android:versioncode="1" android:versionname="1.0">
<uses-feature android:name="android.hardware.usb.host">
........
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED">
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
="" android:resource="@xml/device_filter">
device_filter.xml are as follows
vendor-id="6127" product-id="6019"
Using Galaxy S3 for running the app.
Giving the message "Device is null"
|
|
|
|
|
package com.blobinfo.contact;
import java.util.*;
import org.json.JSONObject;
import android.os.Bundle;
import android.os.Environment;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View.OnKeyListener;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.database.Cursor;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;
public class ContactList extends Activity {
private EditText contactName;
private Cursor CursorList;
private ListView ContactsListView;
private String rowID;
int count;
private MyDatabase db;
private HashMap<Integer, String> getRowID=new HashMap<Integer, String>();
private List<HashMap<String, String>> listContact=new ArrayList<HashMap<String, String>>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_contact_list);
contactName=(EditText)findViewById(R.id.search_contact);
ContactsListView=(ListView)findViewById(R.id.lstViewContacts);
db = new MyDatabase(this);
CursorList = db.getEmployees();
count=0;
if (CursorList.moveToFirst())
{
do
{
HashMap<String, String> contactDet=new HashMap<String, String>();
String rowID=CursorList.getString(0).toString();
String contactFirstName=CursorList.getString(1).toString();
String contactLastName=CursorList.getString(2).toString();
contactDet.put("name",""+contactFirstName+" "+contactLastName);
listContact.add(contactDet);
getRowID.put(count, rowID);
count++;
}while (CursorList.moveToNext());
}
String[] itemControl = {"name"};
int[] itemLayout={R.id.name};
listContact=sortContact(listContact);
SimpleAdapter adapter = new SimpleAdapter(this.getBaseContext(),listContact,R.layout.list_contact_layout,itemControl,itemLayout);
ContactsListView.setAdapter(adapter);
public View getView(int position, View convertView, ViewGroup parent) {
View view = convertView;
if(view==null)
{
LayoutInflater inflater=getLayoutInflater();
view=inflater.inflate(R.layout.list_contact_layout, parent, false);
TextView textView=(TextView)view.findViewById(R.id.name);
Button cal = (Button) findViewById(R.id.callb);
view.setTag(new Holder(cal,textView));
}
Holder h = (Holder) view.getTag();
h.textView.setText([position]);
return ;
}
}
try
{
contactName.setOnKeyListener(new OnKeyListener()
{
public boolean onKey(View v, int keyCode, KeyEvent event) {
SimpleAdapter adapter=searchViewAdapter(contactName.getText().toString(),CursorList);
ContactsListView.setAdapter(null);
ContactsListView.setAdapter(adapter);
return false;
}
});
}
catch(Exception e)
{
Log.e("Phonebook_TAG","I got an error while searching",e);
}
db.close();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return true;
}
public SimpleAdapter searchViewAdapter(String search,Cursor crList)
{
crList = db.getsearch();
count=0;
listContact=new ArrayList<HashMap<String,String>>();
if (crList.moveToFirst())
{
do
{
HashMap<String, String> contactDet=new HashMap<String, String>();
String rowID=crList.getString(0).toString();
String fullName=crList.getString(1).toString()+" "+crList.getString(2).toString();
String emailAdd=crList.getString(3).toString();
String phoneNumber=crList.getString(4).toString();
String phoneNumber1=crList.getString(5).toString();
if(fullName.toLowerCase().contains(search.toLowerCase()) && search!="")
{
contactDet.put("name",fullName);
listContact.add(contactDet);
getRowID.put(count, rowID);
count++;
}
else if(phoneNumber.toLowerCase().contains(search.toLowerCase()) && search!="")
{
contactDet.put("name",fullName);
listContact.add(contactDet);
getRowID.put(count, rowID);
count++;
}
else if(emailAdd.toLowerCase().contains(search.toLowerCase()) && search!="")
{
contactDet.put("name",fullName);
listContact.add(contactDet);
getRowID.put(count, rowID);
count++;
}
else if(search=="")
{
contactDet.put("name",fullName);
listContact.add(contactDet);
getRowID.put(count, rowID);
count++;
}
}while (crList.moveToNext());
}
String[] itemControl = {"name"};
int[] itemLayout={R.id.name};
listContact=sortContact(listContact);
SimpleAdapter adapter = new SimpleAdapter(this.getBaseContext(),listContact,R.layout.list_contact_layout,itemControl,itemLayout);
return adapter;
}
public List<HashMap<String, String>> sortContact(List<HashMap<String, String>> contacts)
{
List<String> lst=new ArrayList<String>();
List<HashMap<String, String>> sortContacts=new ArrayList<HashMap<String,String>>();
for(int i=0;i<contacts.size();i++)
{
lst.add(contacts.get(i).get("name")+","+getRowID.get(i));
}
Collections.sort(lst);
getRowID=new HashMap<Integer, String>();
for(int i=0;i<lst.size();i++)
{
HashMap<String, String> hashContacts=new HashMap<String, String>();
String splitData[]=lst.get(i).split(",");
hashContacts.put("name",splitData[0]);
sortContacts.add(hashContacts);
getRowID.put(i, splitData[splitData.length-1]);
}
return sortContacts;
}
}
i need your help
In the fastest time
|
|
|
|
|
What exactly is your question? What problem are you having? What is it doing, and what is it supposed to do? Have you stepped through the code using a debugger? Have you posted just the relevant code?
Member 11315329 wrote: In the fastest time This does not set a good precedent.
"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 am very new to android. I want to develop an android application for sound analysis of audio signals using contonous wavelet transform. I am confused as i dont know where should i start from.
|
|
|
|
|
Member 11310952 wrote: I am confused as i dont know where should i start from. I suggest you start from Here[^].
|
|
|
|
|
Linky[^]
Has anyone installed and played with this one yet?
To err is human to really mess up you need a computer
|
|
|
|
|
|
rnbergren wrote: Has anyone installed and played with this one yet? Yes, I have.
"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
|
|
|
|
|
Yes i am working on Android studio
|
|
|
|
|
how well or not well does it work. Good and bad points?
To err is human to really mess up you need a computer
|
|
|
|
|
|
|
I need to have detect any usb device while it connected.
what content should I include in device_filter file?
If I dont want filtering of device , still is it require to have device_filter file?
|
|
|
|
|
Have you tried registering a broadcast receiver, listening for ACTION_UMS_CONNECTED ? Some devices may not use this, however.
Also, lot's of examples 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
|
|
|
|
|
Actually I Need to work with only Usb Host mode.
And I need to have recognize any connected device by OTG cable.
Then What should be the content of @Xml/device_filter file?
modified 15-Dec-14 4:57am.
|
|
|
|
|
i want to send message using visual c#.net to android mobile plz provide usb driver of android and also tell modem driver for android
|
|
|
|
|
muazam baig wrote: plz provide usb driver of android and also tell modem driver I am afraid that this site does not provide code to order. You will need to use Google to find an open source, or similar sample, or employ someone to do it for you.
|
|
|
|
|
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
|
|
|
|