这是我播放录制的音频3gp文件的代码
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
Uri data = Uri.parse(path);
intent.setDataAndType(data, "audio/mp3");
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
但是在我的HTC设备(Android 2.2 Froyo)中运行它时会显示异常:
05-04 16:37:37.597: WARN/System.err(4065): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=/mnt/sdcard/mnt/sdcard/audio-android.3gp typ=audio/mp3 }
05-04 16:37:37.597: WARN/System.err(4065): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1567)
05-04 16:37:37.597: INFO/ActivityManager(92): Starting activity: Intent { act=android.intent.action.VIEW dat=/mnt/sdcard/mnt/sdcard/audio-android.3gp typ=audio/mp3 }
05-04 16:37:37.607: WARN/System.err(4065): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1537)
05-04 16:37:37.607: WARN/System.err(4065): at android.app.Activity.startActivityForResult(Activity.java:2858)
05-04 16:37:37.607: WARN/System.err(4065): at android.app.Activity.startActivity(Activity.java:2964)
05-04 16:37:37.607: WARN/System.err(4065): at com.ey.camera.AudioRecorder.playAudio(AudioRecorder.java:244)
05-04 16:37:37.607: WARN/System.err(4065): at com.ey.camera.AudioRecorder$4.onClick(AudioRecorder.java:225)
05-04 16:37:37.607: WARN/System.err(4065): at android.view.View.performClick(View.java:2408)
05-04 16:37:37.607: WARN/System.err(4065): …
Run Code Online (Sandbox Code Playgroud) 我想知道如何解析AndroidManifest.xml文件,以便通过代码获取应用程序版本号.安卓的versionName
有没有办法ArrayList
在Android中将普通Java数组或Json数组转换为将JSON对象传递给Web服务?
要创建一个简单的工作PopupWindow,我们需要执行以下操作:
popup_example.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="10dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="Test Pop-Up" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
Java代码
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
PopupWindow pw = new PopupWindow(inflater.inflate(R.layout.popup_example, null, false),100,100, true);
pw.showAtLocation(this.findViewById(R.id.main), Gravity.CENTER, 0, 0);
Run Code Online (Sandbox Code Playgroud)
我的要求是我需要一个
<TEXTVIEW android:layout_height="wrap_content" android:layout_width="fill_parent" />
Run Code Online (Sandbox Code Playgroud)
和a
<BUTTON android:id="@+id/end_data_send_button" android:text="Cancel"/>
Run Code Online (Sandbox Code Playgroud)
在我的popup_example.xml
.如何在Java代码中处理这两个组件?
我需要完成一个Android应用程序.为此我写了
@Override
public void onBackPressed() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure You want to exit")
.setCancelable(false)
.setPositiveButton("YES"),
new DialogInterface.OnClickListener() {
// On
// clicking
// "Yes"
// button
public void onClick(DialogInterface dialog,int id) {
System.out.println(" onClick ");
closeApplication(); // Close Application method called
}
})
.setNegativeButton("NO"),
new DialogInterface.OnClickListener() {
// On
// clicking
// "No"
// button
public void onClick(DialogInterface dialog,int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
private void closeApplication() {
System.out.println("closeApplication …
Run Code Online (Sandbox Code Playgroud) 我有一个布局与手机联系deatils.当我单击选项菜单时,我需要在该屏幕中显示一个edittext.我已经做了.但是有一个问题是编辑文本高度在屏幕不可见时被占用.如何删除编辑文本占用的空间,而它在屏幕(布局)中不可见..我的代码如下
我的xml是:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:paddingLeft="10dp"
android:paddingRight="10dp">
<ListView android:id="@id/android:list" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_weight="1"
android:drawSelectorOnTop="false">
</ListView>
<TextView android:id="@id/android:empty" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:text="No Entries available">
</TextView>
<TableRow android:id="@+id/TableRow001"
android:layout_width="wrap_content" android:background="#C0C0C0"
android:layout_height="wrap_content">
<EditText android:id="@+id/NumberEditText01"
android:layout_width="wrap_content"
android:paddingLeft="20dip"
android:layout_height="wrap_content">
</EditText>
<Button android:layout_width="wrap_content" android:id="@+id/callNow01"
android:layout_height="wrap_content"
android:text="Call now"
>
</Button>
</TableRow>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
和班级:
public class ListContacts extends ListActivity {
TableRow tableRow;
EditText phoneNumber;
Button callNow;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Associate the xml with the activity
setContentView(R.layout.activitylist);
tableRow = (TableRow) findViewById(R.id.TableRow001);
tableRow.setVisibility(View.INVISIBLE); …
Run Code Online (Sandbox Code Playgroud) 线程处于活动状态时,如何停止线程?我已经给了
if(thread.isAlive()){
thread.stop();
}
Run Code Online (Sandbox Code Playgroud)
但是方法stop已被弃用并抛出异常
01-21 14:12:40.188: ERROR/global(535): Deprecated Thread methods are not supported.
01-21 14:12:40.188: ERROR/global(535): java.lang.UnsupportedOperationException
01-21 14:12:40.188: ERROR/global(535): at java.lang.VMThread.stop(VMThread.java:85)
01-21 14:12:40.188: ERROR/global(535): at java.lang.Thread.stop(Thread.java:1379)
01-21 14:12:40.188: ERROR/global(535): at java.lang.Thread.stop(Thread.java:1344)
Run Code Online (Sandbox Code Playgroud)
我们怎么解决这个问题?
我需要上传图片:
<form method="post" action="hi.iq/register.jsp" enctype="multipart/form-data">
Name: <input type="text" name="name" value="J.Doe">
file: <input type="file" name="file-upload">
<input type="submit">
</form>
Run Code Online (Sandbox Code Playgroud)
在我的servlet中,我给了
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String name = request.getParameter("name");
System.out.println("user_id========= "+name);
Run Code Online (Sandbox Code Playgroud)
但是值的值name
返回为NULL
.
请帮助
我们可以选择检查Android中的网络连接类型(无论是3G,边缘还是gprs).
我需要检查带宽率.我需要发起一个电话.为此,我需要检查带宽率.仅在特定带宽之上,我需要为呼叫提供可见选项(以发起呼叫).
我需要以编程方式找到连接速度(Mobile Data Link,EDGE的连接速度).
单击退出按钮时,我需要完成在Android应用程序中运行的所有活动.我怎样才能做到这一点?
我想要的是:
android ×9
java ×2
bandwidth ×1
codec ×1
galaxy-tab ×1
json ×1
jsp ×1
popupwindow ×1
servlets ×1