我正在使用此部分代码MapFragment在Google Map版本2中添加标记.
MarkerOptions op = new MarkerOptions();
op.position(point)
.title(Location_ArrayList.get(j).getCity_name())
.snippet(Location_ArrayList.get(j).getVenue_name())
.draggable(true);
m = map.addMarker(op);
markers.add(m);
Run Code Online (Sandbox Code Playgroud)
我想使用我的drawable中的不同图像.
我已经通过在一个活动中使用应用程序上下文将一些数据存储到全局类.后来我必须在A Fragment中检索这些值.我已经做了类似的事情来存储在Global Class中.
AndroidGlobalClass AGC = ((AndroidGlobalClass) getApplicationContext());
AGC.setUser_access("XYZ");
AGC.setFirst_name("ABC");
Run Code Online (Sandbox Code Playgroud)
我在Manifest中做过:
<application
android:name=".AndroidGlobalClass"
android:theme="@style/AppTheme" >
<activity
android:name="abc.SignInActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Run Code Online (Sandbox Code Playgroud)
现在,当我试图获取应用程序上下文时使用此...我没有得到上下文...
AndroidGlobalClass AGC = ((AndroidGlobalClass) getApplicationContext());
Run Code Online (Sandbox Code Playgroud)
这是My Fragment Activity
public class Fragment_NewsFeed extends Fragment {
public Fragment_NewsFeed() {
}
RestImplimentationMethods RIM;
AndroidGlobalClass AGC;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_newsfeed, container, false);
return rootView;
}
}
Run Code Online (Sandbox Code Playgroud) 使用此代码:
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = format.parse(dtStart);
return date;
Run Code Online (Sandbox Code Playgroud)
我已经按日期对象转换了字符串日期并获得了价值... ------> Sun Feb 17 07:00:00 GMT 2013 <---------------
现在我想提取日(周日/周一)和月形式在这里任何帮助????
我想在片段中添加一个TabHost.代码如下.这里面是碎片.我正在尝试添加TabHost以显示两个选项卡:
package com.nordicsoft.dilosysNewVersion;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TabHost;
public class Fragment_Coupons extends Fragment {
TabHost tabHost;
TabHost.TabSpec spec;
public Fragment_Coupons() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_coupon, container,
false);
tabHost = (TabHost) rootView.findViewById(android.R.id.tabhost);
tabHost.setup();
//Add_Text_To_Tab("Android", "IOS");
Intent intentAndroid = new Intent().setClass(getActivity(),
Aclass.class);
spec = tabHost.newTabSpec("Android").setContent(intentAndroid)
.setIndicator("Android");
tabHost.addTab(spec);
Intent intentBus = new Intent().setClass(getActivity(), Bclass.class);
spec = tabHost.newTabSpec("Welcome").setIndicator("Welcome")
.setContent(intentBus).setIndicator("Welcome");
tabHost.addTab(spec);
return rootView;
}
} …Run Code Online (Sandbox Code Playgroud) 我想添加Expandable ListView子项的click事件...我不想扩展Activity,因为我在这里添加了另一个Listview ...吼...现在我想添加孩子的click事件... .请帮忙....
package com.example.events;
import java.util.ArrayList;
import java.util.List;
import com.example.events.GroupEntity.GroupItemEntity;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.OnChildClickListener;
import android.widget.Toast;
public class MainActivity extends Activity implements OnChildClickListener {
private ExpandableListView mExpandableListView;
private List<GroupEntity> mGroupCollection;
String URL;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.event_mainactivity);
prepareResource();
initPage();
}
private void prepareResource() {
mGroupCollection = new ArrayList<GroupEntity>();
for (int i = 1; i < 3; i++) {
GroupEntity ge = new GroupEntity();
ge.Name = "Group" + i;
for …Run Code Online (Sandbox Code Playgroud)