关于安卓开发中谷歌地图在 android fragment

各位大佬,我通过Android studio生成了一个谷歌地图的页面 MapsActivity,这个是自动生成的
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {

private GoogleMap mMap;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;

    // Add a marker in Sydney and move the camera
    LatLng sydney = new LatLng(-34, 151);
    mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
    mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}

}
然后我做了一个Fragment的导航:
public class fragmentmap extends Fragment {

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.activity_maps, null);
        return view;
    }

}

我将这个activity放入了framentmap

public class fragmentmap extends Fragment implements OnMapReadyCallback {
private GoogleMap mMap;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.activity_maps, null);
return view;
}

@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;

    // Add a marker in Sydney and move the camera
    LatLng sydney = new LatLng(-34, 151);
    mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
    mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}

}

就是现在项目运行只显示地图,坐标并没有实现,moveCamera也没有运行,求大佬们指点下我哪里出了问题。

2个回答

将onCreateView()方法进行修改。
如下所示:

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_blank, container, false);
mapFragment= (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map);
if(mapFragment == null){
FragmentManager fm= getFragmentManager();
FragmentTransaction ft= fm.beginTransaction();
mapFragment= SupportMapFragment.newInstance();
ft.replace(R.id.map, mapFragment).commit();
}
mapFragment.getMapAsync(this);
return view;
}

我通过Android studio生成了一个谷歌地图的页面 MapsActivity,这个是自动生成的 public class MapsActivity extends FragmentActivity...

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
给 ViewPager 中的 fragment 添加空的构造函数
我想创建了一个布局,类似 Google play's。我使用 ViewPager ,需要 fragment。我查了一些资料说一个 fragment 需要一个空的构造函数,但是事例中在 developer.android.com 不包含一个构造函数。 事例代码如下: public static class DemoObjectFragment extends Fragment { public static final String ARG_OBJECT = "object"; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // The last two arguments ensure LayoutParams are inflated // properly. View rootView = inflater.inflate( R.layout.fragment_collection_object, container, false); Bundle args = getArguments(); ((TextView) rootView.findViewById(android.R.id.text1)).setText( Integer.toString(args.getInt(ARG_OBJECT))); return rootView; } } 需要在一个fragment中包含一个构造函数吗?或者直接省去构造函数?
android谷歌地图不显示
我的谷歌地图写在demo里 是写在一个activity里面的 可以显示地图出来 但是移植到项目里 是嵌入在一个fragment里面的 一样的代码已知道fragment里面地图就不显示了 一片空白 怎么办?
一个fragment跳转到其它fragment,其它fragment变成了空白页
MainActivity里面有三个fragment的样子,但是呢当我第一个fragment制作了获取新闻功能之后,其它fragment都变成了空白页,请高手指点一下下,谢啦!! 新闻fragment: ![新闻fragment](https://img-ask.csdn.net/upload/201603/04/1457105975_146181.png) 其它fragment: ![其它fragment](https://img-ask.csdn.net/upload/201603/04/1457105997_344946.png) MainActivity: import net.loonggg.fragment.R; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.view.Window; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.RadioGroup.OnCheckedChangeListener; public class MainActivity extends FragmentActivity { private Fragment[] mFragments; private RadioGroup bottomRg; private FragmentManager fragmentManager; private FragmentTransaction fragmentTransaction; private RadioButton rbOne, rbTwo, rbThree; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_main); mFragments = new Fragment[3]; fragmentManager = getSupportFragmentManager(); mFragments[0] = fragmentManager.findFragmentById(R.id.fragement_main); mFragments[1] = fragmentManager.findFragmentById(R.id.fragement_bbs); mFragments[2] = fragmentManager.findFragmentById(R.id.fragement_setting); fragmentTransaction = fragmentManager.beginTransaction() .hide(mFragments[0]).hide(mFragments[1]).hide(mFragments[2]); fragmentTransaction.show(mFragments[0]).commit(); setFragmentIndicator(); } private void setFragmentIndicator() { bottomRg = (RadioGroup) findViewById(R.id.bottomRg); rbOne = (RadioButton) findViewById(R.id.rbOne); rbTwo = (RadioButton) findViewById(R.id.rbTwo); rbThree = (RadioButton) findViewById(R.id.rbThree); bottomRg.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { fragmentTransaction = fragmentManager.beginTransaction() .hide(mFragments[0]).hide(mFragments[1]) .hide(mFragments[2]); switch (checkedId) { case R.id.rbOne: fragmentTransaction.show(mFragments[0]).commit(); break; case R.id.rbTwo: fragmentTransaction.show(mFragments[1]).commit(); break; case R.id.rbThree: fragmentTransaction.show(mFragments[2]).commit(); break; default: break; } } }); } } 显示新闻的fragment: import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import org.json.JSONException; import com.askdoctor.adapter.NewsAdapter; import com.askdoctor.constans.Constant; import com.askdoctor.entity.News; import com.askdoctor.utils.HttpUtils; import net.loonggg.fragment.R; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ListView; public class FragmentMain extends Fragment { private NewsAdapter adapter; private List<News> newsList; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_main, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView listNews = (ListView)getView().findViewById(R.id.list_web_view); newsList=new ArrayList<News>(); adapter = new NewsAdapter(getActivity(),newsList); listNews.setAdapter(adapter); HttpUtils.getNewsJSON(Constant.URL_GET_NEWS_LIST, getNewsHandler); } public Handler getNewsHandler=new Handler(){ public void handleMessage(android.os.Message msg){ String jsonData=(String)msg.obj; System.out.println(jsonData); try { JSONArray jsonArray=new JSONArray(jsonData); for (int i = 0; i < jsonArray.length(); i++) { org.json.JSONObject object = jsonArray.getJSONObject(i); String title=object.getString("title"); String desc=object.getString("desc"); String time=object.getString("time"); String content_url=object.getString("content_url"); String pic_url=object.getString("pic_url"); newsList.add(new News(title, desc, time, content_url, pic_url)); } //数据变化后更新adapter adapter.notifyDataSetChanged(); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } }; }; } 变成空白页的fragment: import net.loonggg.fragment.R; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; public class FragmentBBS extends Fragment { Button btnSendBBS; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_bbs, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); btnSendBBS=(Button)getView().findViewById(R.id.btn_jump_submit); initview(); } private void initview() { btnSendBBS.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent intent=new Intent(getActivity(),MakeBBS.class); startActivity(intent); } }); } @Override public void onPause() { super.onPause(); } } ``` ``` 这是logcat: 03-03 20:26:52.056: E/memtrack(3342): Couldn't load memtrack module (No such file or directory) 03-03 20:26:52.056: E/android.os.Debug(3342): failed to load memtrack module: -2 03-03 20:26:52.756: E/InputDispatcher(372): channel '4a9f03c8 net.loonggg.fragment/com.askdoctor.ui.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 03-03 20:26:54.940: E/Icing(685): Error initializing, resetting corpora: Could not create native index 03-03 20:26:55.240: E/Icing(685): Internal init failed 03-03 20:26:55.240: E/Icing(685): Couldn't handle android.intent.action.PACKAGE_REMOVED intent due to initialization failure. 03-03 20:26:55.240: E/Icing(685): Couldn't handle android.intent.action.PACKAGE_ADDED intent due to initialization failure. 03-03 20:26:55.244: E/Icing(685): Couldn't handle android.intent.action.PACKAGE_REPLACED intent due to initialization failure. 03-03 20:26:57.100: E/memtrack(3367): Couldn't load memtrack module (No such file or directory) 03-03 20:26:57.100: E/android.os.Debug(3367): failed to load memtrack module: -2 03-03 20:26:57.944: E/memtrack(3388): Couldn't load memtrack module (No such file or directory) 03-03 20:26:57.944: E/android.os.Debug(3388): failed to load memtrack module: -2 03-03 20:32:09.552: E/CheckinTask(685): Checkin failed: https://android.clients.google.com/checkin (request #0): org.apache.http.conn.ConnectTimeoutException: Connect to /74.125.23.138:443 timed out 03-03 20:35:50.196: E/BandwidthController(138): Updating quota globalAlert failed (No such file or directory) 再次谢谢各位啦!!!
goole map android开发时界面是蓝色的
google map 整个地图界面是蓝色的,在同一个app里面别的activity和fragment是可以正常加载谷歌地图的
android 中的api翻译问题
This version of the pager is best for use when there are a handful of typically more static fragments to be paged through, such as a set of tabs. The fragment of each page the user visits will be kept in memory, though its view hierarchy may be destroyed when not visible. This can result in using a significant amount of memory since fragment instances can hold on to an arbitrary amount of state. For larger sets of pages, consider FragmentStatePagerAdapter. 中的pager在这里是什么意思啊 连接地址:https://developer.android.google.cn/reference/android/support/v13/app/FragmentPagerAdapter.html
Preference Headers不显示
使用Preference-Headers重写PreferenceActivity。但是按照步骤操作之后header没显示,白屏。 XMl: <?xml version="1.0" encoding="utf-8"?> <preference-headers xmlns:android="http://schemas.android.com/apk/res/android"> <preference-headers xmlns:android="http://schemas.android.com/apk/res/android"> <header android:fragment="com.mikebdev.refuel.SettingsActivity$DesignFragment" android:title="@string/pref_header_design" android:summary="@string/pref_header_design_summary" /> <header android:fragment="com.mikebdev.refuel.SettingsActivity$SettingsFragment" android:title="@string/pref_header_units" android:summary="@string/pref_header_units_summary"/> <header android:fragment="com.mikebdev.refuel.SettingsActivity$DatabaseFragment" android:title="@string/pref_header_db" android:summary="@string/pref_header_db_summary"/> </preference-headers> </preference-headers> SettingsActivity内容: import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.os.Environment; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.widget.Toast; import com.google.analytics.tracking.android.EasyTracker; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.List; public class SettingsActivity extends PreferenceActivity { public static final String PREFS_NAME = "RFPref"; public static PreferenceManager prefMgr; @Override public void onBuildHeaders(List<Header> target) { loadHeadersFromResource(R.xml.pref_headers, target); } } 不知道哪里出问题?
Android,Fragment使用AsyncHttpClient数据不显示
先贴代码: NewsFragment.java ``` public class NewsFragment extends Fragment { private final static String TAG = "NewsFragment"; Activity activity; ArrayList<NewsEntity> newsList = new ArrayList<NewsEntity>(); HeadListView mListView; NewsAdapter mAdapter; int channel_id; ImageView detail_loading; public final static int SET_NEWSLIST = 0; /** 此方法意思为fragment是否可见 ,可见时候加载数据 */ @Override public void setUserVisibleHint(boolean isVisibleToUser) { //onCreateView之前调用的 if (isVisibleToUser) { System.out.println("isVisibleToUser"); System.out.println(channel_id); if (channel_id == 0) { channel_id = 1; } initData(); //fragment可见时加载数据 if(newsList !=null && newsList.size() !=0){ System.out.println("newList not null"); handler.obtainMessage(SET_NEWSLIST).sendToTarget(); }else{ System.out.println("newList null"); new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(2); } catch (InterruptedException e) { e.printStackTrace(); } handler.obtainMessage(SET_NEWSLIST).sendToTarget(); } }).start(); } }else{ System.out.println("isNotVisibleToUser"); //fragment不可见时不执行操作 } super.setUserVisibleHint(isVisibleToUser); } // OnPageChangeListener @Override public void onAttach(Activity activity) { System.out.println("news_frag_onAttach"); this.activity = activity; super.onAttach(activity); } @Override public void onCreate(Bundle savedInstanceState) { System.out.println("news_frag_onCreate"); Bundle args = getArguments(); //传值 // text = args != null ? args.getString("text") : ""; channel_id = args != null ? args.getInt("id", 0) : 0; System.out.println("NewsFragment_channel_id:"+channel_id); if (getUserVisibleHint()) { System.out.println("onCreate_getUserVisibleHint"); } super.onCreate(savedInstanceState); } @SuppressLint("InflateParams") @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { System.out.println("news_frag_onCreateView"); View view = LayoutInflater.from(getActivity()).inflate(R.layout.news_fragment, null); mListView = (HeadListView) view.findViewById(R.id.mListView); detail_loading = (ImageView)view.findViewById(R.id.detail_loading); return view; } private void initData() { //newsList.clear(); newsList = Constants2.getNewsList(channel_id); } @SuppressLint("HandlerLeak") Handler handler = new Handler() { @Override public void handleMessage(Message msg) { System.out.println("handler:"+msg.what); switch (msg.what) { case SET_NEWSLIST: detail_loading.setVisibility(View.GONE); if(mAdapter == null){ mAdapter = new NewsAdapter(activity, newsList); //判断是不是城市的频道 if(channel_id == Constants2.CHANNEL_CITY){ //是城市频道 mAdapter.setCityChannel(true); initCityChannel(); } } mListView.setAdapter(mAdapter); mListView.setOnScrollListener(mAdapter); mListView.setPinnedHeaderView(LayoutInflater.from(activity).inflate(R.layout.list_item_section, mListView, false)); mListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new Intent(activity, DetailsActivity.class); if(channel_id == Constants2.CHANNEL_CITY){ if(position != 0){ intent.putExtra("news", mAdapter.getItem(position - 1)); startActivity(intent); activity.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left); } }else{ intent.putExtra("news", mAdapter.getItem(position)); startActivity(intent); activity.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left); } } }); break; default: break; } super.handleMessage(msg); } }; /* 初始化选择城市的header*/ @SuppressLint("InflateParams") public void initCityChannel() { View headview = LayoutInflater.from(activity).inflate(R.layout.city_category_list_tip, null); TextView chose_city_tip = (TextView) headview.findViewById(R.id.chose_city_tip); chose_city_tip.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(activity, CityListActivity.class); startActivity(intent); } }); mListView.addHeaderView(headview); } /* 摧毁视图 */ @Override public void onDestroyView() { super.onDestroyView(); Log.d("onDestroyView", "channel_id = " + channel_id); mAdapter = null; } /* 摧毁该Fragment,一般是FragmentActivity 被摧毁的时候伴随着摧毁 */ @Override public void onDestroy() { super.onDestroy(); Log.d(TAG, "channel_id = " + channel_id); } } ``` Contants2.java ``` public class Constants2 { public static final String GET_NEWS_URL = AppApplication.NEWS_URL+"/getNewsJSON.php"; public static final String GET_Comment_URL = AppApplication.NEWS_URL+"/commentlist.php"; static ArrayList<NewsEntity> newsList = new ArrayList<NewsEntity>(); static ArrayList<CommentEntity> commentList = new ArrayList<CommentEntity>(); static JSONArray jsonArray; static JSONArray commentJsonArray; /* * 获取新闻列表 */ public static ArrayList<NewsEntity> getNewsList(int channel_id) { AsyncHttpClient client = new AsyncHttpClient(); RequestParams params = new RequestParams(); params.add("channel_id", String.valueOf(channel_id)); System.out.println("Constants2_channel_id:"+String.valueOf(channel_id)); client.post(GET_NEWS_URL, params, new AsyncHttpResponseHandler() { @Override public void onSuccess(int i, Header[] handler, byte[] bytes) { String response = new String(bytes); Log.e("debug","response:"+response); try { jsonArray = new JSONArray(response); } catch (JSONException e) { System.err.println("newslist_jsonArray_error"); e.printStackTrace(); } } @Override public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { System.out.println("数据错误!!"); } }); if (jsonArray != null) { System.out.println("/////////////////////////"); System.out.println(jsonArray.length()); newsList.clear(); for(int i =0 ; i < jsonArray.length() ; i++){ try { JSONObject obj = jsonArray.getJSONObject(i); NewsEntity news = new NewsEntity(); news.setId(i); news.setNewsId(obj.getString("newsId")); news.setCollectStatus(false); news.setCommentNum(i + 10); news.setInterestedStatus(true); news.setLikeStatus(true); news.setReadStatus(false); news.setNewsCategory("推荐"); news.setNewsCategoryId(1); news.setSource_url(""); news.setTitle(obj.getString("title")); List<String> url_list = new ArrayList<String>(); news.setPicOne(obj.getString("pic_url")); url_list.add(obj.getString("pic_url")); news.setPicList(url_list); news.setReporter(obj.getString("reporter")); news.setPublishTime(obj.getString("time")); news.setReadStatus(false); news.setSource("手机腾讯网"); news.setContent(obj.getString("content")); news.setSummary("腾讯数码讯(编译:Gin)谷歌眼镜可能是目前最酷的可穿戴数码设备,你可以戴着它去任何地方(只要法律法规允许或是没有引起众怒),作为手机的第二块“增强现实显示屏”来使用。另外,虽然它仍未正式销售,但谷歌近日在美国市场举行了仅限一天的开放购买活动,价格则为1500美元(约合人民币9330元),虽然仍十分昂贵,但至少可以满足一些尝鲜者的需求,也预示着谷歌眼镜的公开大规模销售离我们越来越近了。"); news.setMark(i); news.setIsLarge(false); if(i == 2){ news.setComment("评论部分,说的非常好。"); } // news.setPublishTime(Long.valueOf(obj.getString("time"))); if(i <= 2){ news.setPublishTime(DateTools.getTime()); }else if(i >2 && i <= 5){ news.setPublishTime(String.valueOf(Long.valueOf(DateTools.getTime()) - 86400)); }else{ news.setPublishTime(String.valueOf(Long.valueOf(DateTools.getTime()) - 86400 * 2)); } newsList.add(news); } catch (JSONException e) { e.printStackTrace(); } } } return newsList; } } ``` 流程是这样: 当前fragment可视时通过initData()加载数据,就是调用Constants2的getNewsList(channel_id) 方法,_该方法执行异步任务返回一个newsList,现在的问题是首次加载的时候数据显示,请问有什么解决方法?
Android FindFragmentById 返回值总是null
package com.text.fragmentbestpractice; import java.util.ArrayList; import android.app.Activity; import android.app.Fragment; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; public class TitleFragment extends Fragment implements OnItemClickListener{ private ArrayList<News> newslist; private TitileAdapter newsAdapter; private ListView newsTitleListView; private boolean istwoPane; public void onAttach(Activity activity){ super.onAttach(activity); newslist=setNews(); newsAdapter=new TitileAdapter(activity,R.layout.newsitem,newslist); } @Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){ View view=inflater.inflate(R.layout.newslist, container,false); newsTitleListView=(ListView)view.findViewById(R.id.newslist_view); newsTitleListView.setAdapter(newsAdapter); newsTitleListView.setOnItemClickListener(this); return view; } public void onActivityCreated(Bundle savedInstanceState){ super.onActivityCreated(savedInstanceState); if(getActivity().findViewById(R.id.news_content_layout1)!=null){ //为双页显示 istwoPane=true; }else{ istwoPane=false; } } public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO 自动生成的方法存根 News news=newslist.get(position); if(istwoPane){ ContextFragment newContentFragment=(ContextFragment)getFragmentManager().findFragmentById(R.id.newcontext11); //**为什么getFragmentManager().findFragmentById返回值总是null** if(newContentFragment==null){ Log.e("MyFragment", "newContentFragment is null"); return; } newContentFragment.refresh(news.getTitle(), news.getContext()); }else{ NewsContextActivity.actionStart(getActivity(), news.getTitle(), news.getContext()); } } public ArrayList<News> setNews(){ newslist=new ArrayList<News>(); News news1=new News(); news1.setTitle("Android is Winner"); news1.setContext("Android is Winner"); newslist.add(news1); News news2=new News(); news2.setTitle("Google Android exec poached by China's Xiaomi"); news2.setContext("China's Xiaomi has poached a key Google executive for the rapidly growing Chinese smartphone maker."); newslist.add(news2); return newslist; } } ``` ```
ViewPager+Fragment+ListView启动后第一个页面是空白,怎么改进解决?
ViewPager+Fragment(4个)+ListView启动后第一个页面是空白。 首先说明的是当listview里面的adapter不用callback的方法获取json的时候,一切都是正常的。 当4个fragment中只有一个listview的时候,用callback方法也是正常的,但是两个fragement中都有listview的时候,比如fragment1 & fragment2中各有一个listview,然后每个都callback就不行了,但是滑动一下,有时就可以了。 先说目录结构:MainActivity ,fragmentone,fragmentone2... 上代码: package com.example.viewpagerdemo; import java.util.ArrayList; import android.content.Context; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.widget.Button; import android.widget.Toast; import com.example.viewpagerdemo.myadapter.MyFragmentPagerAdapter; public class MainActivity extends FragmentActivity implements OnClickListener, OnPageChangeListener { private ViewPager mViewPager; private Button bt_list1, bt_list2, bt_list3, bt_list4; private ArrayList<Fragment> list = null; private Context mContext; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.mainwin); mContext=MainActivity.this; initView(); initEvent(); } private void initView() { mViewPager = (ViewPager) findViewById(R.id.vpager); bt_list1 = (Button) findViewById(R.id.button1); bt_list2 = (Button) findViewById(R.id.button2); bt_list3 = (Button) findViewById(R.id.button3); bt_list4 = (Button) findViewById(R.id.button4); fragmentone fg1 = new fragmentone(); fragmenttwo fg2 = new fragmenttwo(); fragmentthree fg3 = new fragmentthree(); fragmentfour fg4 = new fragmentfour(); list = new ArrayList<Fragment>(); list.add(fg1); list.add(fg2); list.add(fg3); list.add(fg4); mViewPager.setAdapter(new MyFragmentPagerAdapter( getSupportFragmentManager(), list)); } private void initEvent() { mViewPager.setCurrentItem(0); bt_list1.setOnClickListener(this); bt_list2.setOnClickListener(this); bt_list3.setOnClickListener(this); bt_list4.setOnClickListener(this); mViewPager.setOnPageChangeListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.button1: mViewPager.setCurrentItem(0); Toast.makeText(mContext, "当前选择:1",Toast.LENGTH_SHORT).show(); break; case R.id.button2: mViewPager.setCurrentItem(1); Toast.makeText(mContext, "当前选择:2",Toast.LENGTH_SHORT).show(); break; case R.id.button3: mViewPager.setCurrentItem(2); Toast.makeText(mContext, "当前选择:3",Toast.LENGTH_SHORT).show(); break; case R.id.button4: mViewPager.setCurrentItem(3); Toast.makeText(mContext, "当前选择:4",Toast.LENGTH_SHORT).show(); break; } } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); } @Override protected void onResume() { // TODO Auto-generated method stub mViewPager.setCurrentItem(1); mViewPager.setCurrentItem(0); super.onResume(); } @Override public void onPageScrollStateChanged(int state) { // TODO Auto-generated method stub if (state==2) { Toast.makeText(mContext, "当前选择:"+(mViewPager.getCurrentItem()+1),Toast.LENGTH_SHORT).show(); } } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { // TODO Auto-generated method stub } @Override public void onPageSelected(int arg0) { // TODO Auto-generated method stub //Toast.makeText(mContext, "当前选择:"+mViewPager.getCurrentItem(),Toast.LENGTH_SHORT); } } fragmentone: package com.example.viewpagerdemo; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import android.content.Context; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ListView; import android.widget.Toast; import com.example.viewpagerdemo.myCallBack.HttpUtil; import com.example.viewpagerdemo.myCallBack.ResultCallback; import com.example.viewpagerdemo.myadapter.ListAdapterOne; import com.example.viewpagerdemo.mybean.BaseBean; import com.example.viewpagerdemo.mybean.BeanOneArrayList; import com.example.viewpagerdemo.mybean.ListBeanOne; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; /** * fragment 1 * * @author dy * */ public class fragmentone extends Fragment { private Context mContext; private View viewOne; private ListView mListViewOne; private List<ListBeanOne> allDataOne; private ListAdapterOne oneAdapter; private ResultCallback callback = new ResultCallback() { @Override public void getReslt(String result) { // TODO Auto-generated method stub BaseBean b = HttpUtil.getData(mContext, result, "", ""); if (b.getResponsecode() == 1) { Type type = new TypeToken<BeanOneArrayList>() { }.getType(); Gson gson = new Gson(); BeanOneArrayList json = gson.fromJson(result, type); allDataOne = json.getData(); if (allDataOne.size() > 0) { oneAdapter = new ListAdapterOne(mContext, allDataOne); mListViewOne.setAdapter(oneAdapter); /* * Message message = new Message(); message.what=1; * mHandler.sendMessage(message); */ } else { Log.i("tag", "No Data"); } } } }; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (viewOne != null) { ViewGroup parentViewGroup = (ViewGroup) viewOne.getParent(); if (parentViewGroup != null) { parentViewGroup.removeAllViewsInLayout(); } } else { viewOne = inflater.inflate(R.layout.fg1, container, false); } initView(); initEvent(); return viewOne; } private void initView() { mContext = this.getActivity(); mListViewOne = (ListView) viewOne.findViewById(R.id.listView1); } private void initEvent() { String JsonURL = AppConst.ListURL1; List<NameValuePair> p = new ArrayList<NameValuePair>(); p.add(new BasicNameValuePair("action", "1")); HttpUtil.doPost(JsonURL, p, callback); } } fragmenttwo: package com.example.viewpagerdemo; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import android.content.Context; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ListView; import com.example.viewpagerdemo.myCallBack.HttpUtil; import com.example.viewpagerdemo.myCallBack.ResultCallback; import com.example.viewpagerdemo.myadapter.ListAdapterOne; import com.example.viewpagerdemo.myadapter.ListAdapterTwo; import com.example.viewpagerdemo.mybean.BaseBean; import com.example.viewpagerdemo.mybean.BeanTwoArrayList; import com.example.viewpagerdemo.mybean.ListBeanTwo; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; /** * fragment 2 * * @author dy * */ public class fragmenttwo extends Fragment { private Context mContext; private View viewTwo; private ListView mListViewTwo; private List<ListBeanTwo> allDataTwo; private ListAdapterTwo twoAdapter; private ResultCallback callback = new ResultCallback() { @Override public void getReslt(String result) { // TODO Auto-generated method stub BaseBean b = HttpUtil.getData(mContext, result, "", ""); if (b.getResponsecode() == 1) { Type type = new TypeToken<BeanTwoArrayList>() { }.getType(); Gson gson = new Gson(); BeanTwoArrayList json = gson.fromJson(result, type); allDataTwo = json.getData(); if (allDataTwo.size() > 0) { twoAdapter = new ListAdapterTwo(mContext, allDataTwo); mListViewTwo.setAdapter(twoAdapter); /* * Message message = new Message(); message.what=1; * mHandler.sendMessage(message); */ } else { Log.i("tag", "No Data"); } } } }; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (viewTwo != null) { ViewGroup parentViewGroup = (ViewGroup) viewTwo.getParent(); if (parentViewGroup != null) { parentViewGroup.removeAllViewsInLayout(); } } else { viewTwo = inflater.inflate(R.layout.fg2, container, false); } initView(); initEvent(); return viewTwo; } private void initView() { mContext = this.getActivity(); mListViewTwo = (ListView) viewTwo.findViewById(R.id.listView2); } private void initEvent() { String JsonURL = AppConst.ListURL1; List<NameValuePair> p = new ArrayList<NameValuePair>(); p.add(new BasicNameValuePair("action", "2")); HttpUtil.doPost(JsonURL, p, callback); } } MyFragmentPagerAdapter: package com.example.viewpagerdemo.myadapter; import java.util.ArrayList; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; public class MyFragmentPagerAdapter extends FragmentPagerAdapter { private ArrayList<Fragment> list; public MyFragmentPagerAdapter(FragmentManager fm) { super(fm); } public MyFragmentPagerAdapter(FragmentManager fm, ArrayList<Fragment> list) { super(fm); this.list = list; } @Override public Fragment getItem(int arg0) { // TODO Auto-generated method stub return list.get(arg0); } @Override public int getCount() { // TODO Auto-generated method stub return list.size(); } } ``` ``` 其他的代码都是类似的,就不发了。 ``` ```
Android studio 混淆代码
混淆代码直接报 Information:Gradle tasks [:app:assembleRelease] :MyLibray:compileLint :MyLibray:copyReleaseLint UP-TO-DATE :MyLibray:preBuild UP-TO-DATE :MyLibray:preReleaseBuild UP-TO-DATE :MyLibray:checkReleaseManifest :MyLibray:preDebugAndroidTestBuild UP-TO-DATE :MyLibray:preDebugBuild UP-TO-DATE :MyLibray:preDebugUnitTestBuild UP-TO-DATE :MyLibray:preReleaseUnitTestBuild UP-TO-DATE :MyLibray:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE :MyLibray:prepareComAndroidSupportSupportV42301Library UP-TO-DATE :MyLibray:prepareReleaseDependencies :MyLibray:compileReleaseAidl UP-TO-DATE :MyLibray:compileReleaseRenderscript UP-TO-DATE :MyLibray:generateReleaseBuildConfig UP-TO-DATE :MyLibray:generateReleaseAssets UP-TO-DATE :MyLibray:mergeReleaseAssets UP-TO-DATE :MyLibray:generateReleaseResValues UP-TO-DATE :MyLibray:generateReleaseResources UP-TO-DATE :MyLibray:mergeReleaseResources UP-TO-DATE :MyLibray:processReleaseManifest UP-TO-DATE :MyLibray:processReleaseResources UP-TO-DATE :MyLibray:generateReleaseSources UP-TO-DATE :MyLibray:processReleaseJavaRes UP-TO-DATE :MyLibray:compileReleaseJavaWithJavac UP-TO-DATE :MyLibray:extractReleaseAnnotations UP-TO-DATE :MyLibray:mergeReleaseProguardFiles UP-TO-DATE :MyLibray:packageReleaseJar UP-TO-DATE :MyLibray:compileReleaseNdk UP-TO-DATE :MyLibray:packageReleaseJniLibs UP-TO-DATE :MyLibray:packageReleaseLocalJar UP-TO-DATE :MyLibray:packageReleaseRenderscript UP-TO-DATE :MyLibray:packageReleaseResources UP-TO-DATE :MyLibray:bundleRelease UP-TO-DATE :app:preBuild UP-TO-DATE :app:preReleaseBuild UP-TO-DATE :app:checkReleaseManifest :app:preDebugBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE :app:prepareComAndroidSupportMultidex101Library UP-TO-DATE :app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE :app:prepareComCjjMaterialrefeshlayoutLibrary130Library UP-TO-DATE :app:prepareFinancialPHKXMyLibrayUnspecifiedLibrary UP-TO-DATE :app:prepareReleaseDependencies :app:compileReleaseAidl UP-TO-DATE :app:compileReleaseRenderscript UP-TO-DATE :app:generateReleaseBuildConfig UP-TO-DATE :app:generateReleaseAssets UP-TO-DATE :app:mergeReleaseAssets UP-TO-DATE :app:generateReleaseResValues UP-TO-DATE :app:generateReleaseResources UP-TO-DATE :app:mergeReleaseResources UP-TO-DATE :app:processReleaseManifest UP-TO-DATE :app:processReleaseResources UP-TO-DATE :app:generateReleaseSources UP-TO-DATE :app:processReleaseJavaRes UP-TO-DATE :app:compileReleaseJavaWithJavac UP-TO-DATE :app:compileReleaseNdk UP-TO-DATE :app:compileReleaseSources UP-TO-DATE :app:collectReleaseMultiDexComponents UP-TO-DATE :app:proguardRelease UP-TO-DATE :app:shrinkReleaseMultiDexComponents FAILED Error:Execution failed for task ':app:shrinkReleaseMultiDexComponents'. > java.io.IOException: The output jar [F:\save\YGJY\FinancialYGJY\app\build\intermediates\multi-dex\release\componentClasses.jar] must be specified after an input jar, or it will be empty. Information:BUILD FAILED Information:Total time: 1.666 secs Information:1 error Information:0 warnings Information:See complete output in console 这是什么意思? 下面是混淆代码,我基本都屏蔽了! -keep public class * extends android.app.Fragment -keep public class * extends android.app.Activity -keep public class * extends android.app.Application -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.content.ContentProvider -keep public class * extends android.app.backup.BackupAgentHelper -keep public class * extends android.preference.Preference -keep public class * extends android.support.v4.** -keepclasseswithmembernames class * { # 保持 native 方法不被混淆 native <methods>; } -keepclasseswithmembers class * { # 保持自定义控件类不被混淆 public <init>(android.content.Context, android.util.AttributeSet); } -keepclasseswithmembers class * {# 保持自定义控件类不被混淆 public <init>(android.content.Context, android.util.AttributeSet, int); } -keepclassmembers class * extends android.app.Activity { # 保持自定义控件类不被混淆 public void *(android.view.View); } -keepclassmembers enum * { # 保持枚举 enum 类不被混淆 public static **[] values(); public static ** valueOf(java.lang.String); } -keep class * implements android.os.Parcelable { # 保持 Parcelable 不被混淆 public static final android.os.Parcelable$Creator *; } -keep public class * implements java.io.Serializable{ public protected private *; } -keep class com.baidu.**{*;} -dontwarn com.baidu.** -keep class com.google.gson.**{*;} -dontwarn com.google.gson.** #bcprov-ext-jdk15on -dontwarn org.bouncycastle.** #commons-lang-2.4 -dontwarn org.apache.commons.lang.** #adnroid-async-http-1.4.8 -dontwarn com.loopj.android.http.** #androidquery -dontwarn com.androidquery.** #esb -dontwarn com.hansy.qhxg.restClient.** #gson-2.2.4 -dontwarn com.google.gson.** #httpcore-4.3.jar -dontwarn org.apache.http.** #slf4j-api-1.7.5 -dontwarn org.slf4j.** #universal-img-loader -dontwarn com.nostra13.universalimageloader.**
android studio 混淆文件配置
![据说android studio 默认将libs的第三方jar包忽略混淆,所以就没有将类似#-libraryjars libs/umeng-analytics-v5.2.4.jar的操作写入到配置文件,只是将-keep class com.umeng.**{*;}和忽略警告的操作写入配置文件。但是发现gradle在.idea/libraries中引入了其他很多jar包以及这些包的存储地址。刚好程序报错中的com.b.a.a.a 就是指的idea/libraries中的一个包中的类,即为com.loopj.android.http.AsyncHttpClient,不知道怎么在混淆配置文件中忽略这些包的混淆。最后通过配置,发现这些包还是被混淆了,不知道怎么才能配置好这些包不被混淆](https://img-ask.csdn.net/upload/201511/10/1447140316_8891.jpg) 下面是我的配置文件: -optimizationpasses 5 -dontusemixedcaseclassnames -verbose -dontpreverify -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* -keepattributes *Annotation* -keepattributes Signature -keep class android.**{*;} -keep public class * extends android.view -keep public class * extends android.app.Fragment -keep public class * extends android.app.Activity -keep public class * extends android.app.Application -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.content.ContentProvider -keep public class * extends android.app.backup.BackupAgentHelper -keep public class * extends android.preference.Preference -keep public class * extends android.support.V4.** -keep public class * extends android.vending.licensing.ILicensingService -dontwarn android.support.v4.** -keep class * extends android.support.v4.**{*;} -dontwarn android.support.v7.** -keep class * extends android.support.v7.**{*;} /* 将libs文件下的三方包忽略混淆*/ -keep class com.mob.logcolletor.**{ *;} -dontwarn com.mob.tools.** -keep class com.mob.tools.**{ *;} -dontwarn com.mob.baidu.** -keep class com.mob.baidu.**{ *;} -dontwarn cn.sharesdk.framework.** -keep class cn.sharesdk.framework.**{ *;} -dontwarn cn.sharesdk.system.email.** -keep class cn.sharesdk.system.email.**{ *;} -dontwarn cn.sharesdk.tencent.qq.** -keep class cn.sharesdk.tencent.qq.**{ *;} -dontwarn cn.sharesdk.system.text.** -keep class cn.sharesdk.system.text.**{ *;} -dontwarn cn.sharesdk.wechat.friends.** -keep class cn.sharesdk.wechat.friends.**{ *;} -dontwarn cn.sharesdk.wechat.utils.** -keep class cn.sharesdk.wechat.utils.**{ *;} -dontwarn cn.sharesdk.wechat.favorite.** -keep class cn.sharesdk.wechat.favorite.**{ *;} -dontwarn cn.sharesdk.wechat.moments.** -keep class cn.sharesdk.wechat.moments.**{ *;} -dontwarn com.tencent.** -keep class com.tencent..**{ *;} -keep public interface com.mob.logcolletor.** -keep public interface com.mob.tools.** -keep public interface com.mob.baidu.** -keep public interface cn.sharesdk.framework.** -keep public interface cn.sharesdk.system.email.** -keep public interface cn.sharesdk.tencent.qq.** -keep public interface cn.sharesdk.system.text.** -keep public interface cn.sharesdk.wechat.friends.** -keep public interface cn.sharesdk.wechat.utils.** -keep public interface cn.sharesdk.wechat.favorite.** -keep public interface cn.sharesdk.wechat.moments.** -keepclasseswithmembernames class * { native <methods>; } -keepclassmembers public class * extends android.view.View { void set*(***); *** get*(); } -keepclasseswithmembernames class * { void onClick*(...); } -keepclasseswithmembernames class * { *** *Callback(...); } -keepclasseswithmembernames class * { public <init>(android.content.Context,android.util.AttributeSet,int); } -keepclasseswithmembernames class * { public <init>(android.content.Context,android.util.AttributeSet); } -keepclassmembers class * extends android.app.Activity { public void *(android.view.View); } -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } -keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; } -keep class org.apache.http.**{*;} -keepclassmembers class **.R$* { public static <fields>; } /* 将External Libraries文件下的三方包忽略混淆*/ -libraryjars $USER_HOME$/.gradle/caches/modules-2/files-2.1/com.loopj.android/android-async-http/1.4.8/77bbfe240e437ecb396d982afa0d3bd4f9090ba7/android-async-http-1.4.8.jar -libraryjars $USER_HOME$/.gradle/caches/modules-2/files-2.1/com.loopj.android/android-async-http/1.4.8/ec314dce534e83c93364388d023625bb8e605e38/android-async-http-1.4.8-sources.jar! -libraryjars build/intermediates/exploded-aar/com.soundcloud.android/android-crop/1.0.0/jars/classes.jar -libraryjars build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.0/jars/classes.jar -libraryjars $USER_HOME$/Documents/androidWorkSpace/android-sdk-macosx/extras/android/m2repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0-sources.jar -libraryjars $USER_HOME$/.gradle/caches/modules-2/files-2.1/com.jakewharton/butterknife/7.0.1/d5d13ea991eab0252e3710e5df3d6a9d4b21d461/butterknife-7.0.1.jar -libraryjars $USER_HOME$/.gradle/caches/modules-2/files-2.1/com.jakewharton/butterknife/7.0.1/ad53343e57ae0969aaf451a19eef381abe2ad3a1/butterknife-7.0.1-sources.jar -libraryjars build/intermediates/exploded-aar/com.android.support/cardview-v7/23.0.0/jars/classes.jar -libraryjars $USER_HOME$/Documents/androidWorkSpace/android-sdk-macosx/extras/android/m2repository/com/android/support/cardview-v7/23.0.0/cardview-v7-23.0.0-sources.jar -libraryjars build/intermediates/exploded-aar/com.android.support/design/23.0.0/jars/classes.jar -libraryjars $USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.bumptech.glide/glide/3.6.1/86b122e640af09b0723e1fa44083c354ba6d9089/glide-3.6.1.jar -libraryjars $USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.bumptech.glide/glide/3.6.1/c84c6f18844d9ae76308619008d40277de5e77d3/glide-3.6.1-sources.jar -libraryjars $USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.3/5fc52c41ef0239d1093a1eb7c3697036183677ce/gson-2.3.jar -libraryjars $USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.3/21e31b9298ed677b17fcac6dd0eb0a82ec35adc2/gson-2.3-sources.jar -libraryjars $USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.3.2/31fbbff1ddbf98f3aa7377c94d33b0447c646b6e/httpcore-4.3.2.jar -libraryjars $USER_HOME$/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.3.2/4809f38359edeea9487f747e09aa58ec8d3a54c5/httpcore-4.3.2-sources.jar -libraryjars build/intermediates/exploded-aar/com.rengwuxian.materialedittext/library/2.1.4/jars/classes.jar -libraryjars $USER_HOME$/.gradle/caches/modules-2/files-2.1/com.nineoldandroids/library/2.4.0/e9b63380f3a242dbdbf103a2355ad7e43bad17cb/library-2.4.0.jar -libraryjars $USER_HOME$/.gradle/caches/modules-2/files-2.1/com.nineoldandroids/library/2.4.0/83d41901478fa8795254244acbafd03f14224dab/library-2.4.0-sources.jar -libraryjars build/intermediates/exploded-aar/com.orhanobut/logger/1.10/jars/classes.jar -libraryjars build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.0.0/jars/classes.jar -libraryjars $USER_HOME$/Documents/androidWorkSpace/android-sdk-macosx/extras/android/m2repository/com/android/support/recyclerview-v7/23.0.0/recyclerview-v7-23.0.0-sources.jar -libraryjars $USER_HOME$/Documents/androidWorkSpace/android-sdk-macosx/extras/android/m2repository/com/android/support/support-annotations/23.0.0/support-annotations-23.0.0.jar -libraryjars $USER_HOME$/Documents/androidWorkSpace/android-sdk-macosx/extras/android/m2repository/com/android/support/support-annotations/23.0.0/support-annotations-23.0.0-sources.jar -libraryjars build/intermediates/exploded-aar/com.android.support/support-v4/23.0.0/jars/classes.jar -libraryjars build/intermediates/exploded-aar/com.android.support/support-v4/23.0.0/jars/libs/internal_impl-23.0.0.jar -libraryjars $USER_HOME$/Documents/androidWorkSpace/android-sdk-macosx/extras/android/m2repository/com/android/support/support-v4/23.0.0/support-v4-23.0.0-sources.jar -dontwarn com.loopj.android.http.** -keep class com.loopj.android.http.**{ *;} -dontwarn com.baidu.** -keep class com.baidu.**{ *;} -dontwarn com.bumptech.glide.** -keep class com.bumptech.glide.**{ *;} -dontwarn com.google.gson.** -keep class com.google.gson.http.**{ *;} -dontwarn com.nineoldandroids.** -keep class com.nineoldandroids.**{ *;} -dontwarn com.orhanobut.logger.** -keep class com.orhanobut.logger.**{ *;} -dontwarn com.rengwuxian.materialedittext.** -keep class com.rengwuxian.materialedittext.**{ *;} -dontwarn com.soundcloud.android.crop.** -keep class com.soundcloud.android.crop.**{ *;} -ignorewarning -dump class_files.txt -printseeds seeds.txt -printusage unused.txt -printmapping mapping.txt
正在学习android的第一行代码的coolweather遇到了点问题
ChooseAreaFragment代码 import android.app.ProgressDialog; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import androidx.appcompat.widget.ButtonBarLayout; import androidx.fragment.app.Fragment; import com.example.coolweather.db.City; import com.example.coolweather.db.County; import com.example.coolweather.db.Province; import com.example.coolweather.util.HttpUtil; import com.example.coolweather.util.Utility; import org.litepal.crud.DataSupport; import java.io.IOException; import java.util.ArrayList; import java.util.List; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Response; public class ChooseAreaFrament extends Fragment { public static final int LEVEL_PROVINCE = 0; public static final int LEVEL_CITY=1; public static final int LEVEL_COUNTY = 2; private ProgressDialog progressDialog; private TextView titleText; private Button backButton; private ListView listView; private ArrayAdapter<String> adapter; private List<String> dataList = new ArrayList<>(); /** * 省列表 */ private List<Province> provinceList; /** * 市列表 */ private List<City> cityList; /** * 县列表 */ private List<County>countyList; /** * 选中的省份 */ private Province selectedProvince; /** * 选中的城市 */ private City selectedCity; /** * 当前选中的级别 */ private int currentLevel; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.choose_area,container,false); titleText = (TextView) view.findViewById(R.id.title_text); backButton = (Button) view.findViewById(R.id.back_button); listView = (ListView)view.findViewById(R.id.list_view); adapter = new ArrayAdapter<>(getContext(),android.R.layout.simple_list_item_1,dataList); listView.setAdapter(adapter); return view; } @Override public void onActivityCreated(Bundle savedInstanceState){ super.onActivityCreated(savedInstanceState); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if(currentLevel == LEVEL_PROVINCE){ selectedProvince = provinceList.get(position); queryCities(); } else if (currentLevel == LEVEL_CITY) { selectedCity = cityList.get(position); queryCounties(); } } }); backButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (currentLevel == LEVEL_COUNTY) { queryCities(); } else if (currentLevel == LEVEL_CITY){ queryProvinces(); } } }); queryProvinces(); } /** * 查询全国所有的省,优先数据库查询,如果没有查询到再去服务器上查询 */ private void queryProvinces(){ titleText.setText("中国"); backButton.setVisibility(View.GONE); provinceList = DataSupport.findAll(Province.class); if (provinceList.size() > 0){ dataList.clear(); for (Province province : provinceList){ dataList.add(province.getProvinceName()); } adapter.notifyDataSetChanged(); listView.setSelection(0); currentLevel = LEVEL_PROVINCE; } else { String address = "http://guolin.tech/api/china"; queryFromServer(address,"province"); } } /** * 查询全国所有的城市,优先数据库查询,如果没有查询到再去服务器上查询 */ private void queryCities(){ titleText.setText(selectedProvince.getProvinceName()); backButton.setVisibility(View.VISIBLE); cityList = DataSupport.where("provinceid = ?",String.valueOf(selectedProvince. getId())).find(City.class); if(cityList.size() > 0){ dataList.clear(); for(City city : cityList){ dataList.add(city.getCityName()); } adapter.notifyDataSetChanged(); listView.setSelection(0); currentLevel = LEVEL_CITY; }else{ int provinceCode = selectedProvince.getProvinceCode(); String address = "http://guolin.tech/api/china/" + provinceCode; queryFromServer(address,"city"); } } /** * 查询全国所有的县,优先数据库查询,如果没有查询到再去服务器上查询 */ private void queryCounties(){ titleText.setText(selectedCity.getCityName()); backButton.setVisibility(View.VISIBLE); countyList = DataSupport.where("cityid = ?",String.valueOf(selectedCity. getId())).find(County.class); if(countyList.size() > 0 ){ dataList.clear(); for(County county : countyList){ dataList.add(county.getCountyName()); } adapter.notifyDataSetChanged(); listView.setSelection(0); currentLevel = LEVEL_COUNTY; }else{ int provinceCode = selectedProvince.getProvinceCode(); int cityCode = selectedCity.getCityCode(); String address = "http://guolin.tech/api/china/" + provinceCode + "/" + cityCode; queryFromServer(address,"county"); } } /** * 根据传入的地址和类型从服务器上查询省市县数据 */ private void queryFromServer(String address,final String type){ showProgressDialog(); HttpUtil.sendOkHttpRequest(address, new Callback() { @Override public void onResponse(Call call, Response response) throws IOException { String responseText = response.body().string(); boolean result = false; if("province".equals(type)){ result = Utility.handleProvinceResponse(responseText); } else if ("city".equals(type)){ result = Utility.handleCityResponse(responseText,selectedProvince.getId()); } else if ("county".equals(type)){ result = Utility.handleCountyResponse(responseText,selectedCity.getId()); } if (result){ getActivity().runOnUiThread(new Runnable() { @Override public void run() { closeProgressDialog(); if ("province".equals(type)){ queryProvinces(); } else if ("city".equals(type)){ queryCities(); } else if ("county".equals(type)) queryCounties(); } }); } } @Override public void onFailure(Call call, IOException e) { //通过runOnUiTread()方法回到主线程处理逻辑 getActivity().runOnUiThread(new Runnable() { @Override public void run() { closeProgressDialog(); Toast.makeText(getContext(),"加载失败",Toast.LENGTH_SHORT).show(); } }); } }); } /** * 显示进度对话框 */ private void showProgressDialog(){ if (progressDialog == null){ progressDialog = new ProgressDialog(getActivity()); progressDialog.setMessage("正在加载..."); progressDialog.setCanceledOnTouchOutside(false); } progressDialog.show(); } /** * 关闭进度对话框 */ private void closeProgressDialog(){ if (progressDialog != null){ progressDialog.dismiss(); } } Utility代码 import android.text.TextUtils; import com.example.coolweather.db.City; import com.example.coolweather.db.County; import com.example.coolweather.db.Province; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public class Utility { /** * 解析和处理服务器返回的省级数据 */ public static boolean handleProvinceResponse(String response){ if (!TextUtils.isEmpty(response)){ try { JSONArray allProvinces = new JSONArray(response); for (int i = 0;i<allProvinces.length();i++){ JSONObject provinceObject = allProvinces.getJSONObject(i); Province province = new Province(); province.setProvinceName(provinceObject.getString("name")); province.setProvinceCode(provinceObject.getInt("id")); province.save(); } return true; } catch (JSONException e) { e.printStackTrace(); } } return false; } /** * 解析服务器和处理器返回的市级数据 */ public static boolean handleCityResponse(String response,int provinceId){ if(!TextUtils.isEmpty(response)){ try { JSONArray allCities = new JSONArray(response); for(int i=0;i<allCities.length();i++){ JSONObject cityObject = allCities.getJSONObject(i); City city = new City(); city.setCityName(cityObject.getString("name")); city.setCityCode(cityObject.getInt("id")); city.setProvinceId(provinceId); city.save(); } return true; } catch (JSONException e) { e.printStackTrace(); } } return false; } public static boolean handleCountyResponse(String response, int cityId){ if(TextUtils.isEmpty(response)){ try { JSONArray allCounties = new JSONArray(response); for(int i=0;i<allCounties.length();i++){ JSONObject countyObject = allCounties.getJSONObject(i); County county = new County(); county.setCountyName(countyObject.getString("name")); county.setWeatherId(countyObject.getString("weather_id")); county.setCityId(cityId); county.save(); } return true; } catch (JSONException e) { e.printStackTrace(); } } return false; } 复制代码 } HttpUtil代码 import okhttp3.OkHttpClient; import okhttp3.Request; public class HttpUtil { public static void sendOkHttpRequest(String address,okhttp3.Callback callback) { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder().url(address).build(); client.newCall(request).enqueue(callback); } 复制代码 } app apply plugin: 'com.android.application' android { compileSdkVersion 29 buildToolsVersion "29.0.2" defaultConfig { applicationId "com.example.coolweather" minSdkVersion 15 targetSdkVersion 29 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } sourceSets { main { jniLibs.srcDirs = ['libs'] } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'org.litepal.android:core:1.4.1' implementation 'com.squareup.okhttp3:okhttp:3.4.1' implementation 'com.google.code.gson:gson:2.7' implementation 'com.github.bumptech.glide:glide:3.7.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' } debug到这里就动不了![图片说明](https://img-ask.csdn.net/upload/201908/14/1565753464_912183.png)
维护很久前的项目 莫名其妙的导入design
前几天维护一个很久前的项目,想转到安卓x,结果对jar包升级的时候有一个design一直存在,并且报错把jar包转移到新项目中也不会出现这个design 下面贴图![图片说明](https://img-ask.csdn.net/upload/201912/07/1575657133_874940.jpg) apply plugin: 'com.android.application' apply plugin: "findbugs" /*apply from: 'tinker-support.gradle' apply plugin: 'packer'*/ task findbugs(type: FindBugs, dependsOn: 'assembleDebug') { ignoreFailures = true effort = "default" reportLevel = "high" println("$project.buildDir") classes = files("$project.buildDir/intermediates/classes") source = fileTree("src/main/java/") classpath = files() reports { xml.enabled = false html.enabled = true xml { destination file ("$project.buildDir/findbugs.xml") } html { destination file("$project.buildDir/findbugs.html") } } } android { lintOptions { checkReleaseBuilds false abortOnError false } compileSdkVersion 29 buildToolsVersion "29.0.2" sourceSets { main { jniLibs.srcDir 'libs' } // Move the tests to tests/java, tests/res, etc... //instrumentTest.setRoot('tests') // Move the build types to build-types/<type> // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src/<type>/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } defaultConfig { applicationId "com.goodlive.flying" minSdkVersion 21 targetSdkVersion 29 versionCode 20180228 versionName "1.5.9" //versionName "1.5.2"正式版 // Enabling multidex support. multiDexEnabled true ndk { // 设置支持的SO库架构 abiFilters 'armeabi' , 'x86'//, 'armeabi-v7a', 'x86_64', 'arm64-v8a' } } dexOptions { javaMaxHeapSize "4g" } signingConfigs { release { storeFile file('.jks') storePassword "" keyAlias "" keyPassword "" // 满足下面两个条件时需要此配置 // 1. Gradle版本 >= 2.14.1 // 2. Android Gradle Plugin 版本 >= 2.2.0 // 作用是只使用旧版签名,禁用V2版签名模式 v2SigningEnabled false } debug { storeFile file('.jks') storePassword "" keyAlias "" keyPassword "" } } buildTypes { release { //启用混淆配置 //Zip代码压缩优化 // zipAlignEnabled true //移除无用资源 // shrinkResources true // debuggable true //加载默认混淆文件 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release } debug { //启用混淆配置 minifyEnabled false //Zip代码压缩优化 // zipAlignEnabled true //移除无用资源 // shrinkResources true //debugs使用release签名 //加载默认混淆文件 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(path: ':PushSDK') implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' // implementation files('libs/SocialSDK_WeiXin_Full.jar') //dagger2 implementation 'com.qianwen:update-app:3.3.3' implementation 'com.lzy.net:okgo:3.0.4' implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.recyclerview:recyclerview:1.1.0' implementation 'androidx.cardview:cardview:1.0.0' implementation ('com.google.android.material:material:1.0.0'){ exclude group: 'com.android.support' } implementation ('com.jakewharton:butterknife:8.1.0'){ exclude group: 'com.android.support' } implementation 'com.android.support:multidex:1.0.3' implementation 'com.mcxiaoke.gradle:packer-helper:1.0.9' implementation ('com.github.bumptech.glide:glide:4.0.0-RC0'){ exclude group: 'com.android.support' } implementation 'com.tencent.bugly:crashreport_upgrade:1.4.2' //w implementation ('com.github.lygttpod:SuperTextView:1.0.7'){ exclude group: 'com.android.support' } implementation 'com.orhanobut:logger:1.15' //w implementation ('com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.13'){ exclude group: 'com.android.support' } implementation 'com.blankj:utilcode:1.3.1' implementation 'cn.finalteam:galleryfinal:1.4.8.7' implementation 'com.google.code.gson:gson:2.8.2' implementation 'org.greenrobot:eventbus:3.0.0' implementation 'com.squareup.okhttp3:okhttp:3.10.0' implementation 'com.roughike:bottom-bar:2.0.2' implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1' implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1' implementation 'io.reactivex:rxandroid:1.2.1' implementation 'io.reactivex:rxjava:1.2.1' implementation 'com.squareup.retrofit2:retrofit:2.1.0' implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0' implementation 'com.squareup.retrofit2:converter-gson:2.1.0' implementation 'com.trello:rxlifecycle-components:0.6.1' implementation 'com.jakewharton.rxbinding:rxbinding:0.4.0' implementation 'com.jakewharton.rxbinding:rxbinding-appcompat-v7:0.3.0' implementation 'com.jakewharton.rxbinding:rxbinding-design:0.3.0' implementation 'com.facebook.stetho:stetho:1.5.0' implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0' implementation 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE' implementation 'me.shaohui.advancedluban:library:1.3.3' implementation 'com.dinuscxj:recycleritemdecoration:1.0.0' implementation 'com.umeng.analytics:analytics:6.1.4' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.zhy:flowlayout-lib:1.0.3' implementation 'com.afollestad.material-dialogs:core:0.9.4.5' implementation 'com.google.dagger:dagger:2.11-rc2' implementation 'se.emilsjolander:stickylistheaders:2.7.0' testImplementation 'junit:junit:4.12' implementation 'com.bigkoo:quicksidebar:1.0.3' annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0' annotationProcessor 'com.jakewharton:butterknife-compiler:8.1.0' annotationProcessor 'com.google.dagger:dagger-compiler:2.11-rc2' implementation 'com.github.razerdp:BasePopup:1.9.1' implementation 'com.makeramen:roundedimageview:2.3.0' implementation("com.github.hotchemi:permissionsdispatcher:3.1.0") { // if you don't use android.app.Fragment you can exclude support for them exclude module: "support-v13" } annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:3.1.0" } ``` 求助大神啊 ```
调用外部API不成功,显示的什么执行时间长,我实在解决不了了
下面是我的util package textview.exam; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; /** * Created by fei on 2016/6/16. */ public class Shishinews { String httpUrl = "http://apis.baidu.com/songshuxiansheng/news/news"; String httpArg = ""; String jsonResult = request(httpUrl, httpArg); //System.out.println(jsonResult); /** * @param urlAll * :请求接口 * @param httpArg * :参数 * @return 返回结果 */ public static String request(String httpUrl, String httpArg) { BufferedReader reader = null; String result = null; StringBuffer sbf = new StringBuffer(); httpUrl = httpUrl + "?" + httpArg; try { URL url = new URL(httpUrl); HttpURLConnection connection = (HttpURLConnection) url .openConnection(); connection.setRequestMethod("GET"); // 填入apikey到HTTP header connection.setRequestProperty("apikey", "f761aa7e1d7b5ebe4******"); connection.connect(); InputStream is = connection.getInputStream(); reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); String strRead = null; while ((strRead = reader.readLine()) != null) { sbf.append(strRead); sbf.append("\r\n"); } reader.close(); result = sbf.toString(); } catch (Exception e) { e.printStackTrace(); } return result; } } 下面是我fragment的代码 package textview.exam; import android.annotation.SuppressLint; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.Toast; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class FragmentMainchatnews extends Fragment { String httpUrl = "http://apis.baidu.com/songshuxiansheng/news/news"; String httpArg = ""; private String[] title;//新闻标题 private String[] abs;//新闻简介 private String[] image_url;//图片链接地址 Thread thread = null; String newsjson; @Override public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { // TODO Auto-generated method stub View view=inflater.inflate(R.layout.main_chat_news, null); return view; } // 开启线程得到答案 Runnable runnable = new Runnable() { @Override public void run() { newsjson = Shishinews.request(httpUrl, httpArg); Log.v("debug",newsjson); Message message = new Message(); message.what = 1;// 标志是哪个线程传数据 } }; @SuppressLint("HandlerLeak") class MyHandler extends Handler { // 接受message的信息 @Override public void handleMessage(Message msg) { super.handleMessage(msg); try { JSONObject object = new JSONObject(newsjson); newsjson = object.get("retDate").toString(); } catch (JSONException e) { e.printStackTrace(); } if (msg.what == 1) { // 创建一个List集合,List集合的元素是Map List<Map<String, Object>> listItems = new ArrayList<Map<String, Object>>(); for (int i = 0; i < title.length; i++) { Map<String, Object> listItem = new HashMap<String, Object>(); listItem.put("image", image_url[i]); listItem.put("title", title[i]); listItem.put("abs", abs[i]); listItems.add(listItem); } // 创建一个SimpleAdapter SimpleAdapter simpleAdapter = new SimpleAdapter(getActivity(), listItems,R.layout.simple_item, new String[]{"image", "title", "abs"}, new int[]{R.id.image, R.id.title ,R.id.abs}); ListView list = (ListView) getView().findViewById(R.id.chat_news); // 为ListView设置Adapter list.setAdapter(simpleAdapter); // 为ListView的列表项的单击事件绑定事件监听器 list.setOnItemClickListener(new AdapterView.OnItemClickListener() { // 第position项被单击时激发该方法 @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent=new Intent(getActivity(),ChatActivity.class); startActivity(intent); } }); // 为ListView的列表项的选中事件绑定事件监听器 list.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { // 第position项被选中时激发该方法 @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { System.out.println(title[position] + "被选中了"); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); } } } public void sendMessage() { if (getView().findViewById(R.id.chat_news)==null) { Toast.makeText(getActivity(), "下拉刷新", Toast.LENGTH_SHORT).show(); } else { // 创建一个List集合,List集合的元素是Map List<Map<String, Object>> listItems = new ArrayList<Map<String, Object>>(); for (int i = 0; i < title.length; i++) { Map<String, Object> listItem = new HashMap<String, Object>(); listItem.put("image", image_url[i]); listItem.put("title", title[i]); listItem.put("abs", abs[i]); listItems.add(listItem); } thread = new Thread(runnable); thread.start(); } } } 下面是我AndroidMainfest.xml中的代码 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="textview.exam" > <!-- 添加权限 --> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.USE_CREDENTIALS" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.READ_PROFILE" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".LoginActivity" android:label="@string/title_activity_login" android:windowSoftInputMode="adjustResize|stateHidden" > </activity> <activity android:name=".ChatActivity" android:label="@string/title_activity_chat" > android:labl="聊天" </activity> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> </application> </manifest> 该有的权限我应该都设置了,可是还是不成功,大神们啊,这个我是解决不了了,就想获取个简单的新闻,我连什么关键词都没有
ScrollView,ViewPager,ListView嵌套问题
![图片说明](https://img-ask.csdn.net/upload/201504/22/1429682508_934584.png) 项目中想类似实现如上图的效果,全局一个ScrollView,下面我用的是ViewPager,里面有3个Fragment,Fragment下面有ListView,嵌套的各种冲突基本百度谷歌解决了,运行测试数据是没问题的,但因为我的ListView是直接计算高度的,失去了缓存机制和回收机制,在第一次加载的时候都会把ListView的所有项加载进来,担心后面会有效率的问题,因为ListView数据还是挺多的,大神们有更好的解决方法么?
:Expected BEGIN_ARRAY求大神们
12-03 01:40:58.903 3439-3456/? E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher Process: com.h954gmail.y.cnch, PID: 3439 com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $ at com.google.gson.Gson.fromJson(Gson.java:899) at com.google.gson.Gson.fromJson(Gson.java:852) at com.google.gson.Gson.fromJson(Gson.java:801) at com.h954gmail.y.cnch.fragment.HomeFragment$1.onResponse(HomeFragment.java:88) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:126) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $ at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:350) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:80) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61) at com.google.gson.Gson.fromJson(Gson.java:887) at com.google.gson.Gson.fromJson(Gson.java:852)  at com.google.gson.Gson.fromJson(Gson.java:801)  at com.h954gmail.y.cnch.fragment.HomeFragment$1.onResponse(HomeFragment.java:88)  at okhttp3.RealCall$AsyncCall.execute(RealCall.java:126)  at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)  at java.lang.Thread.run(Thread.java:818)  求解!!
Camera2 如何同时开启前后摄像头Preview并进行录像?
我按照camera2 谷歌的demo,同时开启两个线程进行相同操作,但是运行时最后一个摄像头能preview出来,前一个停在最后一帧,不能两个同时动。请问如何进行多线程同时操作?本人新手,多线程不太熟悉,求指教! @Override public void onResume() { super.onResume(); if (texture_front.isAvailable()) { openCamera(false,texture_front.getWidth(), texture_front.getHeight()); } else { texture_front.setSurfaceTextureListener(mFrontTextureListener); } if (texture_back.isAvailable()) { openCamera(true,texture_back.getWidth(), texture_back.getHeight()); } else { texture_back.setSurfaceTextureListener(mBackTextureListener); } startBackgroundThread(); } private void startBackgroundThread() { mBackgroundThread_front = new HandlerThread("Camera_front"); mBackgroundThread_front.start(); mHandler_front = new Handler(mBackgroundThread_front.getLooper()); mBackgroundThread_back=new HandlerThread("Camera_back"); mBackgroundThread_back.start(); mHandler_back=new Handler(mBackgroundThread_back.getLooper()); } 接下来OpenCamera方法 private void openCamera(boolean isBack,int width, int height) { if (!hasPermissionsGranted(VIDEO_PERMISSIONS)) { requestVideoPermissions(); return; } final Activity activity = getActivity(); if (null == activity || activity.isFinishing()) { return; } CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE); try { L.d("tryAcquire"); if (!getSemaphore(isBack).tryAcquire(2500, TimeUnit.MILLISECONDS)) { throw new RuntimeException("Time out waiting to lock camera opening."); } String cameraId; if (isBack){ cameraId = manager.getCameraIdList()[0]; //0后 1前 // Choose the sizes for camera preview and video recording CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId); StreamConfigurationMap map = characteristics .get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP); mSensorOrientation = characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION); if (map == null) { throw new RuntimeException("Cannot get available preview/video sizes"); } mVideoSize = chooseVideoSize(map.getOutputSizes(MediaRecorder.class)); mPreviewSize = chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class), width, height, mVideoSize); int orientation = getResources().getConfiguration().orientation; if (orientation == Configuration.ORIENTATION_LANDSCAPE) { texture_back.setAspectRatio(mPreviewSize.getWidth(), mPreviewSize.getHeight()); } else { texture_back.setAspectRatio(mPreviewSize.getHeight(), mPreviewSize.getWidth()); } configureTransform(true,width, height); mMediaRecorder = new MediaRecorder(); manager.openCamera(cameraId, mStateCallback_back, null); }else { cameraId = manager.getCameraIdList()[1]; //0后 1前 // Choose the sizes for camera preview and video recording CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId); StreamConfigurationMap map = characteristics .get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP); mSensorOrientation = characteristics.get(CameraCharacteristics.SENSOR_ORIENTATION); if (map == null) { throw new RuntimeException("Cannot get available preview/video sizes"); } mVideoSize = chooseVideoSize(map.getOutputSizes(MediaRecorder.class)); mPreviewSize = chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class), width, height, mVideoSize); int orientation = getResources().getConfiguration().orientation; if (orientation == Configuration.ORIENTATION_LANDSCAPE) { texture_front.setAspectRatio(mPreviewSize.getWidth(), mPreviewSize.getHeight()); } else { texture_front.setAspectRatio(mPreviewSize.getHeight(), mPreviewSize.getWidth()); } configureTransform(false,width, height); mMediaRecorder = new MediaRecorder(); manager.openCamera(cameraId, mStateCallback_front, null); } } catch (CameraAccessException e) { showTip("Cannot access the camera."); activity.finish(); } catch (NullPointerException e) { // Currently an NPE is thrown when the Camera2API is used but not supported on the // device this code runs. ErrorDialog.newInstance(getString(R.string.camera_error)) .show(getChildFragmentManager(), FRAGMENT_DIALOG); } catch (InterruptedException e) { throw new RuntimeException("Interrupted while trying to lock camera opening."); } } #然后到StateCallBack,我分成前后摄像头两个callback private CameraDevice.StateCallback mStateCallback_back = new CameraDevice.StateCallback() { @Override public void onOpened(@NonNull CameraDevice cameraDevice) { mCameraDevice = cameraDevice; startPreview(true); mCameraOpenCloseLock.release(); if (null != texture_back) { configureTransform(true,texture_back.getWidth(), texture_back.getHeight()); } } @Override public void onDisconnected(@NonNull CameraDevice cameraDevice) { mCameraOpenCloseLock.release(); cameraDevice.close(); mCameraDevice = null; } @Override public void onError(@NonNull CameraDevice cameraDevice, int error) { mCameraOpenCloseLock.release(); cameraDevice.close(); mCameraDevice = null; Activity activity = getActivity(); if (null != activity) { activity.finish(); } } }; private CameraDevice.StateCallback mStateCallback_front = new CameraDevice.StateCallback() { @Override public void onOpened(@NonNull CameraDevice cameraDevice) { mCameraDevice = cameraDevice; startPreview(false); mCameraOpenCloseLock_front.release(); if (null != texture_front) { configureTransform(false,texture_front.getWidth(), texture_front.getHeight()); } } @Override public void onDisconnected(@NonNull CameraDevice cameraDevice) { mCameraOpenCloseLock_front.release(); cameraDevice.close(); mCameraDevice = null; } @Override public void onError(@NonNull CameraDevice cameraDevice, int error) { mCameraOpenCloseLock_front.release(); cameraDevice.close(); mCameraDevice = null; Activity activity = getActivity(); if (null != activity) { activity.finish(); } } }; # Callback成功后会返回startPreview()方法 private void startPreview(final Boolean isBack) { if (null == mCameraDevice || !getTexture(isBack).isAvailable() || null == mPreviewSize) { return; } final String threadName; if (isBack){ threadName="Camera_back"; }else { threadName="Camera_front"; } try { closePreviewSession(); SurfaceTexture texture = getTexture(isBack).getSurfaceTexture(); assert texture != null; texture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight()); mPreviewBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW); Surface previewSurface = new Surface(texture); mPreviewBuilder.addTarget(previewSurface); mCameraDevice.createCaptureSession(Collections.singletonList(previewSurface), new CameraCaptureSession.StateCallback() { @Override public void onConfigured(@NonNull CameraCaptureSession session) { mPreviewSession = session; //updatePreview if (null == mCameraDevice) { return; } try { setUpCaptureRequestBuilder(mPreviewBuilder); HandlerThread thread = new HandlerThread(threadName); thread.start(); mPreviewSession.setRepeatingRequest(mPreviewBuilder.build(), null, mHandler_back); } catch (CameraAccessException e) { e.printStackTrace(); } } @Override public void onConfigureFailed(@NonNull CameraCaptureSession session) { Activity activity = getActivity(); if (null != activity) { Toast.makeText(activity, "Failed", Toast.LENGTH_SHORT).show(); } } }, mHandler_back); } catch (CameraAccessException e) { e.printStackTrace(); } } private AutoFitTextureView getTexture(boolean isBack){ if (isBack){ return texture_back; }else { return texture_front; } } ## 以上是预览的核心代码,录像部分就不贴上去了。试了很多方法,始终不能两个摄像头同时previeew,只能其中一个单独预览。求教 ![图片说明](https://img-ask.csdn.net/upload/201903/05/1551770621_259074.jpg)
Kafka实战(三) - Kafka的自我修养与定位
Apache Kafka是消息引擎系统,也是一个分布式流处理平台(Distributed Streaming Platform) Kafka是LinkedIn公司内部孵化的项目。LinkedIn最开始有强烈的数据强实时处理方面的需求,其内部的诸多子系统要执行多种类型的数据处理与分析,主要包括业务系统和应用程序性能监控,以及用户行为数据处理等。 遇到的主要问题: 数据正确性不足 数据的收集主要...
volatile 与 synchronize 详解
Java支持多个线程同时访问一个对象或者对象的成员变量,由于每个线程可以拥有这个变量的拷贝(虽然对象以及成员变量分配的内存是在共享内存中的,但是每个执行的线程还是可以拥有一份拷贝,这样做的目的是加速程序的执行,这是现代多核处理器的一个显著特性),所以程序在执行过程中,一个线程看到的变量并不一定是最新的。 volatile 关键字volatile可以用来修饰字段(成员变量),就是告知程序任何对该变量...
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
有哪些让程序员受益终生的建议
从业五年多,辗转两个大厂,出过书,创过业,从技术小白成长为基层管理,联合几个业内大牛回答下这个问题,希望能帮到大家,记得帮我点赞哦。 敲黑板!!!读了这篇文章,你将知道如何才能进大厂,如何实现财务自由,如何在工作中游刃有余,这篇文章很长,但绝对是精品,记得帮我点赞哦!!!! 一腔肺腑之言,能看进去多少,就看你自己了!!! 目录: 在校生篇: 为什么要尽量进大厂? 如何选择语言及方...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
GitHub开源史上最大规模中文知识图谱
近日,一直致力于知识图谱研究的 OwnThink 平台在 Github 上开源了史上最大规模 1.4 亿中文知识图谱,其中数据是以(实体、属性、值),(实体、关系、实体)混合的形式组织,数据格式采用 csv 格式。 到目前为止,OwnThink 项目开放了对话机器人、知识图谱、语义理解、自然语言处理工具。知识图谱融合了两千五百多万的实体,拥有亿级别的实体属性关系,机器人采用了基于知识图谱的语义感...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
微信支付崩溃了,但是更让马化腾和张小龙崩溃的竟然是……
loonggg读完需要3分钟速读仅需1分钟事件还得还原到昨天晚上,10 月 29 日晚上 20:09-21:14 之间,微信支付发生故障,全国微信支付交易无法正常进行。然...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小型人工智障。 知识可以运用在不同地方,不一定非是天气预报。
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
英特尔不为人知的 B 面
从 PC 时代至今,众人只知在 CPU、GPU、XPU、制程、工艺等战场中,英特尔在与同行硬件芯片制造商们的竞争中杀出重围,且在不断的成长进化中,成为全球知名的半导体公司。殊不知,在「刚硬」的背后,英特尔「柔性」的软件早已经做到了全方位的支持与支撑,并持续发挥独特的生态价值,推动产业合作共赢。 而对于这一不知人知的 B 面,很多人将其称之为英特尔隐形的翅膀,虽低调,但是影响力却不容小觑。 那么,在...
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
刷了几千道算法题,这些我私藏的刷题网站都在这里了!
遥想当年,机缘巧合入了 ACM 的坑,周边巨擘林立,从此过上了"天天被虐似死狗"的生活… 然而我是谁,我可是死狗中的战斗鸡,智力不够那刷题来凑,开始了夜以继日哼哧哼哧刷题的日子,从此"读题与提交齐飞, AC 与 WA 一色 ",我惊喜的发现被题虐既刺激又有快感,那一刻我泪流满面。这么好的事儿作为一个正直的人绝不能自己独享,经过激烈的颅内斗争,我决定把我私藏的十几个 T 的,阿不,十几个刷题网...
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看...
白话阿里巴巴Java开发手册高级篇
不久前,阿里巴巴发布了《阿里巴巴Java开发手册》,总结了阿里巴巴内部实际项目开发过程中开发人员应该遵守的研发流程规范,这些流程规范在一定程度上能够保证最终的项目交付质量,通过在时间中总结模式,并推广给广大开发人员,来避免研发人员在实践中容易犯的错误,确保最终在大规模协作的项目中达成既定目标。 无独有偶,笔者去年在公司里负责升级和制定研发流程、设计模板、设计标准、代码标准等规范,并在实际工作中进行...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
Nginx 原理和架构
Nginx 是一个免费的,开源的,高性能的 HTTP 服务器和反向代理,以及 IMAP / POP3 代理服务器。Nginx 以其高性能,稳定性,丰富的功能,简单的配置和低资源消耗而闻名。 Nginx 的整体架构 Nginx 里有一个 master 进程和多个 worker 进程。master 进程并不处理网络请求,主要负责调度工作进程:加载配置、启动工作进程及非停升级。worker 进程负责处...
YouTube排名第一的励志英文演讲《Dream(梦想)》
Idon’t know what that dream is that you have, I don't care how disappointing it might have been as you've been working toward that dream,but that dream that you’re holding in your mind, that it’s po...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
相关热词 基于c#波形控件 c# 十进制转十六进制 对文件aes加密vc# c#读取栈中所有的值 c# rsa256加密 好 学c# 还是c++ c# 和java的差距 c# curl网络框架 c# https证书请求 c# 中崎
立即提问