我使用了fragment,并且我打开了另一个视图,fragment它正常打开,但问题是,我无法得到如何回到第一个视图.
如果我fragment通过第一个片段的对象调用它,则删除旧的值,就像在Edittext其他数据中一样.
谁能帮我?
这是工作,像,
我调用第一个片段名称fragone,并在其中插入一些值edittext,现在我想在同一个名为fragsecond中使用片段打开另一个视图,现在我想去fragone,那么我能做些什么?
即时通讯目前尝试添加SlidingDrawer在我的应用程序.我的活动包括GridView与SlidingDrawer从底部来顶.现在我的问题是,我需要做的SlidingDrawer是透明的,也将我GridView
顶在一定程度上..这是可能的制作..我是Android的新手..帮我解决这个问题...
如果移动GridView它不是一个好主意,那么我希望它SlidingDrawer来到它之上GridView并使它成为一个透明的所以我GridView可见
谢谢...
这个错误出现在日志中.
from='kutbi1@360degree/Smack' to='akash@360degree/Smack' type='error' id='hK1L6-5'>
<si xmlns='http://jabber.org/protocol/si' id='jsi_191216212994140179' mime-type='image/png' profile='http://jabber.org/protocol/si/profile/file-transfer'>
<file xmlns='http://jabber.org/protocol/si/profile/file-transfer' name='this_old_house.png' size='12623'>
<desc>You won't believe this!</desc></file>
<feature xmlns='http://jabber.org/protocol/feature-neg'>
<x xmlns='jabber:x:data' type='form'><field var='stream-method' type='list-multi'>
<option><value>http://jabber.org/protocol/bytestreams</value></option>
<option><value>http://jabber.org/protocol/ibb</value></option>
</field>
</x>
</feature>
</si>
<error code='503' type='cancel'>
<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error></iq>
Run Code Online (Sandbox Code Playgroud)
我在这里使用以下代码
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(Main.connection);
if (sdm == null)
sdm = new ServiceDiscoveryManager(Main.connection);
sdm.addFeature("http://jabber.org/protocol/disco#info");
sdm.addFeature("jabber:iq:privacy");
FileTransferNegotiator.setServiceEnabled(Main.connection, true);
FileTransferManager manager = new FileTransferManager(Main.connection);
OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer(id
+ "/Smack");
Log.i("transfere file", "outgoingfiletransfere is created");
try{
//OutgoingFileTransfer.setResponseTimeout(60000);
transfer.sendFile(new File(txt_file.getText().toString()), "You won't believe this!");
if (transfer.getStatus().equals(Status.cancelled) …Run Code Online (Sandbox Code Playgroud) 我正在开发C2DM消息应用程序.当i为了接收使用的注册ID IM C2DMBroadcastReceiver,C2DMBaseReceiver和C2DMMessaging类.我将C2DMReceiver在我的包裹中延伸C2DMBaseReceiver.
这是我的代码片段
C2DMMessaging.java
package com.google.android.c2dm;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.util.Log;
public class C2DMessaging {
public static final String EXTRA_SENDER = "sender";
public static final String EXTRA_APPLICATION_PENDING_INTENT = "app";
public static final String REQUEST_UNREGISTRATION_INTENT = "com.google.android.c2dm.intent.UNREGISTER";
public static final String REQUEST_REGISTRATION_INTENT = "com.google.android.c2dm.intent.REGISTER";
public static final String LAST_REGISTRATION_CHANGE = "last_registration_change";
public static final String BACKOFF = "backoff";
public static final String GSF_PACKAGE = …Run Code Online (Sandbox Code Playgroud) 是否可以更改字体大小并使文本粗体显示在ProgressDialog.I中已创建ProgressDialog如下:
private ProgressDialog dialog;
this.dialog = ProgressDialog.show(Activity.this, "Heading","Message...", true);
Run Code Online (Sandbox Code Playgroud)
我想使Heading加粗并增加字体大小..帮助
我有一个linearlayout我有一个图像视图,一个textview,两个edittext和按钮.
当我在模拟器或我的设备中运行我的应用程序时,它的高度edittexts似乎更大,而不应该是单行edittext框.
我的layout.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:background="@android:color/white">
<TextView android:id="@+id/item_blank"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:padding="2dp"
android:textSize="14dp"
android:textColor="@android:color/black"
android:background="@android:color/white"
android:text=" "/>
<ImageView android:id="@+id/test_image"
android:src="@drawable/logo_infraline_energy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<TextView android:id="@+id/item_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:padding="2dp"
android:textSize="14dp"
android:textColor="@android:color/black"
android:background="@android:color/white"
android:text="Please put in your valid credentials to get access."/>
<EditText android:id="@+id/userName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:layout_weight="1"
android:height="30dp"
android:hint="Email Address" />
<EditText android:id="@+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Password"
android:height="30dp"
android:password="true" />
<Button android:id="@+id/loginButton"
android:text="Login"
android:layout_width="wrap_content" …Run Code Online (Sandbox Code Playgroud) 我的应用程序具有必须运行24*7 的activities背景,service
我的应用程序必须通过与服务器通信Wi-Fi来发送和接收信息。
问题:每当服务器发送任何警报时,我的应用程序都应该接收并弹出该应用程序,无论它是在前台还是后台运行,并且与用户有关警报。
因此,当设备处于活动状态时,此功能可以正常工作,但当设备进入睡眠模式时,1 或 2 分钟后它会断开与服务器的连接并停止通信。所以为了解决它,我编写了代码,将 WiFi 睡眠策略设置为 NEVER 并在OnCreate()后台服务的方法中获取部分锁定并在服务的方法中释放锁定OnDestroy()。现在观察一段时间它工作正常意味着为5或10分钟后,再次停止它连通。
应用在Android 2.1上开发,部署在设备上支持Android 2.3版本。
我不明白为什么部分锁定会这样,请帮我解决这个问题。
问候,皮克斯。
实际上我需要传递integer值与bitmapvia bluetooth..现在我的问题是我需要转移integer为单个 byte值..是否可以转换 int为单个 byte值..并检索它作为integer那里...我试过byteValue()和铸造的东西,但它没有用..如果我的方法是正确的,只是帮助我这个或说一些其他的方式.
(每当我使用铸造时,它返回为65535)
即时通讯尝试orientation在Android应用程序中锁定屏幕.我使用以下代码锁定屏幕方向时,特定按钮点击火.
// Inside button click
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
if (display.getOrientation() == 1) {
setRequestedOrientation(0);
} else if (display.getOrientation() == 0) {
setRequestedOrientation(1);
} else if (display.getOrientation() == 3) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
}
Run Code Online (Sandbox Code Playgroud)
以上代码适用于横向和纵向屏幕方向,但它不适用于反向横向模式.在这种情况下,我的活动总是将其更改orientation为默认模式.landscape此外,我注意到,当设备处于反向横向模式时,display.getOrientation()始终返回3.
我怎样才能找到这个问题的解决方案?
我正在使用SAX Parser解析xml.当我需要获取的数据是xml标记的主体时,Everythings工作得很好.我得到的唯一问题是我需要的数据是该XML标签的属性值.我如何获得此属性值?
<xml att="value"> Body </xml>
Run Code Online (Sandbox Code Playgroud)
假设这是一个标签,我能够获得Body而不是值
我正在使用的代码是:
URL url = new URL("http://example.com/example.xml");
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
ExampleHandler myExampleHandler = new ExampleHandler();
xr.setContentHandler(myExampleHandler);
xr.parse(new InputSource(url.openStream()));
public class ExampleHandler extends DefaultHandler {
String buff = new String("");
boolean buffering = false;
@Override
public void startDocument() throws SAXException {
// Some sort of setting up work
}
@Override
public void endDocument() throws SAXException {
// Some sort of finishing up work
}
@Override
public …Run Code Online (Sandbox Code Playgroud) 我打电话一webservice通asynctask,打电话给webservice我打电话的一种方法命名makeRequest()中doInBackground(),我得到另一种方法的响应success(),在成功的方法,我更新listview
但我得到的错误就像
android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views."
Run Code Online (Sandbox Code Playgroud)
我在这里添加我的代码.我synctask从活动中调用
new MyTask(this,urlAsString,sp).execute();
Run Code Online (Sandbox Code Playgroud)
这是Asynctask类
class MyTask extends AsyncTask<Void, Void, Void> {
ProgressDialog progress;
String url;
SharedPreferences sp;
HomepageH2desk c;
public MyTask(HomepageH2desk context,String url,SharedPreferences sp) {
this.c = context;
this.url = url;
this.sp = sp;
progress = new ProgressDialog(this.c);
progress.setMessage("Loading...");
}
public void onPreExecute() {
progress.show();
}
public Void doInBackground(Void... …Run Code Online (Sandbox Code Playgroud)